Difference between revisions of "Arduino/C3/Robot-Control-using-Bluetooth/English"

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with " {| style="border-spacing:0;" | style="background-color:#d9d2e9;border:0.75pt solid #000000;padding:0.176cm;"| Visual Cue | style="background-color:#d9d2e9;border:0.75pt solid...")
 
 
Line 6: Line 6:
 
|-
 
|-
 
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Slide 1:
 
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Slide 1:
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Welcome to the''' s'''poken tutorial on '''Robot Control using Bluetooth'''
+
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Welcome to the''' s'''poken tutorial on '''Robot Control using Bluetooth'''.
  
 
|-
 
|-
Line 15: Line 15:
  
 
* '''Bluetooth Communication'''
 
* '''Bluetooth Communication'''
* '''HC-05''' Bluetooth Module and
+
* '''HC-05 Bluetooth Module''' and
* Controlling a Robot using an Android application
+
* Controlling a '''Robot''' using an '''Android application'''
 
|-
 
|-
 
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Slide 3:
 
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Slide 3:
  
 
Pre-Requisites
 
Pre-Requisites
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| To follow this tutorial, you should have a basic knowledge of:
+
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| To follow this tutorial, you should have basic knowledge of:
  
 
* '''Electronics '''and
 
* '''Electronics '''and
Line 43: Line 43:
 
* '''HC-05 Bluetooth Module'''
 
* '''HC-05 Bluetooth Module'''
 
* '''L293D IC'''
 
* '''L293D IC'''
We have learnt about the '''L293D Motor Driver IC i'''n the earlier tutorial.
+
We have learnt about the '''L293D Motor Driver IC '''in the earlier tutorial.
  
 
* '''9V Battery with Connector'''
 
* '''9V Battery with Connector'''
Line 51: Line 51:
  
 
'''Bluetooth Communication'''
 
'''Bluetooth Communication'''
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| * Bluetooth communication is a '''wireless''' technology.
+
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"|  
* It is used to transfer data between different electronic devices.
+
* '''Bluetooth communication''' is a '''wireless technology'''.
* It supports data, audio transmission with a range of '''7 to 8 meters'''.
+
* It is used to transfer '''data''' between different '''electronic devices'''.
* It is specially designed for short range wireless data communication.<br/>
+
* It supports '''data, audio transmission ''' with a range of '''7 to 8 meters'''.
 +
* It is specially designed for '''short range wireless data communication'''.  
  
 
|-
 
|-
 
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Slide 7:
 
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Slide 7:
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| * In this tutorial we will use the '''HC-05 Bluetooth module.'''
+
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"|  
* This module has two operating modes, namely '''Data Mode''' and '''AT Command''' '''Mode'''.
+
* In this tutorial we will use the '''HC-05 Bluetooth module.'''
* In '''Data Mode''', it can send and receive data from other Bluetooth devices.
+
* This '''module''' has two operating modes, namely '''Data Mode''' and '''AT Command Mode'''.
 +
* In '''Data Mode''', it can send and receive '''data''' from other '''Bluetooth devices'''.
 
* We will be using the '''Data Mode''' in our tutorial.
 
* We will be using the '''Data Mode''' in our tutorial.
* '''AT Command '''mode is used when you want to change the setting of the bluetooth module.
+
* '''AT Command mode''' is used when you want to change the '''setting''' of the '''Bluetooth module'''.
* For example, to change the '''Baud Rate''' we can use '''AT Command '''Mode
+
* For example, to change the '''Baud Rate''' we can use '''AT Command Mode'''
  
 
|-
 
|-
 
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Slide 8:
 
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Slide 8:
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| This is the assembled Robot.
+
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| This is the assembled '''Robot'''.
  
We have already installed an app called '''car Bluetooth RC '''on '''Android''' phone.
+
We have already installed an '''app''' called '''Car Bluetooth RC '''on '''Android''' phone.
  
This app will control the movement of the Robot.
+
This '''app''' will control the movement of the '''Robot'''.
  
 
|-
 
|-
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"|  
+
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Show the actual connection images here for reference
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Now we will see how to control the Robot via Bluetooth.
+
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Now we will see how to control the '''Robot''' via '''Bluetooth'''.
  
