ESP32 RC Car
First of all : All credits for this project go to Rui and Sara Santos , the people behind Random Nerd Tutorials .
This site is a Goldmine , full of info and projects , for beginners and pro's , it is all there .
The project is based on this tutorial : ESP now
All code is in Micropython , the "skeleton" is from the RNT-site and modified for the RC car .
I bought this kit from Banggood , but did not have time to assemble it , so warranty expired ... When building the transmitter (27MHz , coding done by a microcontroller) , it worked fine for a while but then the controller died without any reason . My 3 grandsons were very disappointed ...
You can buy a RTR (ready to run ) RC car for about 9Euro's in shops like Action and Wibra ( Belgium and the Netherlands ) but this it much more fun and you will explore hard- and software and learn a lot !
Let's get started !
Supplies
- We need 2 ESP32 C3 super-mini modules , one for Tx and one for Rx(car) .
- The motor and steering mechanism( also 130 type motor) are controlled by a TB6612FNG module .
- 1S LiPo 600mAh cell for the Rx power supply
- 4 ea 10k resistors
- 4ea 100nF capacitors
- soldering gear and/or wire wrapping tools
- the RC car kit , of course ...
Prepare the ESP32 Modules
It is a good idea to solder headers to the ESP32 modules , easy for wire wrapping or pcb mounting . The modules are very small and fragile so soldering headers will make them reusable for other projects . Solder the headers using a breadboard , this will dissipate heat and make your life easier .
Flash Micropython to Your ESP's
If you are not familiar with Micropython and the Thonny IDE : Link to the Fantastic RNT site .
Hold the Boot-button when connecting to the USB-port of your computer to enter flash-mode .
Make sure you load the correct firmware : pick the ESP32 C3 version .
The Thonny-screens on your machine may be different : this is an old Dell Lattitude running Ubuntu 20 .
Carefully follow all instructions from the RNT-site and make sure Micropython is installed correctly .
Check for the prompt , compare with the supplied screenshot .
Testing ESP-Now
Now we will test both modules with ESP-Now . Follow this link :
Read and make sure you understand this fantastic tutorial , begin searching the MAC-adress of your boards .
Test your boards following the instructions . If everything works : Well Done !
Modify the 27MHz Transmitter
Only the buttons and 4 pull-up resistors (10kOhms) and debouncing capacitors (100nF) are soldered on the transmitter cca . I used wire wrapping on the ESP-module and soldered the wires to the original microcontroller-connections .
Loading Transmitter Main.py File
If the tutorial from RNT passed OK we can flash the Tx main.py file into the ESP32 . Load the file in Thonny , replace the b' xxx stuff with the MAC adress you found during the tutorial and save the file in your ESP32 .
Downloads
Loading Receiver Main.py File
Same procedure as previous step , this time the Rx file . Do not forget to modify the MAC adress !
Downloads
Testing the Receiver
Before we assemble the hardware and the car it is a good idea to test the Tx/Rx combination . This is done by inserting 2 AA batteries in the transmitter and hook up the Rx-ESP to your computer running Thonny . Launch the main.py from the Rx , and observe the Thonny screen . Move the Tx sticks and observe , you should see the messages sent by the transmitter . If OK : Well Done !
Hardware Assembly
We start by preparing the H-bridge pcb , soldering the headers . Connect the H-bridge to the Rx-board according to the schematic diagram . Step by step , start with the steering motor , test , and so on . Notice that the steering motor only works if the forward/reverse stick is also active . Take your time and always check your connections ! Try to separate power (motors) and signal wires , refere to the pictures .
Have Fun !
After the hard work find yourself some test pilots ! My grandsons were very pleased and accepted the job :-)
Things to Improve , Remarks , Questions,Problems ...
- The transmitter has room for 2 AA batteries , which means 3 Volts . I noticed that fresh batteries worked perfectly , but when the voltage drops the Tx stopped working ( the ESP32 needs 3.3 V )
- We need a separate 1S LiPo for the receiver , the bottom of the car has place for 3 AA's , and during operation their voltage was quite unstable and 'spickey' causing the ESP to reboot ...
- Anyway , I learned a lot , had tons of fun and trained my obsolete brain ... :-)
If you experience problems while building this project I'll be happy to help !