What it teaches
Six lessons in three chapters, for a learner who has met the TB6612 and the TCRT5000 (the line-following racer is a good start):
- Rules and the ring: the real mini-sumo rules (10 x 10 cm, 500 g, a 77 cm ring, three minute rounds, a five second start delay), a state machine that obeys them, and two edge sensors whose check beats everything else.
- Find and fight: the HC-SR04's 58 us per centimeter, ping timing and the pulseIn() timeout, a charge distance that fits the ring, a filter for a missed echo, and three search strategies with an opening move.
- Push and win: traction (mu x m x g) against motor torque in newtons, bigger wheels that make the robot torque limited, a tired pack, and the project: a charge distance, a round timer and a full rule-legal match.
Open it at /learn/path/build-sumo-robot.
The circuit
Mini-sumo robot: the gallery's sumo robot rebuilt on a TB6612FNG and a 2S 18650 pack, with a start button. The HC-SR04 is on pins 12 (TRIG) and 11 (ECHO), the left and right edge sensors on A0 and A1, the start button on pin 3, and the driver on pins 2 and 4 to 9.
It runs sumobrain, a state machine (WAIT, COUNTDOWN, SEARCH, CHARGE,
BACKOFF, TURN, DONE) that prints every change and why. Type test to start
without the countdown on the bench, or strategy spin, strategy turtle or
strategy arc.
You are the ring and the other robot
The simulator has no ring and no second robot. Drag the ultrasonic slider to put the other robot in front (in millimeters, 0 for nothing), and click an edge sensor's surface swatch to black when that corner reaches the border. The simulated ring is white with a black border; a real dohyo is black with a white border, which only flips HIGH and LOW in the code.
Troubleshooting
- Nothing happens: press the start button, or type
test. The robot waits five seconds once the start delay is set to the rule. - It will not charge: the opponent must be closer than
CHARGE_CM(or 20 cm in the turtle strategy). - It keeps backing off: an edge sensor is still set to black. Set it back to white.