Guides · 9 min read

Arduino Sumo Robot: Build a Mini Sumo Bot with Rules and Code

How to build an Arduino sumo robot: TCRT5000 edge sensors, HC-SR04 opponent search, N20 motors, a mini sumo rules table and search-attack code.

An Arduino sumo robot lets you compete in mini sumo, the most popular class of robot sumo, where two autonomous robots try to push each other out of a black ring. The robot has three basic jobs: see the white edge so it does not fall off, find the opponent and push it out of the ring with everything it has. For that you need just two TCRT5000 edge sensors, one HC-SR04 or infrared opponent sensor, two N20 gear motors and an Arduino Nano.

In this guide you will find the mini sumo rules, a parts list that fits the 10 × 10 cm and 500 gram limits, the weight and pushing force math, the wiring diagram and a search-attack state machine sketch with the 5-second start delay that competitions require. If you are getting ready for a school, college or local robotics competition, you can build your robot step by step and take it to its first match.

N20 micro metal gear motor
N20 micro gear motor: small, light and torquey, it is the most common motor in mini sumo robots.

What is mini sumo? Rules table

Robot sumo was born in Japan and is now held at school and university competitions in many countries, from Latin America to Europe and North America. The robots are placed facing each other in the middle of the ring (the dohyo), wait 5 seconds after the referee's signal and then fight fully autonomously. The first robot to touch the floor outside the ring loses the round; usually the first to score two points in 3-minute rounds wins the match. Classes are split by size and weight:

ClassMax sizeMax weightRing diameterWhite edge
Standard sumo20 × 20 cm, any height3 kg154 cm5 cm
Mini sumo10 × 10 cm, any height500 g77 cm2.5 cm
Micro sumo5 × 5 × 5 cm100 g38.5 cmDepends on the event
Nano sumo2.5 × 2.5 × 2.5 cm25 g19.25 cmDepends on the event
  • Start delay: the robot must not move for 5 seconds after it is started; a robot that moves early gets a warning or loses the point.
  • Fully autonomous: once started, no commands can be sent to the robot; remote-controlled sumo is a separate class.
  • Size is checked at the start: the robot must fit inside a 10 × 10 cm square when the match begins; some rules allow parts that unfold afterwards.
  • Banned: parts that damage the ring or the opponent, liquids, powders, signal jammers and devices meant to disrupt the opponent's sensors.
  • Ring: in mini sumo it is a black ring 77 cm across and 2.5 cm high, with a 2.5 cm wide white line around the edge.
Rules vary slightly from event to event: some tournaments require a start module that the referee triggers with a remote, and some ban magnets. Before you design your robot, always read the rulebook of the competition you plan to enter.

Parts list

PartRecommendedWhy?
ControllerArduino NanoSmall and light, fits easily in 10 × 10 cm
Motors2 × N20, 6 V, 1:100 or 1:150 gearboxLight; lots of torque for pushing
Motor driverTB6612FNG (or DRV8833)MOSFET-based, runs cool, very small
Edge sensors2 × TCRT5000 moduleTell the white line from the black ring
Opponent sensorHC-SR04 (to start) or E18-D80NK, JS40F, VL53L0XFinds the opponent
Battery2S LiPo, 7.4 V, 300–500 mAhLight and delivers high current
Wheels30–35 mm silicone or rubberMore grip means more pushing force
Chassis3D-printed, acrylic or thin aluminum, with a sloped blade at the frontGets under the opponent and lifts it
OtherStart button, power switch, weight platesRule compliance and weight balance

Weight and pushing force: why get close to 500 grams?

In sumo, the winner is usually not the fastest robot but the one with the best grip. The maximum force a robot can push with is limited by the friction of its wheels: F = μ × m × g. A 500 gram robot with silicone wheels and a friction coefficient of μ = 0.9 can push at most 0.9 × 0.5 × 9.81 ≈ 4.4 N; at 250 grams the same robot would drop to 2.2 N. That is why competitors build right up to the weight limit and make up the difference with steel or lead plates bolted under the chassis. Keeping the center of gravity low and close to the wheels also improves grip.

