Mini sumo robot
What you’ll build
A small autonomous robot for robot sumo: two robots start in a round ring (the dohyo) and each tries to push the other out. Black ring, white edge line.
Design for pushing
- Traction: soft, grippy tyres; all weight on the driven wheels. Robots can’t push harder than their grip allows.
- Low centre of gravity: heavy parts (batteries, motors) as low as possible.
- Wedge or scoop at the front to get under the opponent and lift it off its wheels.
- Gearing: strength over speed (higher gear ratio).
- Max weight: use the full weight allowance; mass helps pushing.
Sensors
| Sensor | Purpose |
|---|---|
| 2 × line sensors facing down at the front corners | See the white edge: don’t fall out |
| 1–2 distance sensors facing forward (ultrasonic or IR/ToF) | Find the opponent |
Strategy as a state machine
- WAIT: 5-second start delay (required by most rules).
- SEARCH: spin or arc until the opponent is seen.
- ATTACK: full speed at the opponent.
- ESCAPE: when a line sensor sees the white edge, reverse and turn. This always has top priority.
Sumo program (Arduino, state machine)
const int ENA = 5, IN1 = 7, IN2 = 8, ENB = 6, IN3 = 9, IN4 = 10;
void setMotor(int en, int a, int b, int speed) { // speed -255..255 digitalWrite(a, speed > 0); digitalWrite(b, speed < 0); analogWrite(en, min(abs(speed), 255));}
void drive(int left, int right) { setMotor(ENA, IN1, IN2, left); setMotor(ENB, IN3, IN4, right);}
void setupMotors() { int pins[] = {ENA, IN1, IN2, ENB, IN3, IN4}; for (int p : pins) pinMode(p, OUTPUT);}
const int EDGE_L = A0, EDGE_R = A1, TRIG = 3, ECHO = 2;enum State { SEARCH, ATTACK, ESCAPE };State state = SEARCH;unsigned long since = 0;
// Most modules read LOW over the white edge. Check yours with a test sketch first.bool edge() { return digitalRead(EDGE_L) == LOW || digitalRead(EDGE_R) == LOW; }
float readCm() { digitalWrite(TRIG, LOW); delayMicroseconds(2); digitalWrite(TRIG, HIGH); delayMicroseconds(10); digitalWrite(TRIG, LOW); long us = pulseIn(ECHO, HIGH, 12000); // short timeout: ~2 m max return us == 0 ? 999 : us * 0.0343 / 2;}
void setup() { setupMotors(); pinMode(EDGE_L, INPUT); pinMode(EDGE_R, INPUT); pinMode(TRIG, OUTPUT); pinMode(ECHO, INPUT); delay(5000); // required start delay}
void loop() { if (edge() && state != ESCAPE) { state = ESCAPE; since = millis(); }
switch (state) { case SEARCH: drive(120, -120); if (readCm() < 60) state = ATTACK; break; case ATTACK: drive(255, 255); if (readCm() > 70) state = SEARCH; break; case ESCAPE: drive(-200, -80); if (millis() - since > 500) state = SEARCH; break; }}Try it in the sumo ring
Robot commands
motors(left, right): wheel power, −100 to 100lineLeft(),lineRight():trueover the black linedistance(): cm to the nearest thing ahead (max 200)distanceLeft(),distanceRight(): cm to the sideslinePosition(): where the line is, −1 (left) to 1 (right), ornullmillis(): milliseconds since Runprint(value): show a message belowsetup()runs once;loop()runs 50 times a second
Faster winEasy
Tune the search spin speed and attack speed to find and push the opponent faster.
Smarter searchMedium
Instead of spinning on the spot, search in a wide arc so the robot covers more of the ring.
In the search branch use something like motors(60, 20): the robot drives in a circle, and the edge rule keeps it in the ring.
Design reviewHard
Sketch your mini sumo from the side and top. Label the wedge, wheels, battery position, sensors and where the centre of gravity is. Explain two design choices.
Quick check
Finished this lesson?