Let us see the circuit connection in detail.  
+
Let us see the '''circuit connection''' in detail.  
  
Do the actual connection with your hardware as explained here.
+
Do the actual '''connection''' with your '''hardware''' as explained here.
  
 
|-
 
|-
Line 86: Line 88:
 
Circuit Connection
 
Circuit Connection
  
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Connect the Arduino board to your computer using Arduino USB cable'''.'''
+
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Connect the '''Arduino board''' to your computer using '''Arduino USB cable'''.
  
The '''5V''' pin of the '''Arduino''' is connected to the '''5V''' pin of the '''HC-05''' module.  
+
The '''5V''' pin of the '''Arduino''' is connected to the '''5V''' pin of the '''HC-05 module'''.  
  
The '''ground pin''' of the '''Arduino''' is connected to the '''ground pin''' of the '''HC-05''' '''module'''.  
+
The '''ground pin''' of the '''Arduino''' is connected to the '''ground pin''' of the '''HC-05 module'''.  
  
 
The '''Rx pin''' of the '''Bluetooth module''' is connected to the '''Tx pin''' of '''Arduino'''.  
 
The '''Rx pin''' of the '''Bluetooth module''' is connected to the '''Tx pin''' of '''Arduino'''.  
Line 96: Line 98:
 
The '''Tx pin''' of the '''Bluetooth module''' is connected to the '''Rx pin''' of '''Arduino'''.  
 
The '''Tx pin''' of the '''Bluetooth module''' is connected to the '''Rx pin''' of '''Arduino'''.  
  
Now, note the blinking of LED in the '''Bluetooth module.'''
+
Now, note the blinking of '''LED''' in the '''Bluetooth module.'''
  
This indicates that your '''Bluetooth module''' is switched on.
+
This indicates that your '''Bluetooth module''' is switched '''ON'''.
  
 
|-
 
|-
Line 108: Line 110:
 
'''Pin 16''' of '''L293D IC''' is connected to '''5V''' of '''Arduino'''.  
 
'''Pin 16''' of '''L293D IC''' is connected to '''5V''' of '''Arduino'''.  
  
'''Pins 4,5,12,13 of the L293D IC''' are connected to the '''ground''' terminal.  
+
'''Pins 4,5,12,13''' of the '''L293D IC''' are connected to the '''ground terminal'''.  
  
 
|-
 
|-
Line 114: Line 116:
  
 
Circuit Connection
 
Circuit Connection
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| * '''Pins 1,2,7 '''of''' L293D IC''' are connected to '''pins 6,3,5 of Arduino''' respectively.  
+
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| '''Pins 1,2,7 '''of''' L293D IC''' are connected to '''pins 6,3,5''' of '''Arduino''' respectively.  
  
'''Pins 9,10,15 of L293D IC''' are connected to '''pins 11,10,9 of Arduino''' respectively.
+
'''Pins 9,10,15''' of '''L293D IC''' are connected to '''pins 11,10,9''' of '''Arduino''' respectively.
  
 
|-
 
|-
Line 122: Line 124:
  
 
Circuit Connection
 
Circuit Connection
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| * '''One DC motor''' is connected to '''pin 3 and 6''' of '''L293D IC. '''
+
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| One '''DC motor''' is connected to '''pin 3''' and '''6''' of '''L293D IC. '''
The '''other DC motor''' is connected to '''pin''' '''11 and 14''' of '''L293D IC. '''
+
  
Note: You have to connect the''' DC motors''' of the assembled robot as shown in figure.
+
The other '''DC motor''' is connected to '''pin 11''' and '''14''' of '''L293D IC. '''
  
Recall that we have soldered a red and black wire to the wire leads of the motors.
+
Note: You have to connect the''' DC motors''' of the assembled '''Robot''' as shown in figure.
 +
 
 +
Recall that we have '''soldered''' a red and black '''wire''' to the '''wire leads''' of the '''motors'''.
  
 
|-
 
|-
Line 133: Line 136:
  
 
Circuit Connection
 
