Difference between revisions of "Arduino/C2/Wireless-Connectivity-to-Arduino/English"

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with " {| style="border-spacing:0;" | style="background-color:#d9d2e9;border:1.5pt solid #000000;padding:0.176cm;"| '''Visual Cue''' | style="background-color:#d9d2e9;border:1.5pt s...")
 
 
Line 66: Line 66:
  
 
About ESP8266 - 01 Module
 
About ESP8266 - 01 Module
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| * This WiFi module has a built-in '''System on Chip''' with integrated '''TCP/IP stack.'''
+
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"|  
* It has a UART and '''2 GPIO pins''' '''(General Purpose Input / Output)'''.
+
* This WiFi module has a built-in '''System on Chip''' with integrated '''TCP/IP stack.'''
* It is widely used for development of '''IoT (i.e. Internet of Things)''' applications.
+
* It has a UART and '''2 GPIO pins (General Purpose Input / Output)'''.
 +
* It is widely used for development of '''IoT (i.e. Internet of Things) applications.'''
  
 
|-
 
|-
Line 74: Line 75:
  
 
Image '''ESP Connection.png'''
 
Image '''ESP Connection.png'''
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| This is the circuit connection of '''ESP8266 - 01 '''module with Arduino.
+
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| This is the circuit connection of '''ESP8266 - 01 module''' with '''Arduino'''.
  
 
Note:  
 
Note:  
  
The ESP8266-01 module works on 3.3V only.
+
The '''ESP8266-01 module''' works on '''3.3V''' only.
  
Connecting it to '''5V''' may '''damage''' the''' Wi-Fi''' module.
+
Connecting it to '''5V''' may '''damage''' the''' Wi-Fi module'''.
  
* Connect '''ground '''pin of''' Wi-Fi''' module to '''ground''' pin of '''Arduino'''.
+
* Connect '''ground '''pin of''' Wi-Fi module''' to '''ground''' pin of '''Arduino'''.
* Connect '''GPIO 0''' pin of '''Wi-Fi''' module to '''ground''' of Arduino.
+
* Connect '''GPIO 0''' pin of '''Wi-Fi module''' to '''ground''' of Arduino.
  
* Connect '''Rx''' pin of '''Wi-Fi''' module to '''Rx''' pin of '''Arduino'''.
+
* Connect '''Rx''' pin of '''Wi-Fi module''' to '''Rx''' pin of '''Arduino'''.
* Connect '''Tx''' pin of''' Wi-Fi '''module to '''Tx''' pin of '''Arduino'''.
+
* Connect '''Tx''' pin of''' Wi-Fi module''' to '''Tx''' pin of '''Arduino'''.
* Connect '''VCC''' and '''CH_PD '''pin of '''Wi-Fi''' module to '''3.3V '''of '''Arduino'''.
+
* Connect '''VCC''' and '''CH_PD '''pin of '''Wi-Fi module''' to '''3.3V '''of '''Arduino'''.
* Connect a''' push button''' between '''RST''' pin''' '''of''' Wi-Fi '''module and '''ground pin '''of arduino.
+
* Connect a''' push button''' between '''RST''' pin of''' Wi-Fi module''' and '''ground''' pin of '''Arduino'''.
  
 
|-
 
|-
Line 100: Line 101:
 
Do the connection as shown here.
 
Do the connection as shown here.
  
We will establish a connection between WiFi module and a laptop or a mobile phone.
+
We will establish a connection between '''WiFi module''' and a '''laptop''' or a '''mobile phone'''.
  
 
|-
 
|-
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Open Arduino IDE
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Open Arduino IDE
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Now we will write a program in '''Arduino IDE.'''
+
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Now we will write a '''program''' in '''Arduino IDE.'''
  
 
Open '''Arduino IDE'''.
 
Open '''Arduino IDE'''.
Line 110: Line 111:
 
|-
 
|-
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Narration
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Narration
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Connect your Arduino board to your PC.
+
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Connect your '''Arduino board''' to your PC.
  
 
|-
 
|-
Line 117: Line 118:
 
Tools => Port.
 
Tools => Port.
  
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| First, we need to know the name of the port to which arduino is connected.
+
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| First, we need to know the name of the '''port''' to which '''Arduino''' is connected.
  