On the motor side, the math goes like this: the two motors share the 4.4 N, so each one has to deliver 2.2 N. With a wheel radius of 1.7 cm, the required torque is 2.2 N × 0.017 m ≈ 0.037 N·m (about 0.38 kg·cm). N20 motors with a 1:100 or 1:150 gearbox usually provide this well below their stall torque, while fast gearboxes such as 1:30 struggle and heat up when pushing. If you run 6 V N20 motors on a 2S LiPo (7.4 V), limiting sustained speed with PWM to about 207/255 (6 / 7.4 × 255) extends motor life; you can still use full power for short attacks. For the PWM basics, see What is PWM?.

PartApprox. weight
Arduino Nano7 g
TB6612FNG module3 g
2 × N20 motor with bracket25 g
2 × silicone wheel15–25 g
HC-SR049 g
2 × TCRT5000 module6 g
2S LiPo 450 mAh30 g
Chassis, blade and screws80–150 g
Total (without added weight)About 175–255 g

The total in the table is roughly half the limit. Filling the remaining 250–300 grams with steel plates bolted to the bottom of the chassis almost doubles the pushing force. The sloped blade (ramp) at the front gets under the opponent and lifts it slightly, reducing how hard its wheels press on the ring; the tip of the blade should sit as close to the ring as possible and be perfectly straight. You can estimate how many minutes your battery will last with the battery life calculator.

Sensors: ring edge and opponent

The TCRT5000 contains an infrared LED and a phototransistor. The black ring absorbs infrared light while the white edge reflects it, and that difference shows up as a big change on the analog output. Mount the two sensors at the front corners of the robot, 2–5 mm above the surface, so they are the first to see the line when the robot drives forward. If you do not want to fall off while backing up, you can add two more at the rear. The sensor is covered in detail in the TCRT5000 infrared sensor guide.

Opponent sensorRangeResponseNote
HC-SR04 ultrasonic2–400 cmA few ms per reading, up to 38 ms with no targetCheap; echoes can miss on sloped surfaces, wide beam
Sharp GP2Y0A2110–80 cmAbout 40 msAnalog output; wrong readings below 10 cm
E18-D80NK3–80 cm (adjustable)Very fast, digitalCheap and simple; single-threshold output
JS40FAbout 40 cmVery fast, digitalCommon on competition robots, tiny body
VL53L0X laser3–200 cm20–33 msNarrow beam and precise readings; connects over I2C

The easiest option to start with is the HC-SR04, but the sound wave can bounce off an opponent's sloped blade in another direction, and with no target a reading takes up to 38 ms. Competition robots usually carry three or five digital infrared sensors at the front and sides: the robot turns toward whichever sensor sees the opponent. The VL53L0X laser sensor is a good middle ground thanks to its narrow beam and accuracy. Whichever you pick, keep the attack distance shorter than the ring diameter (77 cm) so the robot does not mistake spectators outside the ring for the opponent.

Wiring diagram and pin table

ConnectionArduino Nano pinNote
TB6612FNG PWMAD5Left motor speed (PWM)
TB6612FNG AIN1 / AIN2D7 / D8Left motor direction
TB6612FNG PWMBD6Right motor speed (PWM)
TB6612FNG BIN1 / BIN2D9 / D10Right motor direction
TB6612FNG STBYD4Driver runs when HIGH
TB6612FNG VM / VCCBattery 7.4 V / Nano 5VSeparate motor and logic supply, common GND
HC-SR04 TRIG / ECHOD11 / D12Front center, slightly above the blade
TCRT5000 left / right AOA0 / A1Front corners, 2–5 mm above the surface
Start buttonD2Other leg to GND (INPUT_PULLUP)
Status LEDD13The onboard LED works too
LiPo batteries are powerful but unforgiving: never discharge below 3.0 V per cell, charge only with a balance charger and never use a puffy or crushed pack. Mount the battery securely inside the chassis so it cannot be crushed in collisions. When you test the code for the first time, put the robot on a box with its wheels in the air, or it may launch itself off the table.

State machine: search, attack and escape

