Introduction: ESP8266 Wifi Controlled Robot
If you have seen my previous instructable then you know that I built a raspberry pi wifi controlled video streaming robot. Well, it was nice project but if you are just a beginner then you might find it difficult and expensive but for me I already had most of the parts lying around. This is a very cheap wifi controlled robot but it does not stream video. It is built on the ESP8266 platform.
Step 1: Materials Required
1. ESP8266 Board
2. L293D IC or L298 Motor driver board
3. Robot Chassis with Motors (I used 500 rpm motors)
4. Breadboard or PCB (If you prefer to solder)
5. 6v AA Battery Pack or a 9v Battery (To power the ESP8266)
5. A battery (To power the motors)[Which one to choose in step 3]
Step 2: ESP8266 Board - Which One to Pick ?
1. Adafruit Feather Huzzah - It is made by adafruit thus it has easily available instructions and support. It doesn't come with soldered header pins so you will need a soldering iron to solder them. It has li-po battery charger on the board itself, so it will come really handy in portable projects. It costs $16
2. NodeMCU ESP8266 - It is just the basic board with no extra features but it is open source and has excellent documentation so it will be very easy to get started. But the best part is that you can buy it for less than $4.
3. Sparkfun ESP8266 - It is like the huzzah with the addition of a power switch and an external antenna for a longer Wifi range and it also costs $16
4. Wemos D1 Mini - It is the smallest of all the boards but this doesn't have any effect on the performance. It has nice documentation and it only costs $4. If you want a longer range and the same form factor then you could buy the Wemos D1 Mini Pro which has a external antenna
Finally, the one I would recommend is the NodeMCU ESP8266 because it has excellent documentation and how cheap it is. If you are building a portable project then I would recommend the sparkfun board because of the external antenna and the built-in li-po charger and sparkfun makes good quality products.
Step 3: Battery - Which One to Choose ?
There are many different kinds of batteries to choose from, you have to select the right one for you.
1. AA Battery Pack - They are the most common type of batteries and are very cheap. Each cell has a voltage of 1.5 volts, we need at least 9 volts, so we would need to wire 6 - 8 cells in series to get 9 -12 volts.
2. 9v Battery - This is also a very common type of battery and also cheap. It has a voltage of 9 volts but the maximum current and capacity is pretty low, so it wouldn't last long and the motors will spin quite slow.
3. Lead Acid Battery - It is also pretty common as it is used every car out there. It has a voltage of 12 volts, it has the perfect voltage for our needs. It's current capability is good and has a large capacity. The only part where it isn't good is the size and weight, it is big and heavy.
4. Li-Ion (Lithium Ion) - It is the type of battery that is used in power banks. It comes in different sizes but the most popular is the 18650 cell. The maximum voltage is 4.2 volts and minimum is 3.7 volts. If you charge or discharge it more than those parameters then the battery would be damaged. A special type of charger is needed to charge these batteries. It has a high current capability and a large capacity and is also very small, only a little bigger than AA battery. But it doesn't come as pre-built battery packs, so you would have to buy individual cells and create a battery pack.
5. Li-Po (Lithium Polymer) - It is mostly used in quadcopters and drones and in hobby rc vehicles. The maximum and minimum voltage is same as an Li-Ion battery. A special charger is also needed to charge them. It has the highest current capability out of all these and also has a large capacity and is also small. But is dangerous, if you don't handle them properly they could catch on fire.
For beginners I would recommend a AA battery pack or a Lead acid battery and for advanced users a Li-Po battery. If you want to learn more about comparison between different types of batteries then watch this video made by Great Scott.
Step 4: Assembling the Chassis
I used 4 motors to make it a 4 wheel drive but you can make it a 2 wheel drive by removing the front two motors and replace them with dummy wheels or add a castor wheel. To assemble the chassis solder wires onto the motors and mount the motors on the chassis. If you don't have a soldering iron then you can twist the wires and attach them with electrical tape but it is not recommended as it will be quite a weak joint. I have mounted the 6v AA battery pack where the castor wheel is supposed to be attached The assembly will be different for every different chassis but is a very easy process.
Step 5: Adding ESP8266 in Arduino IDE
The esp8266 boards don't come installed in the arduino IDE. To install follow these instructions -
1. Start Arduino and open Preferences window
2. Enter "http://arduino.esp8266.com/stable/package_esp8266com_index.jsoninto" into Additional Board Manager URLs field
3. Open Boards Manager from Tools > Board menu and find esp8266 platform
4. Select the latest version from a drop-down box and click the install button
5. Don't forget to select your ESP8266 board from Tools > Board menu after installation
Step 6: Finding the IP Address of the ESP8266
1. Open the give code in the Arduino IDE
2. Find where it says "YOUR SSID" and erase it and write your wifi's SSID (Between the inverted commas) which is the name of your wifi network.
2. Below it, it will say "YOUR PASSWORD" erase it and write the password of your wifi network (Between the inverted commas)
3. After you have made the changes upload the code to your ESP8266 Board
4. Unplug the board from your computer and plug it again
5. Open the serial monitor and set the baud rate to 115200 and choose "Both NL and CR". It will say "wifi connected" and will also show the IP address. Note down the IP address because we will need it later.
Step 7: Circuit
The circuit is very simple. Instead of the AA battery pack you can use any other type of battery.
NodeMCU - L293D
D3 - Pin 7
D4 - Pin 2
D5 - Pin 9
D6 - Pin 1
D7 - Pin 10
D8 - Pin 15
Gnd - Battery Negative
Both the AA battery pack and 9v battery should have a common ground connection.
Step 8: Programming
Open the given code in the arduino IDE and write you wifi network's SSID and password like I shown you before then upload the code to your ESP8266 Board.
Step 9: Installing the Control App
This robot is controlled through an app, download the ESP8266_robot.apk file and install it on your smartphone.
There is also the .aia file if you want to make any changes to the app.
Step 10: Controlling the Robot
Open the app and write the IP address of your ESP8266 Board and now you will be able to control it !!!
If the motors are spinning in the wrong direction then just interchange their connections to the L293D or interchange the control pins. The ESP8266 connects to wifi through DHCP, meaning that almost every time you connect it will have a different IP address, so you will need to check the IP address every time.
Step 11: Some Pictures and Videos
It is very fast with a 12v battery, but if you think that it is too fast then you can lower the speed, first find the ENB pins in the code, you can write 0 to 250 instead of HIGH to set the speed. For example, "analogWrite (leftMotorENB, 170)"
If you liked this instructable please vote for it in the contests :)
Participated in the
Arduino Contest 2017
Participated in the
Remote Control Contest 2017
Participated in the
Wheels Contest 2017