Go to the '''Tools''' menu. Select '''port''' option.
+
Go to the '''Tools''' menu. Select '''Port''' option.
  
In my case, the port is '''ttyUSB0. '''Note down your port name.
+
In my case, the '''port''' is '''ttyUSB0. '''Note down your '''port''' name.
  
Windows users can skip the steps below as the port is detected automatically.
+
'''Windows''' users can skip the steps below as the '''port''' is detected automatically.
  
 
|-
 
|-
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Type, '''sudo chmod a+rw /dev/ttyUSB0'''
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Type, '''sudo chmod a+rw /dev/ttyUSB0'''
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Open the terminal by pressing '''Ctrl+Alt+t''' keys simultaneously.
+
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Open the '''terminal''' by pressing '''Ctrl+Alt+t''' keys simultaneously.
  
 
Type, '''sudo space chmod space a+rw space slash dev slash ttyUSB0 '''
 
Type, '''sudo space chmod space a+rw space slash dev slash ttyUSB0 '''
  
In my case, the port name is '''ttyUSB0'''  
+
In my case, the '''port''' name is '''ttyUSB0'''  
  
You have to specify your port name.
+
You have to specify your '''port''' name.
  
 
Press '''Enter'''.
 
Press '''Enter'''.
  
Enter your password for the system and press '''Enter'''.
+
Enter your '''password''' for the '''system''' and press '''Enter'''.
  
The above command gives read-write permission to the '''usb port.'''
+
The above '''command''' gives '''read-write permission''' to the '''usb port.'''
  
 
|-
 
|-
Line 147: Line 148:
 
|-
 
|-
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"|  
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"|  
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Next we will configure the '''ESP8266''' module to communicate.
+
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Next we will configure the '''ESP8266 module''' to communicate.
  
 
|-
 
|-
Line 160: Line 161:
 
In the '''Settings''' tab, go to the '''Additional Boards Manager URLs '''section.
 
In the '''Settings''' tab, go to the '''Additional Boards Manager URLs '''section.
  
Add this '''json''' '''URL'''.
+
Add this '''json URL'''.
  
 
This will help to download '''ESP8266 WiFi module '''in''' Arduino IDE.'''
 
This will help to download '''ESP8266 WiFi module '''in''' Arduino IDE.'''
Line 175: Line 176:
 
A new window will appear.
 
A new window will appear.
  
In the top right corner, we can see a '''search tab'''.
+
In the top right corner, we can see a '''search''' tab.
  
Here, type '''ESP8266''' and press enter.
+
Here, type '''ESP8266''' and press '''Enter'''.
  
 
|-
 
|-
Line 187: Line 188:
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Select '''ESP8266 by ESP8266 Community'''.
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Select '''ESP8266 by ESP8266 Community'''.
  
In the version drop down box, select the '''latest version '''of the module.
+
In the version drop down box, select the latest version of the '''module'''.
  
Click on '''install''' button to install the module.  
+
Click on '''Install''' button to install the '''module'''.  
  
 
Installation will take few minutes to complete.  
 
Installation will take few minutes to complete.  
Line 199: Line 200:
  
 
Click on the Close button
 
Click on the Close button
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| The '''ESP8266''' module is now installed in the '''Arduino IDE'''.
+
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| The '''ESP8266 module''' is now installed in the '''Arduino IDE'''.
  
 
Click on the '''Close''' button at the right bottom of the window.
 
Click on the '''Close''' button at the right bottom of the window.
Line 208: Line 209:
 
Select ESP8266 module to upload the program.
 
Select ESP8266 module to upload the program.
  
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Now, before uploading the program we have to select the '''ESP8266''' module.
+
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Now, before uploading the '''program''' we have to select the '''ESP8266 module'''.
  
Click on the '''Tools''' option and select '''board'''.
+
Click on the '''Tools''' option and select '''Board'''.
  
 
Scroll down and select '''Generic ESP8266 Module'''.
 