The robot's brain is a state machine that always knows what it is doing. It first waits for the start button, counts down 5 seconds when you press it and then starts searching for the opponent. When it sees the opponent it attacks, and if it loses sight of it for 300 ms it searches again. The moment either edge sensor sees the white line, whatever the state, it first backs off and then turns away from the line. All timing is done with millis(), so the robot keeps reading its sensors even while turning.

StateWhat the robot doesTransition
Waiting for startMotors stopped, LED blinks slowlyButton press starts the countdown
CountdownWaits 5 seconds, LED blinks fastWhen time is up, search
SearchSpins in place looking for the opponentOpponent closer than 60 cm: attack
AttackPushes forward at full powerOpponent not seen for 300 ms: search
Escape (back)Reverses at full power for 200 msWhen time is up, turn
Escape (turn)Turns away from the line for 250 msWhen time is up, search
Any stateAn edge sensor sees whiteSwitches to escape immediately (highest priority)

Arduino mini sumo code

The code needs no extra libraries and works the same on an Arduino Nano and Uno. First find the edge sensor threshold with the calibration sketch below, then tune EDGE_THRESHOLD, ATTACK_CM and the speeds for your robot.

C++ (Arduino IDE)
1// Arduino mini sumo robotu: arama-saldırı durum makinesi / Arduino mini sumo robot: search-attack state machine
2// Arduino Nano + TB6612FNG + 2x N20 + HC-SR04 + 2x TCRT5000
3
4// Motor sürücü TB6612FNG / motor driver TB6612FNG
5const uint8_t PWMA = 5, AIN1 = 7, AIN2 = 8;     // sol motor / left motor
6const uint8_t PWMB = 6, BIN1 = 9, BIN2 = 10;    // sağ motor / right motor
7const uint8_t STBY = 4;                         // HIGH = sürücü açık / driver enabled
8// Sensörler / sensors
9const uint8_t TRIG = 11, ECHO = 12;             // HC-SR04 (önde / front)
10const uint8_t EDGE_L = A0, EDGE_R = A1;         // TCRT5000 AO (ön köşeler / front corners)
11const uint8_t START_BTN = 2;                    // diğer ucu GND / other leg to GND
12const uint8_t LED = 13;
13
14const int EDGE_THRESHOLD = 450;          // bunun altı beyaz çizgi / below this = white edge
15const int ATTACK_CM = 60;                // ring çapından (77 cm) kısa / shorter than the ring (77 cm)
16const int SEARCH_SPEED = 140;            // arama hızı / search speed (0-255)
17const int ATTACK_SPEED = 255;            // saldırı hızı / attack speed
18const unsigned long START_DELAY_MS = 5000;   // kural: 5 s bekle / rule: wait 5 s
19const unsigned long BACK_MS = 200, TURN_MS = 250, LOST_MS = 300;
20
21enum State { WAIT_START, COUNTDOWN, SEARCH, ATTACK, ESCAPE_BACK, ESCAPE_TURN };
22State state = WAIT_START;
23unsigned long stateStart = 0;
24unsigned long lastSeen = 0;
25int turnDir = 1;                          // 1: sağa / right, -1: sola / left
26
27void setMotor(uint8_t pwmPin, uint8_t in1, uint8_t in2, int speed) {
28  speed = constrain(speed, -255, 255);
29  digitalWrite(in1, speed > 0 ? HIGH : LOW);
30  digitalWrite(in2, speed < 0 ? HIGH : LOW);
31  analogWrite(pwmPin, abs(speed));
32}
33
34void drive(int left, int right) {
35  setMotor(PWMA, AIN1, AIN2, left);
36  setMotor(PWMB, BIN1, BIN2, right);
37}
38
39void changeState(State s) {
40  state = s;
41  stateStart = millis();
42}
43
44// Rakibe uzaklık (cm); görünmüyorsa 999 / distance to opponent in cm, 999 if none
45int readDistanceCm() {
46  digitalWrite(TRIG, LOW);
47  delayMicroseconds(2);
48  digitalWrite(TRIG, HIGH);
49  delayMicroseconds(10);
50  digitalWrite(TRIG, LOW);
51  unsigned long us = pulseIn(ECHO, HIGH, 6000);   // en çok ~1 m bekle / wait for ~1 m at most
52  if (us == 0) return 999;
53  return us / 58;
54}
55
56bool edgeLeft()  { return analogRead(EDGE_L) < EDGE_THRESHOLD; }
57bool edgeRight() { return analogRead(EDGE_R) < EDGE_THRESHOLD; }
58
59void setup() {
60  pinMode(AIN1, OUTPUT); pinMode(AIN2, OUTPUT); pinMode(PWMA, OUTPUT);
61  pinMode(BIN1, OUTPUT); pinMode(BIN2, OUTPUT); pinMode(PWMB, OUTPUT);
62  pinMode(STBY, OUTPUT);
63  digitalWrite(STBY, HIGH);
64  pinMode(TRIG, OUTPUT);
65  pinMode(ECHO, INPUT);
66  pinMode(START_BTN, INPUT_PULLUP);
67  pinMode(LED, OUTPUT);
68  drive(0, 0);
69}
70
71void loop() {
72  unsigned long now = millis();
73  unsigned long t = now - stateStart;
74
75  if (state == WAIT_START) {                      // butonu bekle / wait for the button
76    digitalWrite(LED, (now / 500) % 2 ? HIGH : LOW);
77    if (digitalRead(START_BTN) == LOW) changeState(COUNTDOWN);
78    return;
79  }
80  if (state == COUNTDOWN) {                       // 5 s hareketsiz / 5 s without moving
81    digitalWrite(LED, (now / 100) % 2 ? HIGH : LOW);
82    if (t >= START_DELAY_MS) {
83      digitalWrite(LED, LOW);
84      changeState(SEARCH);
85    }
86    return;
87  }
88
89  // En yüksek öncelik: ring kenarı / highest priority: ring edge
90  bool eL = edgeLeft(), eR = edgeRight();
91  if ((eL || eR) && state != ESCAPE_BACK && state != ESCAPE_TURN) {
92    turnDir = eL ? 1 : -1;                        // sol çizgide: sağa dön / left on line: turn right
93    changeState(ESCAPE_BACK);
94    t = 0;
95  }
96
97  switch (state) {
98    case ESCAPE_BACK:
99      drive(-255, -255);                          // geri kaç / back off
100      if (t >= BACK_MS) changeState(ESCAPE_TURN);
101      break;
102    case ESCAPE_TURN:
103      drive(200 * turnDir, -200 * turnDir);       // çizginin tersine dön / turn away from the line
104      if (t >= TURN_MS) changeState(SEARCH);
105      break;
106    case SEARCH:
107      if (readDistanceCm() <= ATTACK_CM) {
108        lastSeen = now;
109        changeState(ATTACK);
110      } else {
111        drive(SEARCH_SPEED * turnDir, -SEARCH_SPEED * turnDir);   // yerinde dönerek ara / spin to search
112      }
113      break;
114    case ATTACK:
115      if (readDistanceCm() <= ATTACK_CM) lastSeen = now;
116      if (now - lastSeen > LOST_MS) changeState(SEARCH);          // rakip kayboldu / opponent lost
117      else drive(ATTACK_SPEED, ATTACK_SPEED);                      // tam güç it / push at full power
118      break;
119    default:
120      break;
121  }
122}
ConstantPurpose
EDGE_THRESHOLDAn analog value below this counts as the white line
ATTACK_CMAnything closer than this is treated as the opponent; keep it below the ring diameter
SEARCH_SPEED, ATTACK_SPEEDSearch and attack speeds (PWM 0–255)
START_DELAY_MSThe 5-second wait from the rules
BACK_MS, TURN_MSHow long to reverse and turn when escaping the edge
turnDirDirection of the last escape; the search spins the same way