Circuit Connection
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| We require a separate power source for running the '''DC motors.'''
+
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| We require a separate '''power source''' for running the '''DC motors.'''
  
We will use a '''9V battery''' to power the '''DC motors''' as arduino gives only '''5V''' output.  
+
We will use a '''9V battery''' to power the '''DC motors''' as '''Arduino''' gives only '''5V''' output.  
  
'''Positive''' terminal of the '''9V battery''' is connected to '''pin 8''' of '''L293D IC. '''
+
'''Positive terminal''' of the '''9V battery''' is connected to '''pin 8''' of '''L293D IC. '''
  
The '''negative''' terminal of the battery is connected to the '''ground''' pin of the '''Arduino'''.  
+
The '''negative terminal''' of the battery is connected to the '''ground pin''' of the '''Arduino'''.  
  
 
These are all the connections you must do to perform the tasks shown in this tutorial.
 
These are all the connections you must do to perform the tasks shown in this tutorial.
Line 148: Line 151:
 
Live Setup of Robot
 
Live Setup of Robot
  
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| * Now place the breadboard and Arduino setup on the chassis.
+
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Now place the '''breadboard''' and '''Arduino setup''' on the '''chassis'''.
* This is how I have done the setup of my '''Robot'''.  
+
 
 +
This is how I have done the '''setup''' of my '''Robot'''.  
  
 
|-
 
|-
Line 158: Line 162:
  
 
Code Files:
 
Code Files:
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| * The files used in this tutorial are available in the '''Code Files '''link on this tutorial page.  
+
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"|  
 +
* The files used in this tutorial are available in the '''Code Files '''link on this tutorial page.  
 
* Please download and extract them  
 
* Please download and extract them  
 
* Make a copy and then use them while practising
 
* Make a copy and then use them while practising
Line 169: Line 174:
 
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| '''Highlight according to narration'''
 
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| '''Highlight according to narration'''
  
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Type the code as shown:
+
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Type the code as shown.
  
These are the variables assigned for the pins on the arduino connected to '''L293D IC. '''
+
These are the '''variables''' assigned for the '''pins''' on the '''Arduino''' connected to '''L293D IC. '''
  
The variable '''serialA''' is used to store the input character received by Bluetooth.
+
The '''variable serialA''' is used to store the '''input character''' received by '''Bluetooth'''.
  
 
|-
 
|-
 
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| '''void setup() '''
 
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| '''void setup() '''
  
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Type the code as shown in the '''void setup''' function.
+
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Type the code as shown in the '''void setup function'''.
  
'''Serial.begin''' function is used to make the Arduino ready to serially exchange messages.
+
'''Serial.begin function''' is used to make the '''Arduino''' ready to '''serially''' exchange messages.
  
 
The messages are exchanged at '''9600 baud rate.'''
 
The messages are exchanged at '''9600 baud rate.'''
  
We will use the function''' pinMode '''to configure the '''pins''' to '''OUTPUT '''mode.
+
We will use the '''function pinMode '''to configure the '''pins''' to '''OUTPUT mode'''.
  
 
|-
 
|-
Line 202: Line 207:
 
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Now we will write the code for the '''void loop.'''
 
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Now we will write the code for the '''void loop.'''
  
The''' void loop '''function will move the '''Robot '''in forward, backward, right and left directions.
+
The''' void loop function''' will move the '''Robot '''in forward, backward, right and left directions.
  
'''Bluetooth module''' checks for commands given from the Android app.
+
'''Bluetooth module''' checks for '''commands''' given from the '''Android app'''.
  
 
|-
 
|-
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"|  
+
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Highlight the code snippets as per the narration
  
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| These lines of code make the robot move in the forward direction.
+
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| These lines of code make the '''robot''' move in the forward direction.
  
These lines of code make the robot turn in the left direction.  
+
These lines of code make the '''robot''' turn in the left direction.  
  
These lines of code make the robot turn in the right direction.
+
These lines of code make the '''robot''' turn in the right direction.
  
These lines of code make the robot move in a backward direction.
+
These lines of code make the '''robot''' move in a backward direction.
  
Our program is ready now.
+
Our '''program''' is ready now.
  
 
|-
 