Scroll down and select '''Generic ESP8266 Module'''.
Line 217: Line 218:
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Tools => Builtin LED = 1.
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Tools => Builtin LED = 1.
  
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Next we need to set the built in LED of '''ESP8266 Module'''.
+
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Next we need to set the '''built-in LED''' of '''ESP8266 Module'''.
  
 
Again select '''Tools'''.
 
Again select '''Tools'''.
  
Go to '''Builtin LED '''option. Set the''' Builtin LED''' to '''1'''.
+
Go to '''Builtin LED '''option. '''Set''' the''' Builtin LED''' to '''1'''.
  
 
|-
 
|-
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Tools => Reset Method = no dtr (aka ck).
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Tools => Reset Method = no dtr (aka ck).
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Next we will set the '''Reset''' option.  
+
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Next we will '''set''' the '''Reset''' option.  
  
 
In the menu bar, select '''Tools'''. Go to '''Reset Method'''.
 
In the menu bar, select '''Tools'''. Go to '''Reset Method'''.
Line 231: Line 232:
 
Select '''Reset''' method to '''no dtr (aka ck).'''
 
Select '''Reset''' method to '''no dtr (aka ck).'''
  
This will help to reset the wifi module manually.
+
This will help to reset the '''wifi module''' manually.
  
 
|-
 
|-
Line 245: Line 246:
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| const char* ssid = "WIFI_ESP8266_Pratik";
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| const char* ssid = "WIFI_ESP8266_Pratik";
  
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| '''SSID''' is the '''name''' of a Wi-Fi module.
+
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| '''SSID''' is the '''name''' of a '''Wi-Fi module'''.
  
Here, I have named the wifi network as '''WIFI_ESP8266_Pratik.'''
+
Here, I have named the '''wifi network''' as '''WIFI_ESP8266_Pratik.'''
  
 
|-
 
|-
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| const char* password = "12345678";
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| const char* password = "12345678";
  
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Password is the '''passcode '''to join the Wi-Fi network.
+
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| '''Password''' is the '''passcode '''to join the '''Wi-Fi network'''.
  
And the password for the module is '''12345678'''.
+
And the '''password''' for the '''module''' is '''12345678'''.
  
You have to give your unique ssid and password.
+
You have to give your unique '''ssid''' and '''password'''.
  
Password parameter is not mandatory.
+
'''Password parameter''' is not mandatory.
  
If you don’t give password parameter, Wi-Fi network will be open.
+
If you don’t give '''password parameter, Wi-Fi network''' will be open.
  
 
It will be accessible to everyone nearby.  
 
It will be accessible to everyone nearby.  
Line 266: Line 267:
 
|-
 
|-
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| WiFiServer server(80);
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| WiFiServer server(80);
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| This command will enable the default IP Address of the module.
+
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| This '''command''' will enable the default '''IP address''' of the '''module'''.
  
The default IP Address of the module is 192.168.4.1
+
The default '''IP address''' of the '''module''' is '''192.168.4.1'''
  
 
|-
 
|-
Line 283: Line 284:
 
delay(2000);
 
delay(2000);
  
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Inside the setup function, write the code as shown.
+
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Inside the '''setup function''', write the code as shown.
  
This command will enable the SSID and Password for the ESP8266 module.
+
This '''command''' will enable the '''SSID''' and '''Password''' for the '''ESP8266 module'''.
  
server.begin will enable the Wi-Fi network for the given '''SSID''' and '''Password'''.
+
'''server.begin''' will enable the '''Wi-Fi network''' for the given '''SSID''' and '''Password'''.
  
A delay of 2 seconds is given to boot the module.
+
A '''delay''' of 2 seconds is given to '''boot''' the '''module'''.
  
 
|-
 
|-
Line 300: Line 301:
 
}
 
}
  
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Built-In LED of the '''ESP8266''' module is set to '''OUTPUT''' mode.
+
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| '''Built-in LED''' of the '''ESP8266 module''' is '''set''' to '''OUTPUT mode'''.
  
 
|-
 
|-
Line 319: Line 320:
 
}
 
}
  
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Copy and paste the code inside void loop function.
+
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Copy and paste the code inside '''void loop function'''.
  
This code is available in the Code files link of this tutorial
+
This code is available in the '''Code files''' link of this tutorial
  
 
You can download and use it.  
 
