Programmable Robot Car

on

One of the things I really enjoy is connecting the software world with the physical world. Recently, I decided to build my microcontroller skills and build a robot car for my kids to play with. I started by ordering parts from AliExpress, an online marketplace where you can find all kinds of electronic components at great prices.

The robot car is based on an ESP32 microcontroller, which controls four motorized wheels. The ESP32 is a powerful and versatile microcontroller that can be programmed to perform a wide range of tasks. To control the car, the “user” (me or my kids) adds some instructions in a file on Pastebin.com, a very simple web-based text storage service, which the car then executes. The instructions are simple — like “go_foward 600” to turn the wheels on for 600ms.

A first version of the car, connected to an earlier microcontroller (ESP8266)

The first step in building the robot car was to assemble the chassis. I started by ordering four motors that came with wheels, and then cut a “frame” (just a square of plywood) out of some scrap 1/4in plywood that I had in my shop. I hot-glued the motors to the frame, and then connected them to the ESP32 with some spare wire. I used a breadboard and jumper wires to connect the microcontroller to the wheels, and also added a battery pack to power the car. I then wrote a very simple program to turn the wheels on and off to make sure it all worked.

The next step was to write the program that would control the car. I used the Arduino IDE, an open-source software development environment, to write the code. The program reads commands from a Pastebin file and uses them to control the speed and direction of the wheels. I also added a few commands, such as “right_turn” and “go_backward”, which cause the car to react according.

Once the program was complete, I uploaded it to the ESP32 microcontroller using a USB cable. I then turned on the car and watched as it sprang to life, executing the commands that my kids had input on the iPad. We had a lot of fun building courses for the car to navigate based on the commands we input.

This project continues to evolve! Since the first round, I’ve bought some sonar proximity sensors, camera modules, and arcade buttons. There are a few potential next directions — I could either build a controller to live control it, or I could use the camera and OpenCV to train a computer vision model and have the car follow a chalk line on the sidewalk. We’ll see!

Fun fact: the first draft of this post was written by ChatGPT. I trained it on my previous posts, and then edited a few of the parts with more specific details. Fun times we live in!

Leave a Reply

Your email address will not be published. Required fields are marked *