Community project

Autonomous Sumobot Challenger

Photo of Autonomous Sumobot Challenger
Generated with AI

Henry jr Lompot

Published November 27, 2026

The Autonomous Sumobot Challenger is a compact robot designed to compete in sumo ring competitions using an ESP32 microcontroller as its brain. Powered by a protected 2S 18650 battery pack and equipped with dual TT motors, ultrasonic distance sensing, and infrared line tracking, this bot autonomously detects opponents and ring edges while executing strategic movement patterns.

This guide provides a complete wiring diagram, parts list, and step-by-step assembly instructions for building a fully functional sumobot. You'll learn how to set up protected power distribution with dual voltage regulators, configure the TB6612FNG motor driver with I2C port expansion, integrate sensor feedback, and upload the autonomous control firmware that handles obstacle detection, edge avoidance, and combat logic.

Wiring diagram

Wiring diagram for Autonomous Sumobot Challenger
Loading diagram…

Gather all the parts

QtyComponent
1

Protected balanced 2S 18650 pack, 2600mAh

Factory assembled matched 18650 cells, integrated balancing BMS with overcharge, undervoltage and short protection; rated at least 5A. Charge disconnected using an 8.4V CC/CV charger. Raw cell negative is not system ground: use protected P-.

1

3A fuse in insulated inline holder

Battery positive protection; rated at least 12V DC.

1

SPST toggle, 5A at 12V DC

Main mechanical power disconnect.

1

Mini360 adjusted to 5.0V

4.75–23V input; logic supply only. Set output with meter before attaching loads.

1

24v Buck Converter

4.5V output; verified 2A continuous module

LM2596-based adjustable step-down buck converter module. Commonly used to regulate a higher battery rail, such as a 2S 18650 pack, down to 5V for Arduino logic. It is a regulator, not a charger or battery protection board.

1

1N5819 Schottky diode

1A 40V diode; band marks cathode K to XIAO 5V.

1

TB6612FNG dual motor driver module

Catalog TB6612FNG module with complete motor output pin names. STBY high enables; pull down for startup safety. 1.2A average per channel; selected motors about 0.8A stall at 4.5V, verify each sample.

1

MCP23017 28-pin DIP

MCP23017 catalog device with individual port pins; address 0x20. DIP pins: GPA0–6=21–27, VDD=9 VSS=10 SCL=12 SDA=13 A0=15 A1=16 A2=17 RESET=18. Unused ports left open.

1

TT Motor Bi-Metal Gearbox - 1:90 Gear Ratio

TT-format bi-metal DC gearbox motor with a 1:90 reduction ratio - roughly double the torque and half the speed of the more common 1:48 TT motor. Runs on 3-6VDC (60-120 RPM no-load depending on voltage), has steel output gears for durability, and is one of several TT-motor gearbox ratios (1:48, 1:90, 1:120) used across 2WD/4WD robot car and crawler chassis kits, this one favoring torque/climbing over speed. Ships with no wires attached and cannot be driven directly from a microcontroller pin; requires a separate high-current motor driver such as a DRV8833 or TB6612FNG.

1

TT Motor Bi-Metal Gearbox - 1:90 Gear Ratio

TT-format bi-metal DC gearbox motor with a 1:90 reduction ratio - roughly double the torque and half the speed of the more common 1:48 TT motor. Runs on 3-6VDC (60-120 RPM no-load depending on voltage), has steel output gears for durability, and is one of several TT-motor gearbox ratios (1:48, 1:90, 1:120) used across 2WD/4WD robot car and crawler chassis kits, this one favoring torque/climbing over speed. Ships with no wires attached and cannot be driven directly from a microcontroller pin; requires a separate high-current motor driver such as a DRV8833 or TB6612FNG.

1

HC-SR04

HC-SR04 ultrasonic distance sensor module with separate 40 kHz transmitter and receiver transducers, measuring 2 to 400 cm. A 10 us pulse on TRIG starts a measurement and ECHO stays high for the echo's round-trip time. This HC-SR04+ board runs from 3.3 V or 5 V.

1

TCRT5000 IR Line Tracking Sensor Module

3-pin digital module; DO is OUT, no AO used