Calibrating the edge sensors

Every ring and every sensor reads a little differently, so set the threshold by measuring, not guessing. Upload the sketch below, open the Serial Monitor at 9600 baud and place the robot first on the black surface of the ring, then on the white edge. If you read, say, 800 on black and 120 on white, set the threshold halfway, around 450. Ambient light and sensor height change the values, so measure again on the competition ring on the day.

C++ (Arduino IDE)
1// Kenar sensörü kalibrasyonu: siyah ve beyaz değerleri oku / edge sensor calibration: read black and white values
2void setup() {
3  Serial.begin(9600);
4}
5
6void loop() {
7  Serial.print(F("Sol / Left: "));
8  Serial.print(analogRead(A0));
9  Serial.print(F("   Sag / Right: "));
10  Serial.println(analogRead(A1));
11  delay(200);
12}
On some TCRT5000 modules the value drops over white, on others it rises; the calibration sketch shows you right away which kind you have. If the value rises on white, flip the comparison in the edgeLeft() and edgeRight() functions from less than to greater than.

Using a digital infrared opponent sensor

If you use a digital infrared sensor such as the E18-D80NK instead of the HC-SR04, just replace the readDistanceCm() function with the one below; the rest of the state machine stays the same. This sensor pulls its output LOW when it sees the opponent, and because there is no measurement to wait for, the robot reacts much faster. For other sensors such as the JS40F, check the output logic in the datasheet. With three sensors, set turnDir toward the left or right sensor that sees the opponent so the robot turns to face it.

