Introduction: ESP8266 Robot Car Programmed With ESP8266 Basic
I am a middle school science teacher and also the Robotic Club Advisor. I have been looking for more cost effective ways to get robots into the hands of my students. With the low prices of ESP8266 boards, I have been able to create a autonomous robot car for under $20. With Lego Mindstorm Kits costing $300, MakeBlock kits costing about $100, this represents a significant savings allowing me to have more students involved in our robotics competitions. In order to compete with other robots, I realize that other sensors are required such as Ultrasonic distance sensors as well as line following sensors... but these can be purchased for under $20, making my robots costing under $50 that can do all that kits that cost twice as much can.
Our students all use chromebooks and with the collapse of the free Codebender web site, arduino robots have been placed a bit out of reach. I know that create.arduino.cc offers a solution, but with limited funding, I have been seeking free alternatives.
Using ESP8266 with a Motor Driver board, I am now able to control a robot car via wifi. Using ESP8266 Basic you can now modify your program also via wifi. All this can be done in a browser on student's chromebooks.
While ESP8266 Basic will not let you use sensors as is, (Basic is too slow to read some of these sensors) I am hoping to create and program arduino sensor modules that interface with the ESP8266 basic modules so that robot control can be programmed in basic using these arduinos that I preprogram with sensing duties. This would only add about $5-$10 to costs of robot (however, I already do have many arduino boards that I can use for this purpose.)
Step 1: Either Buy a ESP8266 Car Kit or Buy ESP8266/Motor Driver Kit
Link for ESP8266/Motor Driver Kit:
Link for ESP8266 Smart Car Kit:
If you go for the esp8266/motor driver kit and want to DIY, then you will need motors:
I used black foam board purchased from Dollar tree for my robot car because I already had motors and the ESP8266/Motor Driver kit.
Step 2: Solder Wires to Motors ... Then Connect to Motor Driver Board
I used 4 wire male-female jumpers which I cut in half. This way, after you connect wires to motors and driver board, all you need to do is connect male end with female end for final connection. This also makes routing wires a bit easier, but is not necessary, you can use 4 wires (2 for each motor) to connect motors to board.
You will need to solder wires to the motor so that you can connect motors to the driver board.
I used hot glue to keep wires in place as a form of stress relief.
Step 3: Put Together Your Car...
If you bought the car kit, then assemble according to the poorly translated directions...but it's not to hard, pretty self explanatory.
Step 4: Put Together Your Car ... Continued ..
If you are going DIY, it will go a bit faster, provided that you use zip ties / hot glue / duck or packing tape to assemble yours as I did mine.
Connect motors/wheel assembly to chassis and route wires to motor driver.
Step 5: Make All the Connections
Now, you need to connect motors and power wires to driver board. You also might have to plug in ESP8266 to driver board. Once everything is connected and secured, use micro USB cord to plug into your computer.
Connect power from battery pack to ground (black) and Vin (red).
Connection wires from one motor to a+ and a-, connect other motor wires to b+ and b-.
Connect Vin to Vm with a jumper.
Step 6: Download ESP Flasher
Step 7: Download ESP8266 Basic Firmware
Please make note directory that you download it to....
Step 8: Run ESP Flasher
then click config and then click on gear to select firmware
Find binary used for ESP8266 Basic Firmware in download directory.
Should be called: ESP8266Basic.cpp.bin Once you load this, make sure you can see com port that your ESP8266 is connected to, then click FLASH. (I downloaded it twice... that is why I have two files...)
Step 12: Flash ESP8266 Basic Firmware
Step 13: Disconnect From PC and Turn on Battery Power...
Once firmware is loaded, disconnect from PC and make sure batteries are seated properly. Use push button switch to turn on board.
Step 14: Connect to Device From Computer Via WIFI
Look for OPEN Access point with ESP in the name. Connect to access point. No password should be necessary.
Once connected, type: http://192.168.4.1 into the browser to connect to your robot.
You can find information about ESP8266 Basic at https://www.esp8266basic.com/documentation.html
Download ESP8266 Robot Car program from https://esp8266robot.nmmaker.net or from link below:
Step 15: Set Up Esp8266 to Logon to Your Wifi
Click on Settings, then add your wifi information. when done, click save, then click restart.
Step 16: Upload ESP_Robot.bas
Download ESP_Basic by clicking:
Click on File Manager and open ESP_Robot.bas so that you can upload it to your board. Alternatively, you can create file in notepad and copy and paste into file and save it to your computer. (I have found that sometimes, when I copy and paste into the editor for ESP Basic, extra characters appear causing errors.)
<p>speed=0</p><p>[top] print "speed" slider speed, 0 , 1024 print button "forward", [forward] print button "left", [left] button "right", [right] print button "backward", [backward] print button "stop", [stop] print button "Exit", [getMeOutOfHere] wait</p><p>[stop] io(pwo,5,0) io(pwo,4,0) io(po,0,1) io(po,2,1) wait</p><p>[forward] io(pwo,5,speed) io(pwo,4,speed) io(po,0,1) io(po,2,1) wait</p><p>[backward] io(pwo,5,speed) io(pwo,4,speed) io(po,0,0) io(po,2,0) wait</p><p>[right] io(pwo,5,speed) io(pwo,4,speed) io(po,0,1) io(po,2,0) wait</p><p>[left] io(pwo,5,speed) io(pwo,4,speed) io(po,0,0) io(po,2,1) wait</p><p>[getMeOutOfHere] end</p>
Step 17: Once You Do That, Click on ESP_Robot.bas and Then Click on EDIT Then Click RUN.
Step 18: Adjust Speed, Then Have Fun
We have a be nice policy.
Please be positive and constructive.