Introduction: ESP8266-1 Enabled RC Turned Wifi Car With Browser Controlled Direction.
This project is conceived to demonstrate the capability of basic IoT devices. The objective was to control the motion of a car through web browser. I had couple of options to achieve this - 1) Over web, directly controlling the motor of the car by an WiFi module, 2) Configuring the Wifi module as an access point and integrating the module with the car.
To reduce the cost and logistics, I preferred an alternative way. My kid had couple of RC cars, so, I decided to control the RC remote by the WiFi module. Accordingly, I integrated the RC remote with an ESP8266 based WiFi module.This has helped me not to make any change in the car unit. In other way, the car unit is completely abstracted of the changes happened behind.
ESP8266 is an amazing SOC (system on chip) available in market since last few years. It has made implementation of IoT based projects really easy than ever before. This is a small WiFi module integrated together with a micro-controller and mounted on a tiny board. It is capable to work at 3.3 Volt only! Already there are multiple publications regarding this module, hence I am not going into details. Somehow, I am more comfortable with Arduino IDE based ESP8266 library rather NodeMCU based programming. In this project, I have used ESP8266-1 module to directly control relay units by two of its GPIO pins. Arduino UNO board is used only to flash the code in ESP8266. You can use a serial-TTL converter board as well if you do not have Arduino UNO board.
Following components are required for this project:
1) Arduino IDE (anything above 1.6.5).
2) ESP8266-1 module.
3) 3-5V 2 channel relay.
4) Arduino Uno (Only for programming the ESP8266 module) or any Serial-to-TTL converter.
5) RC remote and Car.
Please find the YouTube link for the video. I am sorry could not edit the video before uploading, it could have been shorter.
Step 1: Hacking the RC Remote.
The first step is to hack the RC remote. All we need is to identify how the push button switches are working. Find the probes the switch is connecting. Solder small cable on the connection points and extend those cables out of the Remote unit. You can test the unit by connecting the cable end points. This is simple. Just basic soldering skill will help you to achieve this.
Step 2: Write the Code!
As I explained earlier, I have used ESP8266-1, I had option to use two of its GPIO pins only. (There are ways to extend GPIOs on ESP8266-1, but for this project, that is not required.)
The basic logic of the code is as following:
- Assign the SSID and Password to ESP module and connect the same to home WiFi network.
- Assign a dedicated IP to the ESP module, so that even if home router is restarted, the WiFi module is assigned to same ip every-time.
- Start the Server on a specified port.
- Whenever a client session is established via web-browser, display the direction options, ensure only one options can be selected at a time.
- To speed up the html submit request, I have used a small java script function to ensure the the html form will be submitted, whenever one radio button is selected.
Major improvement required: The same project can be implemented via websocket to send the command in a real time manner.
Please find the attached Arduino sketch, which can be directly uploaded into ESP8266 module.
Step 3: Connection Details.
While Programming, ESP8266-1 must be connected to Arduino or FTDI board.
In this project Arduino UNO board is used for two purpose - 1) Flashing the ESP code via Arduino IDE, 2) Supply power to the ESP8266 module. I have seen in many posts where it is suggested to use a separate power supply module for ESP8266, as apart from 3.3v, it draws above 80 mA of current (please check data sheet for details). However, I was able to drive this unit by my Arduino UNO board without any problem.Remember the Rx of Ardunio board to be connected to Rx on ESP module and Tx of Ardunio board to be connected to Tx of EXP Module.
If you have an FTDI-TTL module, you can use the same, however you need to cross the Tx - Rx connection in that case. I tested with following module along with the 3.3v power supply unit and it worked fine .
I have provided two diagrams to explain the connection, while programming the chip and also while using the ESP module. As you might be aware, the major change is moving the GPIO0 pin from GND (in first diagram) to Relay unit (in second diagram).
Although, flashing ESP8266-1 has been explained by many developers in multiple publications, I want to summaries the best practices as per my experience.
Few things to remember while working with ESP8266 module, sometime the behavior of the module could be very frustrating, mainly while flashing the chip. I have a Apple Mac Pro laptop and all the observations could be related to ESP8266-1 module only.
- While programming, if you start the power supply from fresh (restart the module), you need reset the module in a way as explained in following link.
- Ensure GPIO0 pin is grounded.
- Restart the Arduino IDE, ensure correct port is visible and "checked" under Menu -> Tools -> ports.
- Ensure latest firmware is flashed in your esp8266-1 module.
Post programming, the ESP8266-1 needs to be connected to 2-channel relay and Relay needs to be connected to modified RC remote.
Two channel relay board, apart from power lines, there will have two control lines - "R1" and "R2". GPIO0 and GPIO2 should be connected to these pins respectively. Also, remember, if you are using two different power supply sources for esp8266 and Relay modules, there ground pins must be connected.
On the load side of the relay board, you will see three connection pointers for each relay - "NO" (Normally Open), "NC" (Normally Close), "C" (Common). We will not use "NC", rather "C" and "NO". both of the "C" can be sorted. Each of the "NO" will be connected to respective switch extensions of the RC remote.
Before completion, I must thank to instructables for providing us such a nice platform to share our ideas; otherwise, it is really hard to get all the information and conceiving new ideas to work further.
Please let me know, if you find any discrepancy in the explanation.
With best regards,
7 years ago
Thank you so much
7 years ago
Awesome project. Looks like a lot of fun.