|-
 
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Click on compile and upload button on the toolbar
 
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Click on compile and upload button on the toolbar
  
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| '''Click''' on the''' compile''' button to verify your''' program'''.
+
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Click on the''' Compile''' button to verify your''' program'''.
  
 
After''' compiling''', a pop-up window will open to save the current program.
 
After''' compiling''', a pop-up window will open to save the current program.
Line 228: Line 233:
 
I will save it as '''Bluetooth_Robot.'''
 
I will save it as '''Bluetooth_Robot.'''
  
Click on the '''save''' button to save the''' '''program.
+
Click on the '''Save''' button to save the '''program'''.
  
 
|-
 
|-
 
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"|  
 
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"|  
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Before uploading the program, you must remove the '''Rx''' and '''Tx''' wires connected to '''Arduino'''.
 
  
Now click on the '''upload''' button to upload the current program on''' Arduino'''.
 
  
When you have successfully uploaded the program, '''reconnect'''
+
Show the circuit diagram and point to the 2 wires with arrows
  
the '''Rx''' and '''Tx''' wires to the '''Arduino'''.  
+
 
 +
 
 +
 
 +
 
 +
 
 +
Show the circuit diagram and point to the 2 wires with arrows
 +
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Before uploading the '''program''', you must remove the '''Rx''' and '''Tx wires''' connected to '''Arduino'''.
 +
 
 +
Now click on the '''Upload''' button to upload the current '''program''' on''' Arduino'''.
 +
 
 +
When you have successfully uploaded the '''program''' reconnect the '''Rx''' and '''Tx wires''' to the '''Arduino'''.  
  
 
|-
 
|-
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"|  
+
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Show USB cable image
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Now, remove the arduino’s USB cable from your computer.
+
 
 +
 
 +
9V-1A adapter image
 +
 
 +
 
 +
Arduino jack image
 +
 
 +
 
 +
Battery image
 +
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Now, remove the '''Arduino’s USB cable''' from your computer.
  
 
For demonstration purpose, I have connected a '''9V-1A adapter''' to run the '''Robot'''.  
 
For demonstration purpose, I have connected a '''9V-1A adapter''' to run the '''Robot'''.  
  
It is connected at the Arduino jack available here.  
+
It is connected at the '''Arduino jack''' available here.  
  
You can use a power bank or a battery instead, to power the Arduino.
+
You can use a '''power bank''' or a battery instead, to power the '''Arduino'''.
  
 
|-
 
|-
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"|  
+
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Show the image of the interface of Android phone
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Next, we will use the app and test the working of the Robot.
+
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Next, we will use the '''app''' and test the working of the '''Robot'''.
  
Take the Android phone in which you have downloaded the '''Car Bluetooth RC app. '''
+
Take the '''Android''' phone in which you have downloaded the '''Car Bluetooth RC app. '''
  
 
|-
 
|-
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"|  
+
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Settings >> Bluetooth >> Turn ON >> Search for nearby devices >> HC-05 option >> Password = 1234
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Let us configure the '''Bluetooth''' in your Android phone.
+
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Let us configure the '''Bluetooth''' in your '''Android''' phone.
  
Go to the '''settings''' option on your phone.
+
Go to the '''Settings''' option on your phone.
  
 
Open the '''Bluetooth '''section.
 
Open the '''Bluetooth '''section.
  
'''Turn ON''' your phone’s Bluetooth.
+
'''Turn ON''' your phone’s '''Bluetooth'''.
  
Search for nearby devices.
+
Search for nearby '''devices'''.
  
 
You will find '''HC-05''' as one of the options in the list.
 
You will find '''HC-05''' as one of the options in the list.
  
Click on the''' HC-05''' option. It will ask for a password.
+
Click on the''' HC-05''' option. It will ask for a '''password'''.
  
The '''default password''' for this bluetooth module is '''1234'''. Type the password.
+
The '''default password''' for this '''Bluetooth module''' is '''1234'''. Type the '''password'''.
  
In some cases, the password of the bluetooth module will be '''0000.'''
+
In some cases, the '''password''' of the '''Bluetooth module''' will be '''0000.'''
  
