Introduction: Santa’s Car
Here's a small fun project I made during the Xmas holidays . It's simple and easy to build , it is controlled via a WiFi-connection and an Android phone or tablet . The microcontroller is an ESP8266 on a Wemos D1-mini board , it has MicroPython installed and runs a small script called remote.py . It has a shield on top ( diy ) with 3 transistors , a few resistors and a voltage regulator ( the power source is an old 2S 850mAh Lipo ) .
The remote is an Android Phone or Tablet with the fantastic RoboRemo app installed :
This app can connect via Bluetooth , TCP , and UDP . Because our D1 has WiFi on board we can skip the bluetooth hardware and keep the circuit very simple . We configure our D1 as access point , connect to our phone or tablet and send commands via UDP .
1 Wemos D1 mini with the latest Micropython installed . Ahmed Nouira made an excellent instructable on how to flash your D1 mini : find it here
1 Diy shield for your D1 mini ( Banggood )
3 transistors BC 517 ( a bit overkill but I had no others available )
3 resistors 39kOhms 0,25 Watt for the base polarization
1 Voltage regulator 5V ( 7805 or similar , I used a LM2940-5 WITH CAPACITOR )
Led's , 2 or 4 if you like taillights on your car .
220Ohm resistors , 1 for each led .
2 geared motors with wheels like on the Banggood line following robot .
Wood , plastic sheet or whatever to make the car's body .
A tablet or phone , ANDROID , with the RoboRemo app installed .
Step 1: Prepare Your Remote Control .
First we need to configure our phone or tablet as a remote control . Install the RoboRemo app and check out their website : RoboRemo site .
Here you'll find all the stuff and tutorials you need . Download the pdf-manual and read it .
Once installed just try it out , it's very easy ! Our remote has 4 buttons as seen on the pics : start , stop , left and right .
When pressed each button will send a text string followed by a newline ( backslash n char ) . Configure your buttons , note the text string for each button . Your script will search for these strings to steer Santa's vehicle :-)
Step 2: Prepare Your D1 Mini : Flashing Micropython .
Ahmed Nouira did an excellent job , here's all you need to prepare your Wemos D1 :
however , for the D1 the following esptool command must be used :
esptool.py --port /dev/ttyUSB0 -- write_flash --flash_mode dio 0 esp8266-20190529-v1.11.bin
( This is for a Linux machine , Macs and Windows will be different , also the .bin file may be different ). Most important is the --flash_mode dio for the Wemos D1 .
If you type just esptool.py in a terminal it shows all options.
If you have problems flashing MicroPython here are a few helpfull links :
And Google is your friend , just type "Flashing micropython on Wemos D1" .
Step 3: Load the Remote.py Script
When your D1 has Micropython installed it's time to upload the Remote.py script .
Feel free to modify/share/copy/whatever :-) . Just make shure your RoboRemo command strings
(sent each time you push a button on your phone/tablet) match the script .
Rename the APname and password in the script as you like .
I use Thonny IDE to write and upload scripts . If you use a different method make sure your text editor doesn't change the scripts identation or Micropython will complain .
Kate text editor (Linux) can be configured for Python scripts and will take care of the proper identations. Ampy can flash the script to your board .To Ampy .
See the Random Nerd Tutorials site for all possibilities :Link
Scroll down to the Prerequisites section
Thonny allows you to load a script while renaming it , the Remote.py must be renamed boot.py before flashing into your board .
Step 4: Test Your Board
After modifying your APname and password and loading the script it's time for a simple test :
- Fire up your Phone/Tablet and PC
- Connect the D1mini to a USB port and wait a little , the D1 should start as Access point
-connect your Phone/Tablet to the Access point in the setup/Wifi section
-connect the Roboremo app to the access point : menu/connect/Internet(UDP)/connect to ip:port
-open PuTTy or another serial emulator
-enter the port (/dev/ttyUSB0 in my case) and set baud rate to 115200 , you won't see the REPL but don't worry :-)
- hit the command buttons on your Android phone/tablet and observe the output to the PuTTy terminal : see video
-if no errors occur : next step : fire up your soldering gear :-)
Step 5: Soldering the Shield
Start by soldering the battery connector and voltage regulator ( and capacitor if LM2940-5 is used ).Hookup the battery after verification of your work . Measure the output voltage (5V) . If OK solder the 5Voutput and GND to the shield's terminals , see markings on the shield . Solder the shield's connectors .
Now wire a 5V and GND bus , solder the other parts as seen on the schematic . Connect motors and led's and you're done !
IMPORTANT ! Check and double check your work before installing the shield to the D1mini . Errors can destroy your board ...
Step 6: Building Your Car
This is also very simple : mine is made of wooden paint mixing sticks glued together with cyano aka superglue . The motors are fixed with double sided tape and a rounded bolt is used as "nose wheel".I tried other setups but this gave the best results , the setup is the same as the Banggood line follower . The bodywork is made of balsa ( I made lots of scratchbuilt planes so I still have stock) :-)
Now solder the motor wires and led-wiring , check if both wheels run forward if "start" is pressed .
This is the final step , now it's time to run your car and have tons of fun :-)