Single-channel infrared reflective sensor module built around the Vishay TCRT5000 IR emitter/phototransistor pair. An onboard LM393 comparator with a sensitivity trim-pot drives a thresholded digital output (DO) for line-detection or obstacle-avoidance, while a separate analog pin (AO) exposes the raw reflected-IR reading. Runs on 3.3V-5V, senses reflective surfaces roughly 1-25mm away, and is the standard low-cost sensor on line-following and obstacle-avoiding robot kits. Sold as a generic 4-pin (VCC/GND/DO/AO) breakout under many brand names (HiLetgo, ACEIRMC, OSOYOO, etc.) rather than by a single official manufacturer.

1

TCRT5000 IR Line Tracking Sensor Module

3-pin digital module; DO is OUT, no AO used

Single-channel infrared reflective sensor module built around the Vishay TCRT5000 IR emitter/phototransistor pair. An onboard LM393 comparator with a sensitivity trim-pot drives a thresholded digital output (DO) for line-detection or obstacle-avoidance, while a separate analog pin (AO) exposes the raw reflected-IR reading. Runs on 3.3V-5V, senses reflective surfaces roughly 1-25mm away, and is the standard low-cost sensor on line-following and obstacle-avoiding robot kits. Sold as a generic 4-pin (VCC/GND/DO/AO) breakout under many brand names (HiLetgo, ACEIRMC, OSOYOO, etc.) rather than by a single official manufacturer.

1

Push Button

Momentary push button switch

1

Resistor

1kΩ 1%

Through-hole resistor (current-limiting in series with an LED)

1

Resistor

2kΩ 1%

Through-hole resistor (current-limiting in series with an LED)

1

Resistor

4.7kΩ

Through-hole resistor (current-limiting in series with an LED)

1

Resistor

4.7kΩ

Through-hole resistor (current-limiting in series with an LED)

1

Resistor

10kΩ

Through-hole resistor (current-limiting in series with an LED)

1

Resistor

10kΩ

Through-hole resistor (current-limiting in series with an LED)

1

Electrolytic Capacitor

100µF 16V

Radial aluminium electrolytic capacitor bought by value and voltage rating, such as 10 µF, 100 µF or 1000 µF 10 V. It is polarised: the + lead goes to the higher voltage and the - lead, marked by the stripe on the sleeve, to the lower voltage or ground. It is mostly used for bulk filtering across a power rail, with a voltage rating comfortably above the rail.

1

Ceramic Capacitor

100nF ceramic

Through-hole ceramic capacitor bought by value, such as 22 pF, 10 nF or 100 nF (0.1 µF). It is non-polarised, so either lead can go to either net. Its most common job is decoupling: a 100 nF capacitor between an IC's supply pin and ground, placed as close to the chip as possible.

1

Ceramic Capacitor

100nF ceramic

Through-hole ceramic capacitor bought by value, such as 22 pF, 10 nF or 100 nF (0.1 µF). It is non-polarised, so either lead can go to either net. Its most common job is decoupling: a 100 nF capacitor between an IC's supply pin and ground, placed as close to the chip as possible.

1

Ceramic Capacitor

100nF ceramic

Through-hole ceramic capacitor bought by value, such as 22 pF, 10 nF or 100 nF (0.1 µF). It is non-polarised, so either lead can go to either net. Its most common job is decoupling: a 100 nF capacitor between an IC's supply pin and ground, placed as close to the chip as possible.

1

Ceramic Capacitor

100nF ceramic

Through-hole ceramic capacitor bought by value, such as 22 pF, 10 nF or 100 nF (0.1 µF). It is non-polarised, so either lead can go to either net. Its most common job is decoupling: a 100 nF capacitor between an IC's supply pin and ground, placed as close to the chip as possible.

1

Ceramic Capacitor

100nF ceramic

Through-hole ceramic capacitor bought by value, such as 22 pF, 10 nF or 100 nF (0.1 µF). It is non-polarised, so either lead can go to either net. Its most common job is decoupling: a 100 nF capacitor between an IC's supply pin and ground, placed as close to the chip as possible.

Assemble it in 7 steps

1. Lay out the robot electronics

Put the protected battery, fuse, switch, Mini360, motor buck and diode on the left; XIAO and MCP23017 in the center; sonar at the front/top, IR sensors at the front corners/bottom, and TB6612 plus motors on the right. Labels in the circuit identify 2S BAT (7.4V nominal, 8.4V maximum), +5V, +4.5V_VM, 3V3 and GND.

