Difference between revisions of "Arduino/C4/Arduino-Programming-with-Python/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 Python.''' |- || '''Slide 2:'''...")
 
 
(3 intermediate revisions by 2 users not shown)
Line 13: Line 13:
 
'''Learning Objectives'''
 
'''Learning Objectives'''
 
|| In this tutorial, we will learn about
 
|| In this tutorial, we will learn about
*'''Arduino - Python''' toolbox
+
*'''Arduino - Python toolbox'''
 
*Interfacing '''Arduino''' with''' Python'''
 
*Interfacing '''Arduino''' with''' Python'''
 
|-
 
|-
Line 22: Line 22:
 
*'''Ubuntu Linux '''OS version 18.04  
 
*'''Ubuntu Linux '''OS version 18.04  
 
*'''Arduino Shield''' and
 
*'''Arduino Shield''' and
*'''Arduino Uno Board'''
+
*'''Arduino UNO Board'''
 
|-
 
|-
 
|| '''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.'''
 
|-
 
|-
 
|| '''Slide 5:'''
 
|| '''Slide 5:'''
 
'''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 43: Line 43:
 
||'''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 '''Microcontroller Programming with Arduino and Python '''ebook on my desktop.
+
|| I have downloaded '''Microcontroller Programming with Arduino and Python ebook''' on my '''Desktop'''.
 
|-
 
|-
 
|| Show the relevant pages in the book.
 
|| Show the relevant pages in the book.
Line 49: Line 49:
 
||
 
||
 
*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 '''Python''' depending upon your OS.
+
*Follow the steps and do the '''installation''' of '''Arduino IDE '''and '''Python''' 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
 
|-
 
|-
 
|| '''Slide:'''
 
|| '''Slide:'''
Line 62: Line 62:
 
|| 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'''
  
As discussed in the earlier tutorial the above steps have to be done before proceeding further.
+
As discussed in the earlier tutorial, the above steps have to be done before proceeding further.
 
|-
 
|-
 
|| '''Slide 9:'''
 
|| '''Slide 9:'''
Line 77: Line 77:
 
||
 
||
 
*By default, '''Python''' does not have the capability to communicate with '''Arduino'''.
 
*By default, '''Python''' does not have the capability to communicate with '''Arduino'''.
*We have created a package that makes use of the functions available in '''pyserial'''.
+
*We have created a '''package''' that makes use of the '''functions''' available in '''pyserial'''.
*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'''.
 
|-
 
|-
 
|| Show the book: 3.2.4
 
|| Show the book: 3.2.4
  
|| We have to run the '''Python''' script to check whether the firmware is properly installed or not.
+
|| We have to '''run''' the '''Python script''' to check whether the '''firmware''' is properly installed or not.
  
 
It is available at '''Origin/tools/python/test_firmware.py.'''
 
It is available at '''Origin/tools/python/test_firmware.py.'''
 
|-
 
|-
 
||  
 
||  
|| Open the terminal by pressing''' Ctrl+Alt+T''' keys.
+
|| Open the '''terminal''' by pressing''' Ctrl+Alt+T''' keys.
  
I have already installed '''Arduino IDE''' and '''Python 3.5''' in my '''Linux''' system as specified in the book.
+
I have already '''installed Arduino IDE''' and '''Python 3.5''' in my '''Linux system''' as specified in the '''book'''.
 
|-
 
|-
 
||  
 
||  
Line 99: Line 99:
  
 
'''>python3''' '''test_firmware.py '''
 
'''>python3''' '''test_firmware.py '''
|| Go to the python folder where '''test_firmware.py '''is saved as shown.
+
|| Go to the '''python''' folder where '''test_firmware.py '''is saved as shown.
  
Let us test the working of the '''Python - Arduino t'''oolbox in python.
+
Let us test the working of the '''Python - Arduino toolbox''' in '''python'''.
  
Type '''python3''' '''test_firmware.py t'''o execute the python code.
+
Type '''python3 test_firmware.py''' to execute the '''Python''' code.
  
You will see three "ok" messages .
+
You will see three '''"ok"''' messages.
  
This shows that the''' floss-firmware and Python toolbox''' are working properly.
+
This shows that the''' floss-firmware''' and '''Python toolbox''' are working properly.
 
|-
 
|-
 
|| '''Show the book page 42'''
 
|| '''Show the book page 42'''
  
 
'''code 4.4.2'''
 
