Encoder Mobile Robot
Required setup: smabo-app + smabo-esp32
Roadmap
Section titled “Roadmap”This page is the guide for the 'Encoder Mobile Robot' node on the roadmap below.
This guide assumes you have completed the Mobile Robot guide.
Overview
Section titled “Overview”This page explains how to implement the "Encoder Mobile Robot" feature.
Specifically, you will:
- Estimate the distance traveled with encoder DC motors (odometry)
Required Parts
Section titled “Required Parts”In addition to the parts from Mobile Robot, you need the following.
| Part | Example (Japanese shop) | Notes |
|---|---|---|
| Hobby metal gearmotor with encoder (DG01D-E) | link | Used instead of the TT motors from "Mobile Robot" (2 pcs) |
3D Printing Parts
Section titled “3D Printing Parts”Print the newly added parts on your 3D printer.
Because slicer software varies by printer model, only key points are noted here rather than step-by-step slicer instructions.
Print the following parts oriented as shown in the images.
- smabo-hardware/stl/mobile_robot/DG01D-E/DG1D-E_bottom.stl

- smabo-hardware/stl/mobile_robot/DG01D-E/DG01D-E_stopper1_L.stl

- smabo-hardware/stl/mobile_robot/DG01D-E/DG01D-E_stopper1_R.stl

- smabo-hardware/stl/mobile_robot/DG01D-E/DG01D-E_stopper2_LR.stl

Assembly
Section titled “Assembly”Assemble the required parts as shown in the video below.
Note: the video also includes parts printed in previous steps.
Wiring
Section titled “Wiring”Wire according to the tables below.
In the tables below, "Point A" and "Point B" are directly connected in the circuit.
Battery
Section titled “Battery”| Point A | Point B | Notes |
|---|---|---|
| Battery box (+) | Breadboard + rail (right side) | From here on, the right side is the 6 V rail |
| Battery box (-) | Breadboard - rail | - |
| Point A | Point B | Notes |
|---|---|---|
| ESP32 3.3V | Breadboard + rail (left side) | From here on, the left side is the 3.3 V rail |
| ESP32 GND | Breadboard - rail | - |
TB6612FNG
Section titled “TB6612FNG”| Point A | Point B | Notes |
|---|---|---|
| TB6612FNG PWMA | ESP32 pin set in config.json dc/pins/pwma |
Default pins: - config.esp32-classic.json: GPIO 32 - config.esp32s3-devkitc1.json: GPIO 4 |
| TB6612FNG AIN2 | ESP32 pin set in config.json dc/pins/ain2 |
Default pins: - config.esp32-classic.json: GPIO 33 - config.esp32s3-devkitc1.json: GPIO 5 |
| TB6612FNG AIN1 | ESP32 pin set in config.json dc/pins/ain1 |
Default pins: - config.esp32-classic.json: GPIO 25 - config.esp32s3-devkitc1.json: GPIO 6 |
| TB6612FNG STBY | ESP32 pin set in config.json dc/pins/stby |
Default pins: - config.esp32-classic.json: GPIO 26 - config.esp32s3-devkitc1.json: GPIO 7 |
| TB6612FNG BIN1 | ESP32 pin set in config.json dc/pins/bin1 |
Default pins: - config.esp32-classic.json: GPIO 27 - config.esp32s3-devkitc1.json: GPIO 15 |
| TB6612FNG BIN2 | ESP32 pin set in config.json dc/pins/bin2 |
Default pins: - config.esp32-classic.json: GPIO 14 - config.esp32s3-devkitc1.json: GPIO 16 |
| TB6612FNG PWMB | ESP32 pin set in config.json dc/pins/pwmb |
Default pins: - config.esp32-classic.json: GPIO 12 - config.esp32s3-devkitc1.json: GPIO 17 |
| TB6612FNG VM | Breadboard + rail (right side) | Motor power (6 V) |
| TB6612FNG VCC | Breadboard + rail (left side) | Logic power (3.3 V) |
| TB6612FNG GND | Breadboard - rail | The TB6612FNG has three GND pins; connect all of them to the breadboard's - rail |
DG01D-E
Section titled “DG01D-E”| Point A | Point B | Notes |
|---|---|---|
| DG01D-E (left wheel) G | Breadboard - rail | - |
| DG01D-E (left wheel) H1 | ESP32 pin set in config.json encoder/left/b |
Default pins: - config.esp32-classic.json: GPIO 21 - config.esp32s3-devkitc1.json: GPIO 42 |
| DG01D-E (left wheel) H2 | ESP32 pin set in config.json encoder/left/a |
Default pins: - config.esp32-classic.json: GPIO 19 - config.esp32s3-devkitc1.json: GPIO 41 |
| DG01D-E (left wheel) V | Breadboard + rail (left side) | Encoder power (3.3 V); H1 and H2 also use this voltage |
| DG01D-E (left wheel) M+ | TB6612FNG A02 | - |
| DG01D-E (left wheel) M- | TB6612FNG A01 | - |
| DG01D-E (right wheel) G | Breadboard - rail | - |
| DG01D-E (right wheel) H1 | ESP32 pin set in config.json encoder/right/a |
Default pins: - config.esp32-classic.json: GPIO 22 - config.esp32s3-devkitc1.json: GPIO 2 |
| DG01D-E (right wheel) H2 | ESP32 pin set in config.json encoder/right/b |
Default pins: - config.esp32-classic.json: GPIO 23 - config.esp32s3-devkitc1.json: GPIO 1 |
| DG01D-E (right wheel) V | Breadboard + rail (left side) | Encoder power (3.3 V); H1 and H2 also use this voltage |
| DG01D-E (right wheel) M+ | TB6612FNG B02 | - |
| DG01D-E (right wheel) M- | TB6612FNG B01 | - |
The wiring diagram for the ESP32-DevKitC (with the defaults in config.esp32-classic.json) is shown below.

Finished Result
Section titled “Finished Result”The completed robot looks like this.

Operation
Section titled “Operation”Check that everything works with the steps below.
Startup Procedure
Section titled “Startup Procedure”Follow the startup procedure here.
Then open the 'Config' tab in smabo-web.
Enabling Encoder Drive
Section titled “Enabling Encoder Drive”In the 'Config' tab of smabo-web, enable:
- 'dc_drive', and
- 'encoder' inside 'dc_drive'

Checking It Works
Section titled “Checking It Works”In the 'Drive' tab, drive smabo with the controller. It works if:
- the 'Position' values and the track in the 'Trail Map' change to follow smabo's actual position

Next, the following node on the roadmap is explained: