Projects / Mini sumo robot

Mini sumo robot

Intermediate4 hGuided buildReviewed

Build it step by step

0 of 7 done
  1. NANO

    Build the chassis

    Low, with a front blade.

  2. NANO

    Test the motors

    Each direction, low speed.

  3. NANOSHARP43 cm

    Read the Sharp sensors

    Note the values at 10 and 30 cm.

  4. NANO

    Read the edge sensors

    On black and white.

  5. NANO

    Set the thresholds

    In the sketch.

  6. NANO

    Test in a ring

    Start with the 5 second delay.

  7. NANO

    Tune the turns

    Backing time and angle.

In short

How do you build a mini sumo robot?

A small, heavy robot finds its opponent with IR distance sensors and pushes it out of the ring without leaving the ring itself. You need Arduino Nano, Sharp GP2Y0A21YK0F IR distance sensor × 2, TCRT5000 IR reflective sensor module × 2, TB6612FNG Motor Driver, N20 micro metal gear motor × 2, Li-Po 2S 7.4 V 2200 mAh 25C (RC), Tactile push button 6 mm and Mini-360 buck converter. It takes 7 steps and about 240 minutes.

Level
Intermediate
Time
About 240 min
Parts
8

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
Sharp sensor left and right outputsNano A0 and A1Opponent distance
Edge sensor left and right outputsNano A2 and A3White border detection
Sharp and edge sensors VCC and GNDNano 5V and GNDPower
TB6612 AIN1, AIN2, PWMANano D4, D5, D3Left motor
TB6612 BIN1, BIN2, PWMBNano D7, D8, D6Right motor
TB6612 STBYNano D9High to enable
TB6612 VM and GNDLiPo plus and minusMotor power (7.4 V)
Mini-360 OUT (set to 5.0 V first)Nano 5V pin and GNDLogic power
Start buttonNano D2 and GNDStarts the countdown (internal pull-up)

Code

Sumo is a simple idea with a fast state machine: stay inside the white border, find the opponent, push. Edge sensors have the highest priority, so whenever one sees white the robot backs up and turns, and only if both are clear does it look for the opponent with the two Sharp distance sensors. The Sharp output rises when something is near, and the 300 threshold is only a starting guess, so print the readings with a hand and a box at known distances and set your own. Mini sumo rules limit size and weight and require a delay of five seconds after the start, so check your competition's rule book; the sketch waits on the button then counts down. Keep the electronics low and the wheels high-grip, because pushing power is mostly weight and traction. LiPo safety: use a balance charger, never charge unattended, never run the pack flat, and keep the robot off the table edge during tests by testing in a ring. Keep fingers clear of the wheels. Arduino IDE, board "Arduino Nano" (try the Old Bootloader option if the upload fails).

Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

// Mini sumo: wait 5 s after the button, then search, charge and stay inside the white border line.
// Board: Arduino Nano. Dark ring floor: edge sensors read HIGH on the white border with most TCRT modules; check yours.
const uint8_t AIN1 = 4, AIN2 = 5, PWMA = 3, BIN1 = 7, BIN2 = 8, PWMB = 6, STBY = 9, BTN = 2;
const int SEE = 300;                      // Sharp reading that means an opponent is near (about 30 cm); check yours
const int EDGE = 500;                     // edge sensor reading that means white border
const int SPEED = 200;
void motor(int l, int r) {                 // negative is reverse
  digitalWrite(AIN1, l >= 0); digitalWrite(AIN2, l < 0); analogWrite(PWMA, constrain(abs(l), 0, 255));
  digitalWrite(BIN1, r >= 0); digitalWrite(BIN2, r < 0); analogWrite(PWMB, constrain(abs(r), 0, 255));
}
void setup() {
  pinMode(AIN1, OUTPUT); pinMode(AIN2, OUTPUT); pinMode(PWMA, OUTPUT);
  pinMode(BIN1, OUTPUT); pinMode(BIN2, OUTPUT); pinMode(PWMB, OUTPUT);
  pinMode(STBY, OUTPUT); digitalWrite(STBY, HIGH);
  pinMode(BTN, INPUT_PULLUP);
  motor(0, 0);
  while (digitalRead(BTN) == HIGH) {}      // wait for the start button
  delay(5000);                             // required start delay
}
void loop() {
  bool edgeL = analogRead(A2) > EDGE, edgeR = analogRead(A3) > EDGE;
  if (edgeL || edgeR) {                    // never leave the ring
    motor(-SPEED, -SPEED); delay(250);
    if (edgeL && !edgeR) motor(SPEED, -SPEED); else motor(-SPEED, SPEED);
    delay(250);
    return;
  }
  bool seeL = analogRead(A0) > SEE, seeR = analogRead(A1) > SEE;
  if (seeL && seeR) motor(255, 255);       // charge
  else if (seeL) motor(80, SPEED);         // curve left
  else if (seeR) motor(SPEED, 80);         // curve right
  else motor(150, -150);                   // spin to search
}

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Hand in frontRobot charges
Hand at the sideRobot curves towards it
White borderReverses and turns
No targetSpins to search

If it does not work

Drives off the ring

Edge threshold wrong or sensors too high.

Does not see the opponent

Lower SEE or aim the sensors forward.

Spins in one place

A motor wire is reversed.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the mini sumo robot?

Arduino Nano, Sharp GP2Y0A21YK0F IR distance sensor × 2, TCRT5000 IR reflective sensor module × 2, TB6612FNG Motor Driver, N20 micro metal gear motor × 2, Li-Po 2S 7.4 V 2200 mAh 25C (RC), Tactile push button 6 mm and Mini-360 buck converter.

How long does the mini sumo robot take to build?

About 240 minutes for a intermediate maker, in 7 steps.

How do I know the mini sumo robot works?

Hand in front: Robot charges. Hand at the side: Robot curves towards it. White border: Reverses and turns.

Drives off the ring: what should I check?

Edge threshold wrong or sensors too high.

Does not see the opponent: what should I check?

Lower SEE or aim the sensors forward.

Spins in one place: what should I check?

A motor wire is reversed.