ESP32 Based Tank Track Robot 

06/03/2023

Quite some time ago (2021) I added the Tank Track Chassis to my Christmas wish list.

A t that time it was selling for around $30.

It sat in its box for a couple of years until I needed something to drive with my new ESP32 

development board. 



The “Tank” style chassis is well made and the metal geared motors are great!

However, the treads are made from hard plastic, not rubber or silicone so they slip a lot on hard smooth surfaces but grip well on carpet. Code developed for running on a smooth hard floor didn’t work well when the bot was placed on a carpeted floor.  (disappointing)

 

Starting with the tank chassis base I added a motor driver board, a couple of slot interrupter sensors, an 11.1v LiPo battery, and ultrasonic rangefinder, the ESP32 breadboard with a speaker and assorted switches and connectors. 


The fun started when I blew up the driver board by accidentally hooking up the LiPo battery 

to it backwards. It blew the tops right off the two driver chips on the board.

(later I was able to get 10 replacement chips for around $3 so I can repeat that trick 4 more times)


After getting the motor drive stuff working acceptably, I looked into reading the wheel encoders. I was able to 3D print a nice, very thin plate that would fit between the motor and the frame. This had a small bracket that held the sensor nicely.

The encoder wheel design came from Thingiverse and is configurable.

https://www.thingiverse.com/thing:1147656



The ESP32 supports a pulse counting unit that’s pretty simple to set up.

Just a few lines of code (duplicated for the 2nd wheel) handled the counting of the pulses from the wheel sensors nicely.


I’m using sensors that I picked up many years ago from a website called “Electronic Goldmine” Sadly they no longer carry these and I haven't found anything like them elsewhere.

The slot sensor has the detector and emitter of course but also included the limiting resistor for the emitter LED and leads with a connector at the end.



Onward to the Bluetooth support. I had already experimented with this ESP32 functionality 

so it was a simple matter to re-use code and add a few tweaks to get what I needed. 


The ESP32 communicates with an app called Bluetooth Serial Terminal on my Android phone.

https://play.google.com/store/search?q=serial%20bluetooth%20terminal&c=apps


In Bluetooth Menu mode, the robot sends a menu of choices to the terminal and responds to commands entered from the terminal/phone app.


This is really handy for testing and debugging a moving object wirelessly.

I added code to find the nearest wall, approach within 20cm of the wall, turn 90 degrees

and follow the wall keeping within 15-25cm of the wall. 


Another mode also uses code borrowed from another robot project: 

The STM32 Stepperbot

In Bluetooth Joystick Mode, the robot can be driven around like an RC car via 

the Joystick app on my phone.


Arduino Bluetooth Controlled Joystick from Uncia Robotics

https://play.google.com/store/apps/details?id=uncia.robotics.joystick


Finally I added a small OLED display to indicate what mode the robot is in and optionally display debugging data.


I decided NOT to build a main board to hold the ESP32 Dev board but instead just stick with the solderless breadboard. I’ll probably not take this project much further since the tank tracks perform inconsistently.  



I’m attaching download links for the project code. Keep in mind that this is 

an eclipse project using the ESP32 IDF framework NOT Arduino code.

Amazon Ad for the chassis (from 12/2021 )

3D Printed Parts

Encoder wheel & sensor mounted

Blown Driver Board

Description of download links:
bt_trak_bot4.zip TrakBot4 eclipse project
TrakBot4_FollowWall.mp4 Video of robot finding & following a wall
TrakBot4_Schematic.pdf    Robot Schematic