'''code 4.4.2'''
|| Next let us run the '''Python''' program in chapter 4. That is, '''Interfacing a Light Emitting Diode'''
+
|| Next let us '''run''' the '''Python program''' in chapter 4. That is, '''Interfacing a Light Emitting Diode'''
  
This program will turn on the blue '''LED'''.
+
This '''program''' will turn '''ON''' the blue '''LED'''.
 
|-
 
|-
 
|| '''>cd Origin/user-code/led/python/'''
 
|| '''>cd Origin/user-code/led/python/'''
  
 
'''>python3 led-blue.py'''
 
'''>python3 led-blue.py'''
|| Switch back to the terminal.
+
|| Switch back to the '''terminal'''.
  
Let us go to the folder where the''' led-blue.py''' program is saved.
+
Let us go to the folder where the''' led-blue.py program''' is saved.
  
To execute the program, type, '''python3 led-blue.py'''
+
To '''execute''' the '''program''', type, '''python3 led-blue.py'''
 
|-
 
|-
 
|| Blue led.jpg
 
|| Blue led.jpg
|| Observe the blue '''LED''' is turned on the shield.
+
|| Observe the blue '''LED''' is turned '''ON''' the shield.
  
It denotes the '''Python''' tool box and '''FLOSS''' firmware are working.
+
It denotes the '''Python toolbox''' and '''FLOSS firmware''' are working.
 
|-
 
|-
 
||  
 
||  
|| Do the other '''Python''' experiments as specified in the book.
+
|| Do the other '''Python''' experiments as specified in the '''book'''.
 
|-
 
|-
 
|| Slide:
 
|| Slide:
Line 138: Line 138:
 
||  
 
||  
 
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 '''Python''' '''test_firmware.py''' is properly running or not.
+
*Check if the '''Python test_firmware.py''' is properly '''running''' or not.
 
|-
 
|-
 
||  
 
||  
Line 152: Line 152:
  
 
Summary
 
Summary
|| In this tutorial, we learnt
+
|| In this tutorial, we learnt about
  
*'''Arduino Python''' toolbox
+
*'''Arduino Python toolbox'''
 
*Interfacing '''Arduino''' with''' Python'''
 
*Interfacing '''Arduino''' with''' Python'''
 
|-
 
|-

Latest revision as of 13:27, 16 September 2021


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

Learning Objectives

In this tutorial, we will learn about
  • Arduino - Python toolbox
  • Interfacing Arduino with Python
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
About Python:

Spoken tutorial link.

If you are not familiar with Python, go through the Python spoken tutorials on this website.
Point to the book in the desktop

and open the book

I have downloaded Microcontroller Programming with Arduino and Python ebook on my Desktop.
Show the relevant pages in the book.

Chapter 3 : Page 18, 19

  • Refer to chapter 3 in the book.
  • Follow the steps and do the installation of Arduino IDE and Python 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
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 9:

About Python-Arduino toolbox

  • By default, Python does not have the capability to communicate with Arduino.
  • We have created a package that makes use of the functions available in pyserial.
  • These functions are required to run various experiments on the Arduino UNO board.
  • It also establishes a serial communication with Arduino.
Show the book: 3.2.4 We have to run the Python script to check whether the firmware is properly installed or not.

It is available at Origin/tools/python/test_firmware.py.

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

I have already installed Arduino IDE and Python 3.5 in my Linux system as specified in the book.

>cd Desktop

>cd Origin/tools/python/test_firmware.py

>python3 test_firmware.py

Go to the python folder where test_firmware.py is saved as shown.

Let us test the working of the Python - Arduino toolbox in python.

Type python3 test_firmware.py to execute the Python code.

You will see three "ok" messages.

This shows that the floss-firmware and Python toolbox are working properly.

Show the book page 42

code 4.4.2

Next let us run the Python program in chapter 4. That is, Interfacing a Light Emitting Diode

This program will turn ON the blue LED.

>cd Origin/user-code/led/python/

>python3 led-blue.py

Switch back to the terminal.

Let us go to the folder where the led-blue.py program is saved.

To execute the program, type, python3 led-blue.py

Blue led.jpg Observe the blue LED is turned ON the shield.

It denotes the Python toolbox and FLOSS firmware are working.

Do the other Python experiments as specified in the book.
Slide:

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 Python test_firmware.py is properly running or not.
With this we come to the end of this tutorial. Let us summarize.

Slide 8:

Summary

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