Welcome to the Spoken tutorial on Arduino Programming with Scilab and Xcos.
In this tutorial, we will learn about
Arduino - Scilab toolbox
Interfacing Arduino with Scilab
Interfacing Arduino with Xcos
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 Scilab, go through the Scilab spoken tutorials on this website.
You will learn about: Introduction to Scilab
Introduction to Xcos
Scilab and Xcos interface and Simulation
I have downloaded Microcontroller Programming with Arduino, Scilab and Xcos ebook.
Refer to chapter 3 in the book.
Follow the steps given for the installation of Arduino IDE and Scilab
Installation steps are given for Windows and Linux OS.
Xcos comes pre-installed with Scilab. Hence a separate installation of Xcos is not required.
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, Scilab does not have the capability to communicate with Arduino.
All such add-on functionalities are added to Scilab 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 created different toolboxes for Windows and Linux OS.
The Scilab Arduino toolbox can be found inside the Origin slash tools slash scilab slash windows or Origin slash tools slash scilab slash linux directory.
First we have to load the toolbox depending upon your OS.
I’ll show you how to load the toolbox in Linux.
Open the terminal by pressing Ctrl+Alt+T keys.
I have already installed Arduino IDE and Scilab 5.5.2 in my Linux system as specified in the book.
Go to the folder where Scilab is installed as shown and launch Scilab.
Next we have to change the working directory.
In the File Browser, select the toolbox folder available at Desktop slash Origin slash tools slash scilab slash linux
Click on the OK button.
Now the Scilab working directory becomes the toolbox folder.
In the file browser panel, we can see the builder.sce file gets loaded.
This shows that we are in the right directory.
Type the command exec builder.sce on the Scilab console.
Next, type the command exec loader.sce. This will load the toolbox.
Note: If you clear the workspace for any reason, you will have to execute this command once again.
We have to run the Scilab script to check whether the firmware is properly installed or not.
It is available at: Origin slash tools slash scilab slash test underscore firmware dot sce
In the Scilab console, type editor and press the Enter key.
Click on the “File” menu and choose “Open”.
Browse to the directory Origin slash tools slash scilab.
Choose the file test underscore firmware dot sce.
It will open a Scilab code.
In the menu bar, click on the Execute option, to execute the code.
Then choose File with no echo.
We see the response of this code as "answer is equal to ok".
Next let us run the Scilab program in chapter 5. That is, Interfacing a Pushbutton.
This program will read the status of the pushbutton and display it on the GUI.
Open the file available at Origin slash user hyphen code slash push slash scilab slash push hyphen button hyphen status dot sce
Click on the Execute button.
Press the pushbutton in the shield.
The GUI in Scilab shows the status of the pushbutton as 1 when it is pressed.
It shows 0 when it is released.
Likewise practice the experiments in Scilab with other components as specified in the book.
Next we will see how to run the Arduino program in Xcos.
Type Xcos in the editor to launch Xcos.
Next we will run the code to turn the LED on or off, depending on the pushbutton.
The code is available in the Origin slash user hyphen code slash push slash scilab slash led hyphen push hyphen button dot zcos
Click on the File menu and Open the file led hyphen push hyphen button dot zcos as shown.
When the user presses the pushbutton, the LED on digital pin 9 of the shield is switched on.
When the pushbutton is released, the LED is switched off.
Do the otherXcos experiments as specified in the book.
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-Scilab toolbox is properly running or not.
You have to load the Arduino Scilab toolbox each time when you launch Scilab.
With this we come to the end of this tutorial. Let us summarize.
In this tutorial, we learnt about Arduino - Scilab toolbox
Interfacing Arduino with Scilab
Interfacing Arduino with Xcos
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.