How it was done: The hardware
I took an off-the-shelf RC car.
I removed the chassis and threw away the electronics board inside. I kept the bottom frame with the battery compartment, the motor and the wheels.
The steering was done by a second smaller motor, which could only be turned left and right, which resulted into that the wheels could only be turned 100% left and 100% right. So I removed that motor, too, and replaced it with a servo motor, which I could command to turn to an exact angle.
Next, I put several modules on a breadboard and put this on the frame.
The modules from top to bottom:
Dual Motor Driver
We are using the Polulu TB6612FNG breakout board. Fore more information, visit the product page.
A microcontroller board can control things with its pins, but these things must not draw much current. So, in case of motors, you need to add a motor driver board in-between which takes the commands from the microcontroller board and powers the motors with much more current. As a side effect, these boards allow you to turn a motor both ways.
We only need this board for the main motor and not for the steering, as servo motors already have the required driver right built in.
3.3 V + 5 V Step Up/Step Down boards
All modules we use need 3.3 V, with exception of the main motor, which uses the plain battery voltage, and the servo motor and the distance sensor, which both require 5 V.
The battery compartment holds 3 AA batteries which gives us 3.6 V – 4.5 V, so we cannot use the convenient voltage regulator of the neonious one which provides 3.3 V at 1000 mA, but needs between 4.5 V and 50 V as an input.
MPU-6050 gyroscope and accelerometer
u-blox NEO-6M GPS module
HC-SR04 distance sensors
These boards are actually not used in this project. I added them so I can write another blog entry later about the car driving autonomously around the neighborhood 🙂
How it was done: The software
(1) Installed the ws package for WebSockets from the npm package manager built into the neonious one IDE and changed the settings to make the neonious one provide its own access point.
You can find the code here: https://github.com/neonious/lowjs_esp32_examples/tree/master/neonious_one/cellphone_controlled_rc_car