C++ (Arduino IDE)
1// HC-SR04 yerine dijital IR sensör (E18-D80NK): rakibi görünce çıkış LOW olur
2// Digital IR sensor instead of HC-SR04 (E18-D80NK): output goes LOW when it sees the opponent
3const uint8_t OPP_SENSOR = 12;     // setup() içinde / in setup(): pinMode(OPP_SENSOR, INPUT_PULLUP);
4
5int readDistanceCm() {
6  return digitalRead(OPP_SENSOR) == LOW ? 0 : 999;   // görürse 0, görmezse 999 / 0 if seen, 999 if not
7}

Tactics and strategies

StrategyHow it worksWhen it helps
Spin searchThe robot spins in place and attacks once it sees the opponentThe default; safe against most opponents
Arc searchOne wheel turns slower than the other so the robot sweeps a wide curveAgainst stationary or slow opponents
Side attackTurns 45° at the start, gets beside the opponent and pushes from thereAgainst opponents that charge straight ahead
Wait and counterWaits briefly at the start, then pushes at full power when the opponent arrivesAgainst very fast opponents that attack blindly

Most competitors add a DIP switch or a few buttons to pick a strategy right before the match, depending on the opponent. If the rules allow it, you can also change the starting direction by placing the robot sideways or backwards in the ring. As an advanced tweak, ignoring the edge sensors for a split second while attacking an opponent closer than 5–10 cm lets you push it all the way out; but only use this risky setting after plenty of testing on your own ring.

Common mistakes and fixes

  • The robot drives off the ring right after starting: the edge threshold is wrong or the sensors sit too high; recalibrate and lower the sensors to 2–5 mm.
  • The robot keeps spinning without seeing the opponent: ATTACK_CM is too short or the HC-SR04 is too close to the blade; raise it slightly and check the distance in the Serial Monitor.
  • The robot attacks things outside the ring: ATTACK_CM is longer than the ring diameter; lower it to 50–60 cm.
  • One motor runs backwards: swap that motor's wires or flip the sign of its speed in the code.
  • The robot stalls while pushing or the Arduino resets: the motors drag the battery voltage down; use a LiPo with a higher current rating, power the Arduino from a separate regulator and solder a 100 nF capacitor across each motor's terminals.
  • It cannot push the opponent: the robot is too light or the wheels are dirty; add weight and clean the wheels with tape before every match.
  • False start penalty: the countdown is shorter than 5 seconds; check START_DELAY_MS and do not keep holding the robot after pressing the button.

Next steps and project ideas

  • Start with the basics: the obstacle avoiding robot teaches motor control and distance sensing.
  • Get to know line sensors: the line follower robot project reinforces TCRT5000 calibration.
  • Pick the right motor driver: the motor driver comparison explains the differences between the TB6612FNG, L9110S and L298N.
  • Remote-controlled sumo: turn the same chassis into an RC sumo driven from your phone with the HC-05 Bluetooth module.
  • School tournament: build one robot each with your classmates under the same rules and run a small league.

