8.3. Implementation

This section of the book presents the core code which implements the CellBot’s ability to connect a smart device to the mobile base and to access sensors on a smart device. It consists of three components:

It also contains files used to create this book.

8.3.1. To do

  • Write up basic hardware connection instructions, software install to do ESP32 development if desired.

  • Add a 10 uF cap between EN and GND to avoid flaky reprogramming.

  • Provide some kind of version/CPU info, so we could talk to an older version of the code or to other types of chip.

  • Fix the reset function to actually reset all pins.

  • Include a disconnect function so that everything will be turned off after “running” a Python program.

  • Find a cheaper ESP32 – some possibilities at https://makeradvisor.com/esp32-development-boards-review-comparison/.

  • Put the ESP32 to sleep when not paired or no BLE running.

8.3.2. Hardware

This gives one realization of a CellBot; however, it can easily support a wide variety of motors and be equipped with additional sensors and actuators. Bill of Materials





Price (USD)




Battery Holder 4xAA with Cover and Switch





Hobby Gearmotor - 65 RPM (Right Angle, Pair)





Wheel - 65mm (Rubber Tire, Pair)





SparkFun Motor Driver - Dual TB6612FNG (with Headers)





Jumper Wire Kit - 140pcs





400 point solderless breadboard, pack of 3





HiLetgo ESP-WROOM-32 Development Board 2.4GHz



Includes 3 breadboards; need only 1. No quantity discounts.

$38.99 Design notes

The design presented here is driven by cost and simplicity. Other technical considerations: Battery voltage

At the heart of the design is an ESP32-WROOM-32D. This development kit contains an AMS1117-3.3 linear regulator, so its minimum input voltage is 3.3 V + Vdrop, the dropout voltage, where Vdrop = 1.5 V at 1 A. Therefore, the minimum allowable battery voltage is 4.7 V. The recommended maximum input voltage to the AMS1117 is 18 V, which defines the maximum battery voltage for the ESP32.

The DC motors must operate within the provided battery voltage as well. The motors selected above operate between 3 V - 6 V.

Finally, the TB6612FNG motor drivers allow a motor voltage (VM) from 2.5 V to 13.5 V.

Combining all three ranges (4.7 V - 18 V, 3 V - 6 V, and 2.5 V - 13.5 V) gives an allowable range of 4.7 V - 6 V for the batteries. Other notes

While many motor drivers (also termed an H-bridge) exist, the TB6612FNG is one of the few that operates at a logic supply voltage (VCC) of 3.3 V. Since the ESP32 development kit already provides 3.3 V, this voltage drives the selection of a motor driver. For example, the LM298N provides higher drive current, a wider range of motor voltages, and a sense output to allow determination of the drive current (a very nice feature). However, its minimum VCC is 4.5 V.

With a wheel diameter of 65 mm and a no-load speed of 65 RPM for the motors, this robot’s max speed is π·65 mm·65 RPM·1 min/60 sec = 0.2 m/s, compared to a typical walking speed of 1.4 m/s.

8.3.3. Firmware

You have attempted of activities on this page