You can download and use it.  
Line 376: Line 377:
  
 
Image '''HTML_Page.png'''
 
Image '''HTML_Page.png'''
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| This HTML code will generate a web page as shown here.(image to be shown)
+
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| This '''HTML code''' will generate a '''web page''' as shown here.(image to be shown)
  
When LED ON or LED OFF button is pressed, the value is passed to the program.
+
When '''LED ON''' or '''LED OFF''' button is pressed, the value is passed to the '''program'''.
  
The program checks the value and controls the built-in LED of the ESP8266-01 module.
+
The '''program''' checks the value and controls the '''built-in LED''' of the '''ESP8266-01 module'''.
  
 
|-
 
|-
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Click on the compile button on the toolbar
+
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Click on the '''compile''' button on the toolbar.
  
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| '''Click''' on the''' compile''' button to verify the''' program.'''
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| '''Click''' on the''' compile''' button to verify the''' program.'''
  
A pop up window will appear to save the current program
+
A pop up window will appear to save the current '''program'''.
  
Name the program as '''WiFi'''_'''ESP8266 '''and click on the save button to save the program.
+
Name the '''program''' as '''WiFi'''_'''ESP8266.'''
 +
 
 +
And click on the '''save''' button to save the '''program'''.
  
 
|-
 
|-
Line 397: Line 400:
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Now click on '''upload''' button to upload the current '''program''' on''' ESP8266-01.'''
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Now click on '''upload''' button to upload the current '''program''' on''' ESP8266-01.'''
  
We can see the program getting uploaded at the bottom of the screen.
+
We can see the '''program''' getting uploaded at the bottom of the screen.
  
When the state changes to '''connecting,''' press the '''push button''' on the breadboard.
+
When the state changes to '''Connecting,''' press the '''push button''' on the '''breadboard'''.
  
 
Release it after 2 to 3 seconds.
 
Release it after 2 to 3 seconds.
 
|-
 
|-
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"|  
+
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Point to the message
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| We will see a message as '''Leaving…. Soft resetting''' as shown here.
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| We will see a message as '''Leaving…. Soft resetting''' as shown here.
  
This indicates that the program is uploaded successfully.  
+
This indicates that the '''program''' is uploaded successfully.  
  
 
|-
 
|-
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| WiFi => Search for available network nearby => Select your WiFi module => enter password => join the network.
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| WiFi => Search for available network nearby => Select your WiFi module => enter password => join the network.
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Switch off your mobile internet.
+
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Switch off your '''mobile internet'''.
  
Open '''Wi-Fi option''' of your mobile phone.
+
Open '''Wi-Fi option''' of your '''mobile phone'''.
  
Search for nearest network to connect.
+
Search for nearest '''network''' to connect.
  
 
In my case, I am getting '''WIFI_ESP8266_Pratik''' since I have given this name in the code.
 
In my case, I am getting '''WIFI_ESP8266_Pratik''' since I have given this name in the code.
  
Select the WiFi.
+
Select the '''WiFi'''.
  
Enter the password and check if it is connected to WiFi.
+
Enter the '''password''' and check if it is connected to '''WiFi'''.
  
 
|-
 
|-
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Go to Web Browser => enter the IP address i.e. 192.168.4.1
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Go to Web Browser => enter the IP address i.e. 192.168.4.1
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Open Web Browser in your mobile phone.
+
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| Open '''Web Browser''' in your '''mobile phone'''.
  
Enter the IP address '''192.168.4.1'''
+
Enter the '''IP address 192.168.4.1'''
  
This is the '''default IP Address '''of '''ESP8266-01 Wi-Fi '''module by the manufacturer.
+
This is the '''default IP address '''of '''ESP8266-01 Wi-Fi module''' by the manufacturer.
  
 
|-
 
|-
Line 439: Line 442:
 
Image '''Module_ON.jpg'''
 
Image '''Module_ON.jpg'''
  
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| The web page opens as per the HTML code.
+
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| The '''web page''' opens as per the '''HTML code'''.
  
We can see, the '''LED''' of '''ESP8266-01''' module is '''OFF'''.
+
We can see the '''LED''' of '''ESP8266-01 module''' is '''OFF'''.
  
