Difference between revisions of "Arduino/C4/Arduino-Programming-with-OpenModelica/English"

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with " {| border="1" |- || '''VISUAL CUE''' || '''NARRATION''' |- || '''Slide 1:''' ||Welcome to the Spoken tutorial on '''Arduino Programming with OpenModelica.''' |- || '''Sli...")
 
 
Line 16: Line 16:
 
'''Learning Objectives'''
 
'''Learning Objectives'''
 
|| In this tutorial, we will learn about
 
|| In this tutorial, we will learn about
* '''Arduino OpenModelica''' toolbox
+
* '''Arduino OpenModelica toolbox'''
 
* Interfacing''' Arduino '''with''' OpenModelica'''
 
* Interfacing''' Arduino '''with''' OpenModelica'''
 
|-
 
|-
Line 30: Line 30:
 
|| '''Slide 4:'''
 
|| '''Slide 4:'''
 
'''Prerequisites'''
 
'''Prerequisites'''
||To follow this tutorial, you should go through the below''' Arduino Spoken tutorial.
+
||To follow this tutorial, you should go through the below''' Arduino Spoken tutorial.'''
 
* '''Getting ready for Arduino FLOSS.'''
 
* '''Getting ready for Arduino FLOSS.'''
 
|-
 
|-
Line 37: Line 37:
 
'''Getting ready for Arduino Floss'''
 
'''Getting ready for Arduino Floss'''
 
|| In the above tutorial, you will learn
 
|| In the above tutorial, you will learn
* How to download the e-book and code files required for the experiments.
+
* How to download the '''e-book''' and code files required for the experiments.
* How to upload and compile '''Arduino''' programs in '''Arduino IDE.'''
+
* How to upload and '''compile Arduino programs''' in '''Arduino IDE.'''
 
* About''' FLOSS Firmware'''
 
* About''' FLOSS Firmware'''
 
|-
 
|-
Line 48: Line 48:
 
* Introduction to '''OpenModelica'''
 
* Introduction to '''OpenModelica'''
 
* '''OpenModelica '''interface
 
* '''OpenModelica '''interface
* Various perspectives and
+
* Various '''perspectives''' and
* Simulation
+
* '''Simulation'''
 
|-
 
|-
|| '''Point to the book in the desktop'''
+
|| '''Point to the book in the Desktop'''
 
'''and open the book'''
 
'''and open the book'''
|| I have downloaded the ebook on my desktop.
+
|| I have downloaded the '''e-book''' on my '''Desktop'''.
  
 
Let us open the book '''Microcontroller Programming with Arduino and OpenModelica.'''
 
Let us open the book '''Microcontroller Programming with Arduino and OpenModelica.'''
Line 60: Line 60:
  
 
||  
 
||  
* Refer to chapter 3 in the book.
+
* Refer to chapter 3 in the '''book'''.
* Follow the steps and do the installation of '''Arduino IDE '''and '''OpenModelica '''depending upon your '''OS.'''
+
* Follow the steps and do the '''installation''' of '''Arduino IDE '''and '''OpenModelica '''depending upon your '''OS.'''
* Installation steps are given for '''Windows''' and '''Linux OS.'''
+
* '''Installation''' steps are given for '''Windows''' and '''Linux OS.'''
* The experiments that are covered in the book are tested in '''Ubuntu Linux 18.04 '''and '''Windows 10 OS.'''
+
* The experiments that are covered in the '''book''' are tested in '''Ubuntu Linux 18.04 '''and '''Windows 10 OS.'''
 
|-
 
|-
 
||  
 
||  
  
 
Arduino shield_USB.jpg
 
Arduino shield_USB.jpg
|| Connect the Arduino uno board with Arduino shield to the '''USB''' port of the computer
+
|| Connect the '''Arduino UNO board''' with '''Arduino shield''' to the '''USB port''' of the computer
 
|-
 
|-
 
|| '''Points to be noted:'''
 
|| '''Points to be noted:'''
Line 74: Line 74:
 
|| Note the below points:
 
|| Note the below points:
  
1. Launch Arduino IDE
+
1. Launch '''Arduino IDE'''
  
2. Check the port
+
2. Check the '''port'''
 +
 
 +
3. Upload the '''Floss firmware'''
  
3. Upload the Floss firmware
 
 
* That is, in the '''Arduino IDE''', upload the file available at '''Origin/tools/floss-firmware/floss-firmware.ino'''
 
* That is, in the '''Arduino IDE''', upload the file available at '''Origin/tools/floss-firmware/floss-firmware.ino'''
  
Line 88: Line 89:
 
||  
 
||  
 
* By default, '''OpenModelica '''does not have the capability to connect to '''Arduino'''.  
 
* By default, '''OpenModelica '''does not have the capability to connect to '''Arduino'''.  
* All such add-on functionalities are added to '''OpenModelica''' using the toolbox.
+
* All such '''add-on functionalities''' are added to '''OpenModelica''' using the '''toolbox'''.
* These functions are required to run various experiments on the Arduino''' Uno board.'''
+
* These '''functions''' are required to '''run''' various experiments on the '''Arduino UNO board.'''
* It also establishes a serial communication with '''Arduino'''.
+
* It also establishes a '''serial communication''' with '''Arduino'''.
* We have different toolboxes for '''Windows''' and '''Linux''' OS.
+
* We have different '''toolboxes''' for '''Windows''' and '''Linux''' OS.
 
|-
 
|-
 
||
 
||
Line 98: Line 99:
 
Desktop /origin/tools
 
Desktop /origin/tools
 
||  
 
||  
The '''Arduino-OpenModelica''' toolbox can be found inside the''' '''directory
+
The '''Arduino-OpenModelica toolbox''' can be found inside the '''directory'''
 
* '''Origin/tools/OpenModelica/windows/ or'''
 
* '''Origin/tools/OpenModelica/windows/ or'''
 
* '''Origin/tools/OpenModelica/linux/'''
 
* '''Origin/tools/OpenModelica/linux/'''
Line 104: Line 105:
 
|-
 
|-
 
||  
 
||  
|| First we have to load the toolbox depending upon your OS.
+
|| First we have to load the '''toolbox''' depending upon your '''OS'''.
  
I’ll show how to load the toolbox in '''Linux'''.
+
I’ll show how to load the '''toolbox''' in '''Linux'''.
 
|-
 
|-
 
||  
 
||  
|| Open the terminal by pressing '''Ctrl+Alt+T''' keys.
+
|| Open the '''terminal''' by pressing '''Ctrl+Alt+T''' keys.
  
I have installed '''Arduino IDE''' and '''OpenModelica 1.1.7 '''in my '''Linux''' system as specified in the book.
+
I have '''installed Arduino IDE''' and '''OpenModelica 1.1.7 '''in my '''Linux system''' as specified in the '''book'''.
 
|-
 
|-
 
|| cd Downloads
 
|| cd Downloads
Line 118: Line 119:
 
|| Go to the folder where '''OpenModelica''' is installed as shown and launch the '''OpenModelica.'''
 
|| Go to the folder where '''OpenModelica''' is installed as shown and launch the '''OpenModelica.'''
  
Next, we have to load the '''Arduino OpenModelica''' toolbox.
+
Next, we have to load the '''Arduino OpenModelica toolbox'''.
  
 
Click on '''File''' and then click on the '''OpenModel/Library File(s)''' option.
 
Click on '''File''' and then click on the '''OpenModel/Library File(s)''' option.
Line 126: Line 127:
 
Select '''Arduino.mo '''and '''test_firmware.mo '''and click '''Open'''.
 
Select '''Arduino.mo '''and '''test_firmware.mo '''and click '''Open'''.
  
In '''OMEdit''', under the '''Libraries''' panel, look for three new libraries.
+
In '''OMEdit''', under the '''Libraries''' panel, look for three new '''libraries'''.
  
 
They are '''Arduino, Modelica_Synchronous, Modelica_DeviceDrivers and test_firmware.mo.'''
 
They are '''Arduino, Modelica_Synchronous, Modelica_DeviceDrivers and test_firmware.mo.'''
  
This confirms that the '''Arduino OpenModelica''' toolbox has been loaded successfully.
+
This confirms that the '''Arduino OpenModelica toolbox''' has been loaded successfully.
 
|-
 
|-
 
|| Show chapter 8
 
|| Show chapter 8
  
||Next let us run the '''OpenModelica''' program in chapter 8. That is, '''Interfacing a Thermistor.'''
+
||Next let us '''run''' the '''OpenModelica program''' in chapter 8. That is, '''Interfacing a Thermistor.'''
  
This program will read and display the thermistor values.
+
This '''program''' will read and display the '''thermistor''' values.
  
 
Switch back to the '''OmEdit '''interface.
 
Switch back to the '''OmEdit '''interface.
  
The codes are available inside the''' Arduino OpenModelica''' toolbox''' '''under the libraries panel.
+
The codes are available inside the''' Arduino OpenModelica toolbox''' under the '''Libraries''' panel.
  
 
Select '''Arduino -> SerialCommunication -> Examples -> thermistor -> therm_read'''.
 
Select '''Arduino -> SerialCommunication -> Examples -> thermistor -> therm_read'''.
  
Double click on the file to open.
+
Double-click on the file to open.
  
Click on the '''simulate''' button on the top right corner.
+
Click on the '''Simulate''' button on the top right corner.
  
Click on the '''ok '''button in the simulation setup window.
+
Click on the '''Ok '''button in the '''simulation setup''' window.
 
|-
 
|-
 
||  
 
||  
||We can see the thermistor value displayed on the screen.
+
||We can see the '''thermistor''' value displayed on the screen.
  
Rub the thermistor with the fingertips.  
+
Rub the '''thermistor''' with the fingertips.  
  
It will transfer heat from the person's finger, thereby raising the temperature of the thermistor.
+
It will transfer heat from the person's finger, thereby raising the temperature of the '''thermistor'''.
  
Accordingly, we can observe the change in the thermistor values.
+
Accordingly, we can observe the change in the '''thermistor''' values.
 
|-
 
|-
 
|| '''Points to remember:'''
 
|| '''Points to remember:'''
 
|| Points to remember:
 
|| Points to remember:
  
* Whenever you plug the '''Arduino Uno board''' into the computer, check for the port.
+
* Whenever you plug the '''Arduino Uno board''' into the computer, check for the '''port'''.
* Then execute the commands required for read-write permission.
+
* Then '''execute''' the '''commands''' required for '''read-write permission.'''
* Don’t upload any '''Arduino''' program after uploading the '''FLOSS''' firmware to '''Arduino Uno board.'''
+
* Don’t upload any '''Arduino program''' after uploading the '''FLOSS firmware''' to '''Arduino Uno board.'''
* This would overwrite the '''FLOSS '''firmware.
+
* This would overwrite the '''FLOSS firmware'''.
* Check if the '''Arduino-OpenModelica '''toolbox is properly running or not.
+
* Check if the '''Arduino-OpenModelica toolbox''' is properly '''running''' or not.
 
* You have to load the '''Arduino OpenModelica toolbox '''each time when you launch the '''OMEdit'''.
 
* You have to load the '''Arduino OpenModelica toolbox '''each time when you launch the '''OMEdit'''.
 
|-
 
|-
Line 178: Line 179:
 
Summary
 
Summary
 
|| In this tutorial, we learnt about
 
|| In this tutorial, we learnt about
* '''Arduino-OpenModelica''' toolbox
+
* '''Arduino-OpenModelica toolbox'''
 
* Interfacing''' Arduino '''with''' OpenModelica'''
 
* Interfacing''' Arduino '''with''' OpenModelica'''
  
Line 199: Line 200:
  
 
Forum questions:
 
Forum questions:
|| * Please post your timed queries on this forum.
+
|| Please post your timed queries on this forum.
 
|-
 
|-
 
||'''Slide: '''Acknowledgement
 
||'''Slide: '''Acknowledgement

Latest revision as of 13:39, 16 September 2021



VISUAL CUE NARRATION
Slide 1: Welcome to the Spoken tutorial on Arduino Programming with OpenModelica.
Slide 2:

Learning Objectives

In this tutorial, we will learn about
  • Arduino OpenModelica toolbox
  • Interfacing Arduino with OpenModelica
Slide 3:

System requirements

To record this tutorial, I’m using
  • Ubuntu Linux OS version 18.04
  • Arduino Shield and
  • Arduino Uno Board
Slide 4:

Prerequisites

To follow this tutorial, you should go through the below Arduino Spoken tutorial.
  • Getting ready for Arduino FLOSS.
Slide 5:

Getting ready for Arduino Floss

In the above tutorial, you will learn
  • How to download the e-book and code files required for the experiments.
  • How to upload and compile Arduino programs in Arduino IDE.
  • About FLOSS Firmware
Slide 6:

About OpenModelica

If you are not familiar with OpenModelica, go through the spoken tutorials on this website.

You will learn about

  • Introduction to OpenModelica
  • OpenModelica interface
  • Various perspectives and
  • Simulation
Point to the book in the Desktop

and open the book

I have downloaded the e-book on my Desktop.

Let us open the book Microcontroller Programming with Arduino and OpenModelica.

Show the relevant pages in the book.
  • Refer to chapter 3 in the book.
  • Follow the steps and do the installation of Arduino IDE and OpenModelica depending upon your OS.
  • Installation steps are given for Windows and Linux OS.
  • The experiments that are covered in the book are tested in Ubuntu Linux 18.04 and Windows 10 OS.

Arduino shield_USB.jpg

Connect the Arduino UNO board with Arduino shield to the USB port of the computer
Points to be noted:

Show 3.1.5 in the book, page 25

Note the below points:

1. Launch Arduino IDE

2. Check the port

3. Upload the Floss firmware

  • That is, in the Arduino IDE, upload the file available at Origin/tools/floss-firmware/floss-firmware.ino

As discussed in the earlier tutorial, the above steps have to be done before proceeding further.

Slide 9:

About Arduino-OpenModelica toolbox

  • By default, OpenModelica does not have the capability to connect to Arduino.
  • All such add-on functionalities are added to OpenModelica using the toolbox.
  • These functions are required to run various experiments on the Arduino UNO board.
  • It also establishes a serial communication with Arduino.
  • We have different toolboxes for Windows and Linux OS.

Show the directory Desktop /origin/tools

The Arduino-OpenModelica toolbox can be found inside the directory

  • Origin/tools/OpenModelica/windows/ or
  • Origin/tools/OpenModelica/linux/
First we have to load the toolbox depending upon your OS.

I’ll show how to load the toolbox in Linux.

Open the terminal by pressing Ctrl+Alt+T keys.

I have installed Arduino IDE and OpenModelica 1.1.7 in my Linux system as specified in the book.

cd Downloads

> OMEdit

Go to the folder where OpenModelica is installed as shown and launch the OpenModelica.

Next, we have to load the Arduino OpenModelica toolbox.

Click on File and then click on the OpenModel/Library File(s) option.

Navigate to Origin/tools/openmodelica/linux.

Select Arduino.mo and test_firmware.mo and click Open.

In OMEdit, under the Libraries panel, look for three new libraries.

They are Arduino, Modelica_Synchronous, Modelica_DeviceDrivers and test_firmware.mo.

This confirms that the Arduino OpenModelica toolbox has been loaded successfully.

Show chapter 8 Next let us run the OpenModelica program in chapter 8. That is, Interfacing a Thermistor.

This program will read and display the thermistor values.

Switch back to the OmEdit interface.

The codes are available inside the Arduino OpenModelica toolbox under the Libraries panel.

Select Arduino -> SerialCommunication -> Examples -> thermistor -> therm_read.

Double-click on the file to open.

Click on the Simulate button on the top right corner.

Click on the Ok button in the simulation setup window.

We can see the thermistor value displayed on the screen.

Rub the thermistor with the fingertips.

It will transfer heat from the person's finger, thereby raising the temperature of the thermistor.

Accordingly, we can observe the change in the thermistor values.

Points to remember: Points to remember:
  • Whenever you plug the Arduino Uno board into the computer, check for the port.
  • Then execute the commands required for read-write permission.
  • Don’t upload any Arduino program after uploading the FLOSS firmware to Arduino Uno board.
  • This would overwrite the FLOSS firmware.
  • Check if the Arduino-OpenModelica toolbox is properly running or not.
  • You have to load the Arduino OpenModelica toolbox each time when you launch the OMEdit.
With this we come to the end of this tutorial. Let us summarize.

Slide 8:

Summary

In this tutorial, we learnt about
  • Arduino-OpenModelica toolbox
  • Interfacing Arduino with OpenModelica
Slide 10:

(About Spoken Tutorial Project)

The video at the following link, summarizes the Spoken Tutorial project.

Please download and watch it.

Slide 11:

(About Spoken Tutorial Project)

The Spoken Tutorial Project Team conducts workshops and gives certificates.

For more details, please write to us.

Slide

Forum questions:

Please post your timed queries on this forum.
Slide: Acknowledgement Spoken Tutorial project is funded by the Ministry of Education (MoE), Govt. of India.
This is Nirmala Venkat from Spoken Tutorial Project, IIT Bombay signing off.

Thanks for joining.

Contributors and Content Editors

Nancyvarkey, Nirmala Venkat