2. Build protected power distribution

With the pack unplugged, connect P+ through the 3A fuse and SPST toggle to both regulator inputs. Connect P- to the shared GND. Use insulated soldered connections and short power wires rated at least 5A; do not route motor current through a breadboard or XIAO. Return driver and regulators directly to P-; run a separate logic ground branch.

  • Buy a factory-built protected and balanced 2S 18650 pack rated at least 5A. Do not solder directly onto loose cells. Never connect 8.4V to the XIAO BAT pads.
  • Disconnect the pack from the robot to charge with a compatible 8.4V CC/CV lithium-ion charger. BMS protection is not a charger.

3. Adjust and check both regulators

Before attaching electronics, use a meter to adjust Mini360 to 5.00V and the LM2596 motor module to 4.50V. Use a motor regulator module verified for 2A continuous operation with suitable cooling. Stop using the robot when either regulated rail drops out; the BMS cutoff is emergency protection, not a normal stopping point. Connect the diode banded end to XIAO 5V and its other end to Mini360 OUT+.

  • Verify voltages under load and at low battery voltage. Mini360 performance varies between clones.
  • Switch off and unplug the battery before USB deployment. Never use the 5V logic regulator to power motors.

4. Wire motor protection and standby

Connect driver VM to regulated 4.5V, VCC to XIAO 3V3 and GND to shared GND. Place the 100µF capacitor close to VM/GND, positive to VM. Place 100nF at driver VCC/GND and one 100nF across each motor's terminals. Connect STBY to D10 and a 10kΩ resistor to GND so motors remain disabled during reset. Connect motor terminals to AO1/AO2 and BO1/BO2.

  • Selected 1:90 bi-metal TT motors measure about 0.8A stalled at 4.5V. Measure your samples; reject motors exceeding the driver continuous rating. Avoid sustained stalls and validate temperatures before competition.

5. Connect extra control pins

Use MCP23017 DIP pins 9=3V3, 10=GND, 12=SCL to D5, 13=SDA to D4, 15/16/17=GND for address 0x20, 18=RESET through 10kΩ to 3V3. Put a 4.7kΩ resistor from each I2C line to 3V3. GPA0..3 (pins 21..24) connect AIN1, AIN2, BIN1, BIN2. GPA4/5 (pins 25/26) read left/right IR OUT. GPA6 (pin 27) reads the start button; its other leg goes to GND. Leave unused GPIO and interrupt pins open. Place 100nF at VDD/VSS and another at XIAO 3V3/GND. D1 and D2 drive PWMA and PWMB. D0, D8, D9, D6 and D7 are unused.

6. Connect the sensors

Power both IR modules at 3.3V; OUT is called DO on the diagram. Power HC-SR04 at 5V and connect TRIG to MCP23017 GPA7 (DIP pin 28, 3.3V TTL trigger). ECHO goes through 1kΩ to the junction connected to D3; 2kΩ goes from that junction to GND. This reduces a 5V echo to about 3.33V. Mount the IR sensors a few millimeters above the floor, ahead of the wheels.

7. Test before entering the ring

Lift the wheels. Check that both wheels drive forward; swap a motor's two leads with power removed if reversed. With robot stopped, inspect serial edge readings over the actual black ring and white border. Adjust both sensor pots: readings must report 0 on black and 1 on white. If necessary change EDGE_LEVEL in firmware. Press start for a five-second countdown; pressing again stops. Confirm border retreat, obstacle pursuit, and switch shutdown. Check total assembled mass is below 1kg and follow your competition's start rules.

  • This is a buildable reference design, not a certified production product. Validate stall current, battery protection, regulator loading, sensor response and thermal behavior on the assembled robot before arena use.

Review all connections

1. Connections between "battery" and "ESP32"

FunctionbatteryESP32
powerP+ → 3A fuse in insulated inline holder INEXT
groundP-GND

2. Connections between "fuse" and "ESP32"

FunctionfuseESP32
powerOUT → SPST toggle, 5A at 12V DC INEXT

3. Connections between "switch" and "ESP32"

FunctionswitchESP32
powerOUT7.4V

4. Connections between "logicbuck" and "ESP32"