Click on''' LED ON''' button which will turn on the '''blue LED''' of the Wi-Fi module.
+
Click on''' LED ON''' button which will turn on the blue '''LED''' of the '''Wi-Fi module.'''
  
 
It will be '''ON''' until we press the '''LED OFF''' button.
 
It will be '''ON''' until we press the '''LED OFF''' button.
  
Click on''' LED OFF''' button which will turn off the '''blue LED''' of the Wi-Fi module.
+
Click on''' LED OFF''' button which will turn off the blue '''LED''' of the '''Wi-Fi module'''.
  
 
|-
 
|-
Line 459: Line 462:
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| In this tutorial, we learnt to
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| In this tutorial, we learnt to
  
* Configure and upload code on '''ESP8266-01''' module
+
* Configure and upload code on '''ESP8266-01 module'''
* Establish Wireless Communication between '''ESP''' and other devices
+
* Establish '''wireless''' communication between '''ESP''' and other devices
  
 
|-
 
|-
Line 468: Line 471:
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| As an '''assignment''':
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| As an '''assignment''':
  
# Check if your PC or laptop has wireless connectivity and do the steps below.
+
# Check if your PC or laptop has '''wireless connectivity''' and do the steps below.
 
# On the top right corner, click on '''WiFi''' icon.
 
# On the top right corner, click on '''WiFi''' icon.
# Select the name of your WiFi and enter the password.
+
# Select the name of your '''WiFi''' and enter the '''password'''.
# Open the browser and go to 192.168.4.1  
+
# Open the '''browser''' and go to '''192.168.4.1'''
# Select the button and see the output on the '''ESP8266-01 '''module.
+
# Select the button and see the output on the '''ESP8266-01 module'''.
  
 
|-
 
|-
Line 482: Line 485:
  
 
About Spoken Tutorial Project
 
About Spoken Tutorial Project
 
*
 
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| The video at the following '''link''' summarizes the '''Spoken Tutorial Project'''
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| The video at the following '''link''' summarizes the '''Spoken Tutorial Project'''
  
Line 493: Line 494:
 
Spoken-Tutorial Workshop
 
Spoken-Tutorial Workshop
  
*
+
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| The '''Spoken Tutorial Project''' Team conducts '''Workshops''' & gives Certificates.
 
+
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| The '''Spoken Tutorial Project''' Team:
+
 
+
* Conducts '''Workshops''' &
+
* Gives Certificates
+
  
 
|-
 
|-
Line 517: Line 513:
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| This tutorial has been contributed by FOSSEE and Spoken Tutorial Project, IIT Bombay.  
 
| style="border-top:none;border-bottom:1.5pt solid #000000;border-left:1.5pt solid #000000;border-right:1.5pt solid #000000;padding:0.176cm;"| This tutorial has been contributed by FOSSEE and Spoken Tutorial Project, IIT Bombay.  
  
And this is saurabh signing off.  
+
And this is Saurabh signing off.  
  
 
Thanks for joining.
 
Thanks for joining.
  
 
|}
 
|}

Latest revision as of 17:13, 8 January 2020

Visual Cue Narration
Slide 1: Welcome to the Spoken Tutorial on Wireless Connectivity to Arduino
Slide 2:

Learning objectives

In this tutorial, we will learn to:
  • Configure and upload code on ESP8266-01 module
  • Establish Wireless Communication between ESP and other devices
Slide 3:

Pre-requisites

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

System Requirement

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

External Components Required

We will require a few external components such as
  • ESP8266-01 Wi-Fi module
  • Breadboard
  • Jumper Wires and
  • Push Button
Slide 6:

Image ESP8266-01 module.jpg

In this tutorial we will use ESP8266-01 WiFi module.

VCC, RST, CH_PD, Tx, Ground, GPIO2, GPIO0, Rx are the pins of the Wi-Fi module.

Power LED indicates whether the module is ON or OFF.

COMM LED is the built-in blue LED of the WiFi module.

In this tutorial, we will see how to control this built-in LED using WiFi.

Slide 7:

About ESP8266 - 01 Module

  • This WiFi module has a built-in System on Chip with integrated TCP/IP stack.
  • It has a UART and 2 GPIO pins (General Purpose Input / Output).
  • It is widely used for development of IoT (i.e. Internet of Things) applications.
Slide 8:

Image ESP Connection.png

This is the circuit connection of ESP8266 - 01 module with Arduino.

Note:

The ESP8266-01 module works on 3.3V only.

Connecting it to 5V may damage the Wi-Fi module.

  • Connect ground pin of Wi-Fi module to ground pin of Arduino.
  • Connect GPIO 0 pin of Wi-Fi module to ground of Arduino.
  • Connect Rx pin of Wi-Fi module to Rx pin of Arduino.
  • Connect Tx pin of Wi-Fi module to Tx pin of Arduino.
  • Connect VCC and CH_PD pin of Wi-Fi module to 3.3V of Arduino.
  • Connect a push button between RST pin of Wi-Fi module and ground pin of Arduino.
Slide 9:

Live Setup

Image Setup Connection.jpg

This is the live setup of the connection, as shown in the circuit diagram.

Do the connection as shown here.

We will establish a connection between WiFi module and a laptop or a mobile phone.

Open Arduino IDE Now we will write a program in Arduino IDE.

Open Arduino IDE.

Narration Connect your Arduino board to your PC.
Go to the Tools menu. Select port option.

Tools => Port.

First, we need to know the name of the port to which Arduino is connected.

Go to the Tools menu. Select Port option.

In my case, the port is ttyUSB0. Note down your port name.

Windows users can skip the steps below as the port is detected automatically.

Type, sudo chmod a+rw /dev/ttyUSB0 Open the terminal by pressing Ctrl+Alt+t keys simultaneously.

Type, sudo space chmod space a+rw space slash dev slash ttyUSB0

In my case, the port name is ttyUSB0

You have to specify your port name.

Press Enter.

Enter your password for the system and press Enter.

The above command gives read-write permission to the usb port.

Switch back to Arduino IDE Switch back to Arduino IDE.
Next we will configure the ESP8266 module to communicate.
Click File => Preferences In the menu bar, click on the File menu.

Select Preferences.

A new window will appear.

In the Settings tab, go to the Additional Boards Manager URLs section.

Add this json URL.

This will help to download ESP8266 WiFi module in Arduino IDE.

Click on the OK button at the bottom of the window.

Click Tools => Board => Boards Manager In the menu bar, click on the Tools menu and select Board.

Then select Boards Manager option.

A new window will appear.

In the top right corner, we can see a search tab.

Here, type ESP8266 and press Enter.

Select ESP8266 Community Module

Click on version drop down box

Click on install button

Select ESP8266 by ESP8266 Community.

In the version drop down box, select the latest version of the module.

Click on Install button to install the module.

Installation will take few minutes to complete.

Wait until it is installed successfully.

Point to Installed button

Click on the Close button

The ESP8266 module is now installed in the Arduino IDE.

Click on the Close button at the right bottom of the window.

Tools => Board => Generic 8266 Module

Select ESP8266 module to upload the program.

Now, before uploading the program we have to select the ESP8266 module.

Click on the Tools option and select Board.

Scroll down and select Generic ESP8266 Module.

Tools => Builtin LED = 1. Next we need to set the built-in LED of ESP8266 Module.

Again select Tools.

Go to Builtin LED option. Set the Builtin LED to 1.

Tools => Reset Method = no dtr (aka ck). Next we will set the Reset option.

In the menu bar, select Tools. Go to Reset Method.

Select Reset method to no dtr (aka ck).

This will help to reset the wifi module manually.

#include <ESP8266WiFi.h> Now we will write the code.

Type the code as shown.

We have included the ESP8266 library.

const char* ssid = "WIFI_ESP8266_Pratik"; SSID is the name of a Wi-Fi module.

Here, I have named the wifi network as WIFI_ESP8266_Pratik.

const char* password = "12345678"; Password is the passcode to join the Wi-Fi network.

And the password for the module is 12345678.

You have to give your unique ssid and password.

Password parameter is not mandatory.

If you don’t give password parameter, Wi-Fi network will be open.

It will be accessible to everyone nearby.

