Difference between revisions of "Arduino/C2/Wireless-Connectivity-to-Arduino/English-timed"
From Script | Spoken-Tutorial
PoojaMoolya (Talk | contribs) (Created page with "{| border=1 | '''Time''' | '''Narration''' |- | 00:01 | Welcome to the '''Spoken Tutorial''' on '''Wireless Connectivity to Arduino''' |- | 00:06 | In this tutorial,...") |
PoojaMoolya (Talk | contribs) |
||
Line 93: | Line 93: | ||
|- | |- | ||
| 02:12 | | 02:12 | ||
− | |Note: The '''ESP8266-01 module''' works on '''3. | + | |Note: The '''ESP8266-01 module''' works on '''3.3 Volts''' only. |
|- | |- | ||
| 02:20 | | 02:20 | ||
− | |Connecting it to ''' | + | |Connecting it to '''5 Volts''' may '''damage''' the''' Wi-Fi module'''. |
|- | |- |
Latest revision as of 11:22, 23 January 2020
Time | Narration |
00:01 | Welcome to the Spoken Tutorial on Wireless Connectivity to Arduino |
00:06 | In this tutorial, we will learn to:
Configure and upload code on ESP8266-01 module |
00:17 | Establish Wireless Communication between ESP and other devices |
00:23 | To follow this tutorial, you should have a basic knowledge of:
Electronics |
00:29 | C or C++ programming language and |
00:33 | Wireless Communication |
00:36 | To record this tutorial, I am using:
Arduino Uno board |
00:41 | Ubuntu Linux 16.04 OS and Arduino IDE |
00:48 | We will require a few external components such as
ESP8266-01 Wi-Fi module |
00:59 | Breadboard |
01:01 | Jumper Wires and Push Button |
01:05 | In this tutorial we will use ESP8266-01 WiFi module. |
01:13 | VCC, RST, CH_PD, Tx, Ground, GPIO2, GPIO0, Rx are the pins of the Wi-Fi module. |
01:27 | Power LED indicates whether the module is ON or OFF. |
01:32 | COMM LED is the built-in blue LED of the WiFi module. |
01:37 | In this tutorial, we will see how to control this built-in LED using WiFi. |
01:43 | This WiFi module has a built-in System on Chip with integrated TCP/IP stack. |
01:51 | It has a UART and 2 GPIO pins (General Purpose Input / Output). |
01:57 | It is widely used for development of IoT (i.e. Internet of Things) applications. |
02:04 | This is the circuit connection of ESP8266 - 01 module with Arduino. |
02:12 | Note: The ESP8266-01 module works on 3.3 Volts only. |
02:20 | Connecting it to 5 Volts may damage the Wi-Fi module. |
02:24 | Connect ground pin of Wi-Fi module to ground pin of Arduino. |
02:29 | Connect GPIO 0 pin of Wi-Fi module to ground of Arduino. |
02:35 | Connect Rx pin of Wi-Fi module to Rx pin of Arduino. |
02:41 | Connect Tx pin of Wi-Fi module to Tx pin of Arduino. |
02:47 | Connect VCC and CH_PD pin of Wi-Fi module to 3.3V of Arduino. |
02:57 | Connect a push button between RST pin of Wi-Fi module and ground pin of Arduino. |
03:05 | This is the live setup of the connection, as shown in the circuit diagram. |
03:10 | Do the connection as shown here. |
03:13 | We will establish a connection between WiFi module and a laptop or a mobile phone. |
03:20 | Now we will write a program in Arduino IDE.
Open Arduino IDE. |
03:27 | Connect your Arduino board to your PC. |
03:30 | First, we need to know the name of the port to which Arduino is connected. |
03:35 | Go to the Tools menu. Select Port option. |
03:40 | In my case, the port is ttyUSB0. Note down your port name. |
03:49 | Windows users can skip the steps below as the port is detected automatically. |
03:56 | Open the terminal by pressing Ctrl+Alt+T keys simultaneously. |
04:03 | Type, sudo space chmod space a+rw space slash dev slash ttyUSB0 |
04:18 | In my case, the port name is ttyUSB0 |
04:25 | You have to specify your port name.
Press Enter. |
04:30 | Enter your password for the system and press Enter. |
04:35 | The above command gives read-write permission to the usb port. |
04:40 | Switch back to Arduino IDE. |
04:43 | Next we will configure the ESP8266 module to communicate. |
04:49 | In the menu bar, click on the File menu.
Select Preferences. |
04:56 | A new window will appear. |
04:58 | In the Settings tab, go to the Additional Boards Manager URLs section.
Add this json URL. |
05:09 | This will help to download ESP8266 WiFi module in Arduino IDE. |
05:16 | Click on the OK button at the bottom of the window. |
05:20 | In the menu bar, click on the Tools menu and select Board. |
05:25 | Then select Boards Manager option.
A new window will appear. |
05:31 | In the top right corner, we can see a search tab. |
05:35 | Here, type ESP8266 and press Enter. |
05:41 | Select ESP8266 by ESP8266 Community. |
05:48 | In the version drop down box, select the latest version of the module. |
05:53 | Click on Install button to install the module. |
05:57 | Installation will take few minutes to complete. |
06:01 | Wait until it is installed successfully. |
06:05 | The ESP8266 module is now installed in the Arduino IDE. |
06:09 | Click on the Close button at the right bottom of the window. |
06:14 | Now, before uploading the program we have to select the ESP8266 module. |
06:20 | Click on the Tools option and select Board. |
06:25 | Scroll down and select Generic ESP8266 Module. |
06:32 | Next we need to set the built-in LED of ESP8266 Module.
Again select Tools. |
06:41 | Go to Builtin LED option. Set the Builtin LED to 1. |
06:48 | Next we will set the Reset option. |
06:52 | In the menu bar, select Tools. Go to Reset Method. |
06:58 | Select Reset method to no dtr in bracket aka ck. |
07:06 | This will help to reset the wifi module manually. |
07:10 | Now we will write the code.
Type the code as shown. |
07:16 | We have included the ESP8266 library. |
07:20 | SSID is the name of a Wi-Fi module. |
07:24 | Here, I have named the wifi network as WIFI_ESP8266_Pratik. |
07:34 | Password is the passcode to join the Wi-Fi network.
And the password for the module is 12345678. |
07:47 | You have to give your unique ssid and password. |
07:52 | Password parameter is not mandatory. |
07:56 | If you don’t give password parameter, Wi-Fi network will be open. |
08:01 | It will be accessible to everyone nearby. |
08:05 | This command will enable the default IP address of the module. |
08:10 | The default IP address of the module is 192.168.4.1 |
08:20 | Inside the setup function, write the code as shown. |
08:25 | This command will enable the SSID and Password for the ESP8266 module. |
08:33 | server.begin will enable the Wi-Fi network for the given SSID and Password. |
08:40 | A delay of 2 seconds is given to boot the module. |
08:44 | Built-in LED of the ESP8266 module is set to OUTPUT mode. |
08:51 | Copy and paste the code inside void loop function. |
08:56 | This code is available in the Code files link of this tutorial
You can download and use it. |
09:04 | This HTML code will generate a web page as shown here. |
09:10 | When LED ON or LED OFF button is pressed, the value is passed to the program. |
09:17 | The program checks the value and controls the built-in LED of the ESP8266-01 module. |
09:27 | Click on the compile button to verify the program. |
09:31 | A pop up window will appear to save the current program. |
09:35 | Name the program as WiFi_ESP8266. |
09:43 | And click on the save button to save the program. |
09:48 | Now click on upload button to upload the current program on ESP8266-01. |
09:58 | We can see the program getting uploaded at the bottom of the screen. |
10:03 | When the state changes to Connecting, press the push button on the breadboard.
Release it after 2 to 3 seconds. |
10:13 | We will see a message as Leaving…. Soft resetting as shown here. |
10:20 | This indicates that the program is uploaded successfully. |
10:25 | Switch off your mobile internet. |
10:28 | Open Wi-Fi option of your mobile phone. |
10:32 | Search for nearest network to connect. |
10:35 | In my case, I am getting WIFI_ESP8266_Pratik since I have given this name in the code.
Select the WiFi. |
10:52 | Enter the password and check if it is connected to WiFi. |
10:57 | Open Web Browser in your mobile phone.
Enter the IP address 192.168.4.1 |
11:11 | This is the default IP address of ESP8266-01 Wi-Fi module by the manufacturer. |
11:22 | The web page opens as per the HTML code. |
11:26 | We can see the LED of ESP8266-01 module is OFF. |
11:34 | Click on LED ON button which will turn on the blue LED of the Wi-Fi module. |
11:41 | It will be ON until we press the LED OFF button. |
11:46 | Click on LED OFF button which will turn off the blue LED of the Wi-Fi module. |
11:52 | This brings us to the end of this tutorial. Let us summarize. |
11:58 | In this tutorial, we learnt to
Configure and upload code on ESP8266-01 module |
12:09 | Establish wireless communication between ESP and other devices |
12:15 | As an assignment:
Check if your PC or laptop has wireless connectivity and do the steps below. |
12:23 | On the top right corner, click on WiFi icon. |
12:28 | Select the name of your WiFi and enter the password. |
12:32 | Open the browser and go to 192.168.4.1 |
12:41 | Select the button and see the output on the ESP8266-01 module. |
12:49 | You should see the output of the assignment as shown here. |
13:03 | The video at the following link summarizes the Spoken Tutorial Project
Please download and watch it |
13:11 | The Spoken Tutorial Project Team conducts Workshops & gives Certificates. |
13:18 | Please post your timed queries in this forum |
13:22 | Spoken Tutorial Project is funded by MHRD, Government of India. |
13:29 | This tutorial has been contributed by FOSSEE and Spoken Tutorial Project, IIT Bombay.
And this is Saurabh signing off. Thanks for joining. |