Introduction: Rolling Robot With ESP32 Thing and TB6612FNG Driver, Controlled by Android Over BLE

About: When not wielding a sword in Westeros I like making things with Raspberries, Arduinos and recently ESP32 things. More than that, I enjoy helping children and adults getting into this magical makers world.

Hello everyone

This is my first instructable. A rolling robot (nicknamed Raidho - from the rune that is associated with motion) based on ESP32 Thing, TB6612 FNG and BLE. One part that may seem peculiar is that the photos are not from the making procedure but from afterwards. The reason is that I decided to write this instructable after I had completed Raidho. I will try to compensate for it by making the description as detailed as possible. I re-used some things, I give the credits with respective links. Thank you very much for your work arduinofanboy, Vasilakis Michalis, pablopeza!

Step 1: Materials

  1. Robot Smart Car 2WD
  2. Sparkfun ESP32 Thing
  3. SparkFun Motor Driver - Dual TB6612FNG (with Headers)
  4. Polymer Lithium Ion Battery - 3.7v 850mAh (this battery had a 2.54 mm JST connector, whereas ESP32 Thing needs a 2 mm JST connector. If you find a battery with the proper JST connector, then you do not need material #6 below)
  5. Two switches
  6. JST-PH (2mm) female connector
  7. Cables

As well as

1. USB cable to program ESP32 Thing

2. Soldering set

Step 2: Robot Base Assembly

As stated before I have not kept photos from when I assembled the robot base.

You can follow a similar procedure from here (choose Robot Base tab). Robot bases come with some differences, but you get the main idea.

The steps are

1. Screw the DC motors. You could face a difficulty upon screwing the screw that is close to the base. But with a bit more effort everything is achieved!

2. Put the wheels.

3. Screw the third wheel.

4. Screw the battery case.

5. After assembling the robot base, you put the two switches. One for the motors battery and one for the ESP32 Thing battery.

Step 3: ESP32 Thing Pins Soldering

You solder pin ranges on the ESP32 Thing.

I soldered both of them, but as you can see, one could be enough because the used pins are all on the same side.

Step 4: Connecting TB6612FNG Driver to ESP32 Thing

TB6612FNG and ESP32 Thing pins are labelled. You just connect them with cables following this mapping.

GND --> GND

AIN1 --> 13

BIN1 --> 12

AIN2 --> 14

BIN2 --> 27

PWMA --> 26

PWMB --> 25

STBY --> 33

Step 5: Connecting TB6612FNG Driver With the DC Motors

After that, you connect TB6612FNG driver A01, A02, B01, B02 labeled pins to the motors.

You should make sure that A01 and A02 are connected to one motor and B01 and B02 to the other.

It is not crucial that you connect them "correctly", as long as you can revert this setting later on the sketch and interchange them.

Step 6: Connecting the Batteries Case With the TB6612FNG

You bring the battery case red cable to the switch.

From the switch to TB6612FNG Vm and Vcc.

You can follow this line with the numbers I put on the photos (1 to 5) :-)

You bring the battery case black cable to TB6612FNG GND.

Step 7: Connecting LiPo Battery to ESP32 Thing

You bring the battery red cable to the switch.

From the switch you bring to the JST connector left pin.

This is labeled as line 1-2-3-4 in the photo.

You bring the battery black cable to the JST connector right pin.

This is labeled as GND.

You connect JST connector on the ESP32 Thing.

(In my images you may get confused with the colours. The issue here is that the JST connector I bought had the red and the black cable "reverted" from what is needed for the ESP32 Thing.)

Step 8: Controller Sketch

This step and the next one were based on this article. Namely the sketch and the mobile application were based on this and modified accordingly so that instead of a LED, DC motors were utilized.

If your Arduino IDE is not ready you can follow these instructions to add ESP32 support on it

Most probably you do not have TB6612FNG for ESP32 library installed either. I found this one.

In raidho.ino file you may find the sketch you may write on ESP32 Thing.

For reference, the BLE commands are mapped like that

A --> front

B --> back

C --> right

D --> left

Step 9: Smartphone Application Installation

As in the previous step, I based my application on this one.

You can download the apk file and install it directly on your android or you can use the aia file and adapt it on www.thunkable.com

As always, when installing the APK file make sure to enable "installing from unknown sources" and of course don't forget to disable it afterwards.

Step 10: Real Action

You open the application.

It will ask you to open bluetooth.

You connect and you choose the device.

Then you press the arrow buttons.

In the attached video you may see Raidho in action.

Step 11: Epilogue

I tried to keep a balance between being more detailed when I thought it was needed but be less when I assumed that the information is already known or easily found so that this instructable does not get huge. If you believe some steps need more details, please advise so.

Of course any other feedback as well is welcome.

Have fun!