WiFiServer server(80); This command will enable the default IP address of the module.

The default IP address of the module is 192.168.4.1

void setup()

{

delay(1000);

WiFi.softAP(ssid, password);

server.begin();

delay(2000);

Inside the setup function, write the code as shown.

This command will enable the SSID and Password for the ESP8266 module.

server.begin will enable the Wi-Fi network for the given SSID and Password.

A delay of 2 seconds is given to boot the module.

pinMode(BUILTIN_LED, OUTPUT);

delay(100);

digitalWrite(BUILTIN_LED, HIGH);

}

Built-in LED of the ESP8266 module is set to OUTPUT mode.
void loop()

{

// Check if a client has connected

WiFiClient client = server.available();

if (!client)

{

return;

}

Copy and paste the code inside void loop function.

This code is available in the Code files link of this tutorial

You can download and use it.

while(!client.available())

{

delay(1);

}

String req = client.readStringUntil('\r');

client.flush();

if (req.indexOf("/LED_1/off") != -1)

digitalWrite(BUILTIN_LED, HIGH);

else if (req.indexOf("LED_1/on") != -1)

digitalWrite(BUILTIN_LED, LOW);


else if (req.indexOf("/") != -1);

else

{

client.stop();

return;

}

client.flush();

HTML += "<h3>Blue LED is now ";

client.print(HTML);

delay(10);

}

Image HTML_Page.png

This HTML code will generate a web page as shown here.(image to be shown)

When LED ON or LED OFF button is pressed, the value is passed to the program.

The program checks the value and controls the built-in LED of the ESP8266-01 module.

Click on the compile button on the toolbar. Click on the compile button to verify the program.

A pop up window will appear to save the current program.

Name the program as WiFi_ESP8266.

And click on the save button to save the program.

Click on the upload button on the toolbar

Press push button when the program is getting uploaded

Now click on upload button to upload the current program on ESP8266-01.

We can see the program getting uploaded at the bottom of the screen.

When the state changes to Connecting, press the push button on the breadboard.

Release it after 2 to 3 seconds.

Point to the message We will see a message as Leaving…. Soft resetting as shown here.

This indicates that the program is uploaded successfully.

WiFi => Search for available network nearby => Select your WiFi module => enter password => join the network. Switch off your mobile internet.

Open Wi-Fi option of your mobile phone.

Search for nearest network to connect.

In my case, I am getting WIFI_ESP8266_Pratik since I have given this name in the code.

Select the WiFi.

Enter the password and check if it is connected to WiFi.

Go to Web Browser => enter the IP address i.e. 192.168.4.1 Open Web Browser in your mobile phone.

Enter the IP address 192.168.4.1

This is the default IP address of ESP8266-01 Wi-Fi module by the manufacturer.

Web Page => Press LED ON to turn on the built-in LED.

Press LED OFF to turn off the built-in LED.

Image Module_OFF.jpg

Image Module_ON.jpg

The web page opens as per the HTML code.

We can see the LED of ESP8266-01 module is OFF.

Click on LED ON button which will turn on the blue LED of the Wi-Fi module.

It will be ON until we press the LED OFF button.

Click on LED OFF button which will turn off the blue LED of the Wi-Fi module.

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

Summary

In this tutorial, we learnt to
  • Configure and upload code on ESP8266-01 module
  • Establish wireless communication between ESP and other devices
Slide 11:

Assignment

As an assignment:
  1. Check if your PC or laptop has wireless connectivity and do the steps below.
  2. On the top right corner, click on WiFi icon.
  3. Select the name of your WiFi and enter the password.
  4. Open the browser and go to 192.168.4.1
  5. Select the button and see the output on the ESP8266-01 module.
You should see the output of the assignment as shown here.
Slide 12:

About Spoken Tutorial Project

The video at the following link summarizes the Spoken Tutorial Project

Please download and watch it

Slide 13:

Spoken-Tutorial Workshop

The Spoken Tutorial Project Team conducts Workshops & gives Certificates.
Slide 14:

Forum for specific questions

Please post your timed queries in this forum
Slide 15:

Acknowledgement

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 joining.

Contributors and Content Editors

Nancyvarkey, Nirmala Venkat