A mini sumo robot combines sensor reading, motor control, power and weight math and state machine programming in one project, and the thrill of competition makes learning a lot of fun. Test the robot on your own ring first, tune the thresholds and speeds, then enter your first tournament. In the BlueGrays app, the Obstacle Avoiding Robot and TCRT5000 Black and White Surface Detection projects show you step by step, with wiring diagrams and code, how to build the core parts of this robot.

Frequently asked questions

How much should a mini sumo robot weigh?

In the mini sumo class the robot can weigh up to 500 grams and must fit inside a 10 × 10 cm square at the start; height is unlimited. Since pushing force grows with weight, getting as close to the limit as possible is a big advantage.

What motors are best for a sumo robot?

In mini sumo the most common choice is 6 V N20 micro gear motors, with high-torque ratios such as 1:100 or 1:150 preferred for pushing. The larger 3 kg class uses more powerful DC gear motors.

How does a sumo robot detect the edge of the ring?

Infrared reflective sensors such as the TCRT5000, mounted under the robot, tell the black ring from the white edge line. When a sensor sees white, the robot first backs up and then turns away from the line.

Why does a sumo robot wait 5 seconds?

The rules require robots to stay still for 5 seconds after they are started so the competitors can step away from the ring. A robot that moves early gets a warning or loses the point, so a countdown in the code is mandatory.

What is the best opponent sensor for a sumo robot?

To start, the HC-SR04 is cheap and good enough, though it is slow and unreliable on sloped surfaces. Competition robots usually use several digital infrared sensors at the front and sides, or laser distance sensors such as the VL53L0X, so they also know which direction the opponent is in.

Can I build a sumo robot with an Arduino Uno?

Yes, you can build a working sumo robot with an Uno, but the board takes up a lot of room within the 10 × 10 cm mini sumo limit. The Arduino Nano runs the same code on the same pins and is smaller and lighter, which makes it a better fit for mini sumo.

See all projects
Obstacle Avoidance Robot
AR-81Advanced
Premium

Obstacle Avoidance Robot

How about building a smart vehicle that finds its own way? The Obstacle Avoidance Robot constantly scans its surroundings thanks to the ultrasonic sensor in front of it.

5.0(38)
49
TCRT5000 Black and White Surface Detection
AR-78Intermediate
Premium

TCRT5000 Black and White Surface Detection

With the little sensor that acts as the eye of line-following robots, you can tell whether the floor is black or white.

4.7(40)
49
Reading Reflection (Proximity) with TCRT5000
AR-77Intermediate
Premium

Reading Reflection (Proximity) with TCRT5000

With a small sensor that sends out invisible light and measures how much bounces back, you can detect the surface in front of it.

4.6(33)
43
HC-SR04 Distance Measurement (Serial Display)
AR-27Beginner

HC-SR04 Distance Measurement (Serial Display)

The HC-SR04 sensor works just like a bat finding its way in the dark: it sends out a sound you cannot hear, listens for the echo and measures how far away the object in front of it is.

4.6(50)
82
Bluetooth Controlled Car with L298N
AR-80Advanced
Premium

Bluetooth Controlled Car with L298N

Turn your phone into a remote and drive your own robot car. The Arduino receives commands from a remote-control app on your phone through a Bluetooth module and spins the wheels with a motor driver…

5.0(39)
66
LED Control with a Push Button (Push)
AR-9Beginner

LED Control with a Push Button (Push)

Just like a doorbell: the light stays on as long as you press, and goes off when you let go.

4.8(114)
253
ESP32 HC-SR04 Ultrasonic Distance Sensor
ES-14Intermediate

ESP32 HC-SR04 Ultrasonic Distance Sensor

The HC-SR04 ultrasonic sensor measures distance by timing how long its sound pulse takes to bounce off an object and return (time of flight). In this project the ESP32 sends a 10-microsecond pulse to the TRIG pin and reads the echo time from the ECHO pin with pulseIn(). The distance is shown in cm on a 16x2 I2C LCD. The HC-SR04 runs on 5V, so the ECHO pin needs a voltage divider, or the ESP32's 3.3V GPIO gets damaged.

4.9(29)
48
Parking Sensor with HC-SR04
AR-28Intermediate
Premium

Parking Sensor with HC-SR04

A mini version of a car's parking sensor: the closer something gets, the faster the beeps.

4.8(65)
87