FunctionlogicbuckESP32
powerIN+ → SPST toggle, 5A at 12V DC OUTEXT
powerOUT+5V
powerOUT+ → HC-SR04 VCCEXT
powerOUT+ → 1N5819 Schottky diode AEXT
groundIN-GND
groundOUT-GND

5. Connections between "motorbuck" and "ESP32"

FunctionmotorbuckESP32
powerVIN+ → SPST toggle, 5A at 12V DC OUTEXT
powerVOUT+4.5V
powerVOUT+ → TB6612FNG dual motor driver module VMEXT
groundVIN-GND
groundVOUT-GND

6. Connections between "diode" and "ESP32"

FunctiondiodeESP32
powerK5V

7. Connections between "bulk" and "ESP32"

FunctionbulkESP32
power+ → TB6612FNG dual motor driver module VMEXT
ground-GND

8. Connections between "driver" and "ESP32"

FunctiondriverESP32
groundGNDGND
powerVCC3V3
pwmPWMAGPIO 3
pwmPWMBGPIO 4
digitalSTBYGPIO 10
digitalAO1 → TT Motor Bi-Metal Gearbox - 1:90 Gear Ratio M1EXT
digitalAO2 → TT Motor Bi-Metal Gearbox - 1:90 Gear Ratio M2EXT
digitalBO1 → TT Motor Bi-Metal Gearbox - 1:90 Gear Ratio M1EXT
digitalBO2 → TT Motor Bi-Metal Gearbox - 1:90 Gear Ratio M2EXT

9. Connections between "sonar" and "ESP32"

FunctionsonarESP32
groundGNDGND
digitalECHO → Resistor P1EXT

10. Connections between "leftir" and "ESP32"

FunctionleftirESP32
groundGNDGND
powerVCC3V3
digitalDO → MCP23017 28-pin DIP GPA4EXT

11. Connections between "rightir" and "ESP32"

FunctionrightirESP32
groundGNDGND
powerVCC3V3
digitalDO → MCP23017 28-pin DIP GPA5EXT

12. Connections between "io" and "ESP32"

FunctionioESP32
groundVSSGND
groundA0GND
groundA1GND
groundA2GND
powerVDD3V3
i2cSDAGPIO 6
i2cSCLGPIO 7
digitalGPA7 → HC-SR04 TRIGEXT
digitalGPA0 → TB6612FNG dual motor driver module AIN1EXT
digitalGPA1 → TB6612FNG dual motor driver module AIN2EXT
digitalGPA2 → TB6612FNG dual motor driver module BIN1EXT
digitalGPA3 → TB6612FNG dual motor driver module BIN2EXT

13. Connections between "start" and "ESP32"

FunctionstartESP32
groundGNDGND
digitalSIGNAL → MCP23017 28-pin DIP GPA6EXT

14. Connections between "echoBottom" and "ESP32"

FunctionechoBottomESP32
groundP2GND
digitalP1 → Resistor P2EXT

15. Connections between "standbyPull" and "ESP32"

FunctionstandbyPullESP32
groundP2GND
digitalP1 → TB6612FNG dual motor driver module STBYEXT

16. Connections between "sdaPull" and "ESP32"

FunctionsdaPullESP32
powerP13V3
digitalP2 → MCP23017 28-pin DIP SDAEXT

17. Connections between "sclPull" and "ESP32"

FunctionsclPullESP32
powerP13V3
digitalP2 → MCP23017 28-pin DIP SCLEXT

18. Connections between "resetPull" and "ESP32"

FunctionresetPullESP32
powerP13V3
digitalP2 → MCP23017 28-pin DIP RESETEXT

19. Connections between "echoTop" and "ESP32"

FunctionechoTopESP32
digitalP2GPIO 5

20. Connections between "logicCap" and "ESP32"

FunctionlogicCapESP32
power13V3
ground2GND

21. Connections between "ioCap" and "ESP32"

FunctionioCapESP32
digital1 → MCP23017 28-pin DIP VDDEXT
digital2 → MCP23017 28-pin DIP VSSEXT

22. Connections between "driverCap" and "ESP32"

FunctiondriverCapESP32
digital1 → TB6612FNG dual motor driver module VCCEXT
digital2 → TB6612FNG dual motor driver module GNDEXT

23. Connections between "leftmotorCap" and "ESP32"

