Welcome to the Spoken tutorial on Arduino Programming with OpenModelica.
In this tutorial, we will learn about Arduino OpenModelica toolbox
Interfacing Arduino with OpenModelica
To record this tutorial, I’m using
Ubuntu Linux OS version 18.04
Arduino Shield and Arduino Uno Board
To follow this tutorial, you should go through the below Arduino Spoken tutorial.
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
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
I have downloaded the e-book on my Desktop.
Let us open the book Microcontroller Programming with Arduino and OpenModelica.
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.
Connect the Arduino UNO board with Arduino shield to the USB port of the computer
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 slash tools slash floss hyphen firmware slash floss hyphen firmware dot ino
As discussed in the earlier tutorial, the above steps have to be done before proceeding further.
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.
The Arduino-OpenModelica toolbox can be found inside the directory Origin slash tools slash OpenModelica slash windows or Origin slash tools slash OpenModelica slash 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.
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 slash Library File(s) option.
Navigate to Origin slash tools slash openmodelica slash 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.
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: 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.
In this tutorial, we learnt about Arduino-OpenModelica toolbox
Interfacing Arduino with OpenModelica
The video at the following link, summarizes the Spoken Tutorial project. Please download and watch it.
The Spoken Tutorial Project Team conducts workshops and gives certificates. For more details, please write to us.
Please post your timed queries on this forum.
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.