This tutorial will teach you how to control a Robo car using any WiFi enabled device.
Components Required:
1. ESP 8266 WiFi module
2. Arduino UNO (or its equivalent)
3. Motor driver L293D
4. Chassis
5. 12V DC Geared motors X 2
6. Wheels X 2
7. Castor Wheel
8. Wires
9. Breadboard
10. Small PCB
11. Male headers
12. Female headers
About ESP8266
ESP 8266 is the latest buzz on internet. It is a WiFi module which is just a bit larger than a 1 Re coin. Well that's not what it is famous for though. What made it very popular among electronic hobbyist is its unbelievable low cost. I got it just for $5 (~300 Rs.) An arduino along with a WiFi shield would cost 10 times of what this module costs.
It can be interfaced with any microcontroller through USART communication, meaning it just need the RX and TX pins. Another feather to its hat was added recently. The developer released the SDK files of the module and hence even the module can be re-programmed and its GPIO pins can be used independently without any additional microcontroller. But that is beyond the scope of this tutorial. We would be using the module along with Arduino UNO.
Making a Breadboard adapter for ESP8266 module:
The problem with the module's physical feature is that you cannot connect it directly to a breadboard. So I've decided to make a adapter which will be used to connect the module onto a breadboard.
These are the parts you would need to make the adapter:
Start by soldering the female header onto the PCB. Solder the corner pins first so that the header grips onto the PCB properly. Then solder the remaining 4 pins.
Next, place the male headers on the opposite side of the PCB and carefully solder it onto the PCB.
After soldering, you can remove the black plastic part attached to the male header and start soldering each male pin to its corresponding female pin. You would have something like this in the end:
Once you have this, you can snap it onto a Breadboard happily and attach the ESP 8266 module to it easily.
Here is a detailed video tutorial showing the process: http://youtu.be/GhwmgvcjRaA (Optional)
circuit Diagram:
AT Commands for ESP 8266:
Command | Description |
AT+GMR | To know the version of firmware |
AT+RST | To Reset module |
AT+CWMODE | To set the mode of operation i.e., as Access Point or Station mode or both. |
AT+CWLAP | To see the list of APs available |
AT+CIPSERVER | To set as server |
AT+CIPMUX | To choose between single or multiple connections |
AT+CIPSEND | To set the channel number, data length and send data over WiFi |
AT+CIPCLOSE | To close the connection |
Server on ESP 8266:
We will be sending a web interface (an HTML page) to any device (say a WiFi enabled mobile phone) connected to the WiFi module. The code for the HTML page would be provided by the Arduino. And also, the Arduino would decode the request from the device and control the motors accordingly.
Since the WiFi module can operate as an access point also, we don't need an extra wireless router for the project.
If you have no idea about HTML pages then head to my "Controlling Appliances over WiFi and Ethernet" project and get to know the basics.
Here is the algorithm to be followed for setting up a server on ESP 8266:
Algorithm:
- Test module using "AT" command
- Set mode of operation using "AT+CWMODE=<mode number>" command
- Set number of connections using command "AT+CIPMUX=<number>"
- Set it as server using the command "AT+CIPSERVER=<mode number>,<port>"
- If GET request received from a browser, then use the command "AT+CIPSEND=<channel number>, <data length>" followed by the html data you would like to send.
- After completion close the connection using "AT+CIPCLOSE" command.
Coding:
No comments:
Post a Comment