Arduino/C4/Arduino-Programming-with-Scilab-and-Xcos/English

From Script | Spoken-Tutorial
Revision as of 18:51, 20 October 2021 by Nirmala Venkat (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
VISUAL CUE NARRATION
Slide 1: Welcome to the Spoken tutorial on Arduino Programming with Scilab and Xcos.
Slide 2:

Learning Objectives

In this tutorial, we will learn about
  • Arduino - Scilab toolbox
  • Interfacing Arduino with Scilab
  • Interfacing Arduino with Xcos
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 Scilab and Xcos

If you are not familiar with Scilab, go through the Scilab spoken tutorials on this website.
  • Introduction to Scilab
  • Introduction to Xcos
  • Scilab and Xcos interface and
  • Simulation
Point to the book in the desktop

and open the book

I have downloaded Microcontroller Programming with Arduino, Scilab and Xcos ebook.
Show the relevant pages in the book.
  • 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.
Arduino shield_USB.jpg Connect the Arduino uno board with Arduino shield to the USB port of the computer
Slide:

Points to be noted:

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 7:

About -Scilab - ArduinoToolbox

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.
Show the directory in the book The Scilab Arduino toolbox can be found inside the Origin/tools/scilab/windows or Origin/tools/scilab/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 the Scilab.

Next we have to change the working directory.

In the File Browser, Select the toolbox folder available at Desktop/Origin/tools/scilab/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.

> exec builder.sce 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.

Origin/tools/scilab/test_firmware.sce

Select Origin/tools/scilab/ test_firmware.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/tools/scilab.

Choose the file test_firmware.sce.

It will open a Scilab Code.

click on the Execute

select File with no echo.

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 “ans = ”“ok” three times.

This confirms the working of the Arduino-Scilab toolbox.

Show chapters 5 program push-button-status.sce 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 Origin/user-code/push/scilab/push-button-status.sce Open the file available at Origin/user-code/push/scilab/push-button-status.sce
Click on execute 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.

narration only 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 the 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/user-code/push/scilab/led-push-button.zcos

Click on the File menu and Open the file led-push-button.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: 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 the Scilab.
With this we come to the end of this tutorial. Let us summarize.

Slide 8:

Summary

In this tutorial, we learnt about
  • Arduino-Scilab toolbox
  • Interfacing Arduino with Scilab
  • Interfacing Arduino with Xcos
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