FunctionleftmotorCapESP32
digital1 → TT Motor Bi-Metal Gearbox - 1:90 Gear Ratio M1EXT
digital2 → TT Motor Bi-Metal Gearbox - 1:90 Gear Ratio M2EXT

24. Connections between "rightmotorCap" and "ESP32"

FunctionrightmotorCapESP32
digital1 → TT Motor Bi-Metal Gearbox - 1:90 Gear Ratio M1EXT
digital2 → TT Motor Bi-Metal Gearbox - 1:90 Gear Ratio M2EXT

Deploy the firmware

#include <Arduino.h>
#include <Wire.h>
#include <Adafruit_MCP23X17.h>
Adafruit_MCP23X17 io;
constexpr int PWM_L=3,PWM_R=4,ENABLE=10,ECHO=5;
// Verify white-border polarity on your actual modules before arena operation.
constexpr int EDGE_LEVEL=HIGH;
bool ready=false,active=false,lastButton=false;
uint32_t startAt=0,phaseAt=0,lastPing=0,lastPress=0;
int phase=0,turn=1,distanceCm=0;
void stop(){digitalWrite(ENABLE,LOW);analogWrite(PWM_L,0);analogWrite(PWM_R,0);}
void drive(int l,int r){
 digitalWrite(ENABLE,LOW);analogWrite(PWM_L,0);analogWrite(PWM_R,0);
 uint8_t bits=(l>0?1:l<0?2:0)|(r>0?4:r<0?8:0);
 io.writeGPIOA(bits); // Input pins GPA4..6 retain pull-ups configured below.
 analogWrite(PWM_L,abs(l));analogWrite(PWM_R,abs(r));digitalWrite(ENABLE,HIGH);
}
void setup(){
 pinMode(ENABLE,OUTPUT);stop();pinMode(PWM_L,OUTPUT);pinMode(PWM_R,OUTPUT);
 pinMode(ECHO,INPUT);
 Serial.begin(115200);Wire.begin(6,7);Wire.setClock(400000);Wire.setTimeOut(10);
 if(!io.begin_I2C(0x20,&Wire)){Serial.println("STOP: expander missing");return;}
 for(int i=0;i<4;i++){io.digitalWrite(i,LOW);io.pinMode(i,OUTPUT);}
 for(int i=4;i<=6;i++)io.pinMode(i,INPUT_PULLUP);
 io.digitalWrite(7,LOW);io.pinMode(7,OUTPUT);ready=true;Serial.println("Stopped. Verify edges, then press start. Five second delay.");
}
void loop(){
 if(!ready){stop();delay(20);return;}
 Wire.beginTransmission(0x20);if(Wire.endTransmission()!=0){stop();active=false;delay(20);return;}
 uint8_t inputs=io.readGPIOA();
 bool left=((inputs>>4)&1)==EDGE_LEVEL,right=((inputs>>5)&1)==EDGE_LEVEL;
 bool button=!(inputs&(1<<6));uint32_t now=millis();
 if(button&&!lastButton&&now-lastPress>250){lastPress=now;active=!active;startAt=now;phase=0;stop();}
 lastButton=button;
 if(!active){stop();static uint32_t printed=0;if(now-printed>500){printed=now;Serial.printf("Edge L=%d R=%d (must be 0 on black, 1 on white)\n",left,right);}delay(3);return;}
 if(now-startAt<5000){stop();delay(3);return;}
 if(phase==0&&(left||right)){turn=left?1:-1;phase=1;phaseAt=now;drive(-170,-170);}
 if(phase==1){if(now-phaseAt<220){delay(2);return;}phase=2;phaseAt=now;drive(170*turn,-170*turn);}
 if(phase==2){if(now-phaseAt<250){delay(2);return;}phase=0;}
 if(left||right){drive(-170,-170);return;}
 if(now-lastPing>=60){lastPing=now;io.digitalWrite(7,HIGH);delayMicroseconds(10);io.digitalWrite(7,LOW);unsigned long us=pulseIn(ECHO,HIGH,6000);distanceCm=us?us/58:0;}
 if(distanceCm>=2&&distanceCm<60)drive(220,220);else drive(130,-130);
 delay(2);
}

Remix this project

Make it yours in one click

Open a full copy of this project in your own Schematik workspace, diagram, code, parts, and assembly steps included. Swap the sensor, add features, or redesign the whole thing with AI. The author's original stays untouched.

Open in Schematik