Now, your mobile is connected to the '''HC-05 Bluetooth''' module.
+
|-
 +
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Show connected message on phone
  
You can now observe a different blinking pattern of the LED in the Bluetooth module.
+
Image of the connected circuit
  
Turn OFF your phone’s Bluetooth.
+
 
 +
Turn OFF Bluetooth on the phone
 +
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Now, your mobile is connected to the '''HC-05 Bluetooth module'''.
 +
 
 +
You can now observe a different blinking pattern of the '''LED''' in the '''Bluetooth module'''.
 +
 
 +
Turn '''OFF''' your phone’s '''Bluetooth'''.
  
 
|-
 
|-
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"|  
+
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Open the '''Car Bluetooth RC app''' in phone  >> Prompt to turn ON phone's Bluetooth >> Allow to continue >> Top-left --> click on arrow >> Find device >> connected message appears
 
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Now, open the '''Car Bluetooth RC app''' in your phone.
 
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Now, open the '''Car Bluetooth RC app''' in your phone.
  
The app will prompt to turn ON your phone’s Bluetooth.
+
The app will prompt to turn '''ON''' your phone’s '''Bluetooth'''.
  
 
Click on '''Allow to Continue.'''
 
Click on '''Allow to Continue.'''
Line 298: Line 327:
 
It indicates that your phone is now connected to the '''HC-05 Bluetooth Module.'''
 
It indicates that your phone is now connected to the '''HC-05 Bluetooth Module.'''
  
Now, it is ready to control the Robot.
+
Now, it is ready to control the '''Robot'''.
  
 
|-
 
|-
 
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"|  
 
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"|  
 +
 +
 +
Press Forward button
 +
 +
 +
Press Backward button
 +
 +
 
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Let us observe the working of the '''Robot'''.
 
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Let us observe the working of the '''Robot'''.
  
Line 310: Line 347:
 
|-
 
|-
 
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"|  
 
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"|  
 +
 +
Press Right button
 +
 +
 +
 
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| To turn the '''Robot''' towards the right hand side, press the right button in the app.
 
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| To turn the '''Robot''' towards the right hand side, press the right button in the app.
  
 
The right side motor stops rotating and the left side motor continues to rotate.  
 
The right side motor stops rotating and the left side motor continues to rotate.  
  
This way the Robot turns to the right side.
+
This way the '''Robot''' turns to the right side.
  
 
|-
 
|-
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"|  
+
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Press Left button
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Likewise, the Robot will move to the left direction when you press the left button.  
+
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| Likewise, the '''Robot''' will move to the left direction when you press the left button.  
  
Thus, we can control the movement of the Robot using bluetooth communication.
+
Thus, we can control the movement of the '''Robot''' using b'''Bluetooth communication'''.
  
 
|-
 
|-
Line 332: Line 374:
 
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| In this tutorial, we learnt:
 
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| In this tutorial, we learnt:
  
* Bluetooth Communication
+
* '''Bluetooth Communication'''
* HC-05 Bluetooth Module
+
* '''HC-05 Bluetooth Module'''
* Controlling a Robot using an Android application
+
* Controlling a '''Robot''' using an '''Android application'''
  
 
|-
 
|-
Line 349: Line 391:
  
 
Spoken Tutorial workshops
 
Spoken Tutorial workshops
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| The''' Spoken Tutorial Project''' Team:
+
| style="border-top:none;border-bottom:0.75pt solid #000000;border-left:0.75pt solid #000000;border-right:0.75pt solid #000000;padding:0.176cm;"| The''' Spoken Tutorial Project''' Tea conducts workshops and gives certificates.
 
+
* conducts workshops and
+
* gives certificates.
+
  
 
For more details, please write to us.
 
For more details, please write to us.

Latest revision as of 17:12, 5 October 2020

Visual Cue Narration
Slide 1: Welcome to the spoken tutorial on Robot Control using Bluetooth.
Slide 2:

Learning Objectives

In this tutorial, we will learn about:
  • Bluetooth Communication
  • HC-05 Bluetooth Module and
  • Controlling a Robot using an Android application
Slide 3:

Pre-Requisites

To follow this tutorial, you should have basic knowledge of:
  • Electronics and
  • C or C++ programming language
Slide 4:

System Requirements

To record this tutorial, I am using:
  • Ubuntu Linux 16.04 OS
  • Arduino UNO board
  • Arduino IDE and
  • Android Phone
Slide 5:

External Components

We require few external components:
  • HC-05 Bluetooth Module
  • L293D IC

We have learnt about the L293D Motor Driver IC in the earlier tutorial.

  • 9V Battery with Connector
  • 9Volts-1Ampere Adapter
Slide 6:

Bluetooth Communication

  • Bluetooth communication is a wireless technology.
  • It is used to transfer data between different electronic devices.
  • It supports data, audio transmission with a range of 7 to 8 meters.
  • It is specially designed for short range wireless data communication.
Slide 7:
  • In this tutorial we will use the HC-05 Bluetooth module.
  • This module has two operating modes, namely Data Mode and AT Command Mode.
  • In Data Mode, it can send and receive data from other Bluetooth devices.
  • We will be using the Data Mode in our tutorial.
  • AT Command mode is used when you want to change the setting of the Bluetooth module.
  • For example, to change the Baud Rate we can use AT Command Mode
Slide 8: This is the assembled Robot.

We have already installed an app called Car Bluetooth RC on Android phone.

This app will control the movement of the Robot.

Show the actual connection images here for reference Now we will see how to control the Robot via Bluetooth.

Let us see the circuit connection in detail.

Do the actual connection with your hardware as explained here.

Slide 9:

Circuit Connection

Connect the Arduino board to your computer using Arduino USB cable.

The 5V pin of the Arduino is connected to the 5V pin of the HC-05 module.

The ground pin of the Arduino is connected to the ground pin of the HC-05 module.

The Rx pin of the Bluetooth module is connected to the Tx pin of Arduino.

The Tx pin of the Bluetooth module is connected to the Rx pin of Arduino.

Now, note the blinking of LED in the Bluetooth module.

This indicates that your Bluetooth module is switched ON.

Slide 10:

Circuit Connection

Next do the below connections as explained.

Pin 16 of L293D IC is connected to 5V of Arduino.

Pins 4,5,12,13 of the L293D IC are connected to the ground terminal.

Slide 11:

Circuit Connection

Pins 1,2,7 of L293D IC are connected to pins 6,3,5 of Arduino respectively.

Pins 9,10,15 of L293D IC are connected to pins 11,10,9 of Arduino respectively.

Slide 12:

Circuit Connection

One DC motor is connected to pin 3 and 6 of L293D IC.

The other DC motor is connected to pin 11 and 14 of L293D IC.

Note: You have to connect the DC motors of the assembled Robot as shown in figure.

Recall that we have soldered a red and black wire to the wire leads of the motors.

Slide 13:

Circuit Connection

We require a separate power source for running the DC motors.

We will use a 9V battery to power the DC motors as Arduino gives only 5V output.

Positive terminal of the 9V battery is connected to pin 8 of L293D IC.

The negative terminal of the battery is connected to the ground pin of the Arduino.

These are all the connections you must do to perform the tasks shown in this tutorial.

Slide 14:

Live Setup of Robot

Now place the breadboard and Arduino setup on the chassis.

This is how I have done the setup of my Robot.

Switch to Arduino IDE Now we will write the program in Arduino IDE for the working of the Robot.
Slide:

Code Files:

  • The files used in this tutorial are available in the Code Files link on this tutorial page.
  • Please download and extract them
  • Make a copy and then use them while practising
Open the Arduino IDE.
Highlight according to narration Type the code as shown.

These are the variables assigned for the pins on the Arduino connected to L293D IC.

The variable serialA is used to store the input character received by Bluetooth.

void setup() Type the code as shown in the void setup function.

Serial.begin function is used to make the Arduino ready to serially exchange messages.

The messages are exchanged at 9600 baud rate.

We will use the function pinMode to configure the pins to OUTPUT mode.

void loop()

{

if (Serial.available() > 0)

{

serialA = Serial.read();Serial.println(serialA);

}

switch (serialA)

Now we will write the code for the void loop.

The void loop function will move the Robot in forward, backward, right and left directions.

Bluetooth module checks for commands given from the Android app.

Highlight the code snippets as per the narration These lines of code make the robot move in the forward direction.

These lines of code make the robot turn in the left direction.

These lines of code make the robot turn in the right direction.

These lines of code make the robot move in a backward direction.

Our program is ready now.

Click on compile and upload button on the toolbar Click on the Compile button to verify your program.

After compiling, a pop-up window will open to save the current program.

I will save it as Bluetooth_Robot.

Click on the Save button to save the program.


Show the circuit diagram and point to the 2 wires with arrows




Show the circuit diagram and point to the 2 wires with arrows

Before uploading the program, you must remove the Rx and Tx wires connected to Arduino.

Now click on the Upload button to upload the current program on Arduino.

When you have successfully uploaded the program reconnect the Rx and Tx wires to the Arduino.

Show USB cable image


9V-1A adapter image


Arduino jack image


Battery image

Now, remove the Arduino’s USB cable from your computer.

For demonstration purpose, I have connected a 9V-1A adapter to run the Robot.

It is connected at the Arduino jack available here.

You can use a power bank or a battery instead, to power the Arduino.

Show the image of the interface of Android phone Next, we will use the app and test the working of the Robot.

Take the Android phone in which you have downloaded the Car Bluetooth RC app.

Settings >> Bluetooth >> Turn ON >> Search for nearby devices >> HC-05 option >> Password = 1234 Let us configure the Bluetooth in your Android phone.

Go to the Settings option on your phone.

Open the Bluetooth section.

Turn ON your phone’s Bluetooth.

Search for nearby devices.

You will find HC-05 as one of the options in the list.

Click on the HC-05 option. It will ask for a password.

The default password for this Bluetooth module is 1234. Type the password.

In some cases, the password of the Bluetooth module will be 0000.

Show connected message on phone

Image of the connected circuit


Turn OFF Bluetooth on the phone

Now, your mobile is connected to the HC-05 Bluetooth module.

You can now observe a different blinking pattern of the LED in the Bluetooth module.

Turn OFF your phone’s Bluetooth.

Open the Car Bluetooth RC app in phone >> Prompt to turn ON phone's Bluetooth >> Allow to continue >> Top-left --> click on arrow >> Find device >> connected message appears Now, open the Car Bluetooth RC app in your phone.

The app will prompt to turn ON your phone’s Bluetooth.

Click on Allow to Continue.

On the top left corner of your phone, click on the arrow.

Find the HC-05 option and click on it.

You can see a message as Connected-OK.

It indicates that your phone is now connected to the HC-05 Bluetooth Module.

Now, it is ready to control the Robot.


Press Forward button


Press Backward button


Let us observe the working of the Robot.

When I press the forward button in the app, we can see the Robot moves in the forward direction.

When I press the backward button, the Robot moves in the backward direction.

Press Right button


To turn the Robot towards the right hand side, press the right button in the app.

The right side motor stops rotating and the left side motor continues to rotate.

This way the Robot turns to the right side.

Press Left button Likewise, the Robot will move to the left direction when you press the left button.

Thus, we can control the movement of the Robot using bBluetooth communication.

This brings us to the end of this tutorial. Let us summarize.
Slide 15:

Summary

In this tutorial, we learnt:
  • Bluetooth Communication
  • HC-05 Bluetooth Module
  • Controlling a Robot using an Android application
Slide 16:

About Spoken Tutorial project

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

Please download and watch it.

Slide 17:

Spoken Tutorial workshops

The Spoken Tutorial Project Tea conducts workshops and gives certificates.

For more details, please write to us.

Slide 18:

Forum for specific questions

Please post your timed queries in this forum.
Slide 19:

Acknowledgement

The Spoken Tutorial project is funded by MHRD, Government of India.
This tutorial has been contributed by FOSSEE and Spoken Tutorial Project, IIT Bombay.

And this is Saurabh signing off.

Thanks for watching.

Contributors and Content Editors

Nancyvarkey, Nirmala Venkat