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.

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:
| Class | Max size | Max weight | Ring diameter | White edge |
|---|---|---|---|---|
| Standard sumo | 20 × 20 cm, any height | 3 kg | 154 cm | 5 cm |
| Mini sumo | 10 × 10 cm, any height | 500 g | 77 cm | 2.5 cm |
| Micro sumo | 5 × 5 × 5 cm | 100 g | 38.5 cm | Depends on the event |
| Nano sumo | 2.5 × 2.5 × 2.5 cm | 25 g | 19.25 cm | Depends 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.
Parts list
| Part | Recommended | Why? |
|---|---|---|
| Controller | Arduino Nano | Small and light, fits easily in 10 × 10 cm |
| Motors | 2 × N20, 6 V, 1:100 or 1:150 gearbox | Light; lots of torque for pushing |
| Motor driver | TB6612FNG (or DRV8833) | MOSFET-based, runs cool, very small |
| Edge sensors | 2 × TCRT5000 module | Tell the white line from the black ring |
| Opponent sensor | HC-SR04 (to start) or E18-D80NK, JS40F, VL53L0X | Finds the opponent |
| Battery | 2S LiPo, 7.4 V, 300–500 mAh | Light and delivers high current |
| Wheels | 30–35 mm silicone or rubber | More grip means more pushing force |
| Chassis | 3D-printed, acrylic or thin aluminum, with a sloped blade at the front | Gets under the opponent and lifts it |
| Other | Start button, power switch, weight plates | Rule 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?.
| Part | Approx. weight |
|---|---|
| Arduino Nano | 7 g |
| TB6612FNG module | 3 g |
| 2 × N20 motor with bracket | 25 g |
| 2 × silicone wheel | 15–25 g |
| HC-SR04 | 9 g |
| 2 × TCRT5000 module | 6 g |
| 2S LiPo 450 mAh | 30 g |
| Chassis, blade and screws | 80–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 sensor | Range | Response | Note |
|---|---|---|---|
| HC-SR04 ultrasonic | 2–400 cm | A few ms per reading, up to 38 ms with no target | Cheap; echoes can miss on sloped surfaces, wide beam |
| Sharp GP2Y0A21 | 10–80 cm | About 40 ms | Analog output; wrong readings below 10 cm |
| E18-D80NK | 3–80 cm (adjustable) | Very fast, digital | Cheap and simple; single-threshold output |
| JS40F | About 40 cm | Very fast, digital | Common on competition robots, tiny body |
| VL53L0X laser | 3–200 cm | 20–33 ms | Narrow 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
| Connection | Arduino Nano pin | Note |
|---|---|---|
| TB6612FNG PWMA | D5 | Left motor speed (PWM) |
| TB6612FNG AIN1 / AIN2 | D7 / D8 | Left motor direction |
| TB6612FNG PWMB | D6 | Right motor speed (PWM) |
| TB6612FNG BIN1 / BIN2 | D9 / D10 | Right motor direction |
| TB6612FNG STBY | D4 | Driver runs when HIGH |
| TB6612FNG VM / VCC | Battery 7.4 V / Nano 5V | Separate motor and logic supply, common GND |
| HC-SR04 TRIG / ECHO | D11 / D12 | Front center, slightly above the blade |
| TCRT5000 left / right AO | A0 / A1 | Front corners, 2–5 mm above the surface |
| Start button | D2 | Other leg to GND (INPUT_PULLUP) |
| Status LED | D13 | The onboard LED works too |
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.
| State | What the robot does | Transition |
|---|---|---|
| Waiting for start | Motors stopped, LED blinks slowly | Button press starts the countdown |
| Countdown | Waits 5 seconds, LED blinks fast | When time is up, search |
| Search | Spins in place looking for the opponent | Opponent closer than 60 cm: attack |
| Attack | Pushes forward at full power | Opponent not seen for 300 ms: search |
| Escape (back) | Reverses at full power for 200 ms | When time is up, turn |
| Escape (turn) | Turns away from the line for 250 ms | When time is up, search |
| Any state | An edge sensor sees white | Switches 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.
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}| Constant | Purpose |
|---|---|
| EDGE_THRESHOLD | An analog value below this counts as the white line |
| ATTACK_CM | Anything closer than this is treated as the opponent; keep it below the ring diameter |
| SEARCH_SPEED, ATTACK_SPEED | Search and attack speeds (PWM 0–255) |
| START_DELAY_MS | The 5-second wait from the rules |
| BACK_MS, TURN_MS | How long to reverse and turn when escaping the edge |
| turnDir | Direction 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.
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}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.
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
| Strategy | How it works | When it helps |
|---|---|---|
| Spin search | The robot spins in place and attacks once it sees the opponent | The default; safe against most opponents |
| Arc search | One wheel turns slower than the other so the robot sweeps a wide curve | Against stationary or slow opponents |
| Side attack | Turns 45° at the start, gets beside the opponent and pushes from there | Against opponents that charge straight ahead |
| Wait and counter | Waits briefly at the start, then pushes at full power when the opponent arrives | Against 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.
Projects to build after reading this
See all projects
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.

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.

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.

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.

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…

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.

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.

Parking Sensor with HC-SR04
A mini version of a car's parking sensor: the closer something gets, the faster the beeps.
More articles
BlueGrays app
Build this circuit step by step on your phone
Wiring diagram, code and parts list on one screen. 500+ Arduino, ESP32 and Pico projects ready to build.
Scan with your phone
Point your camera at the code and your phone's app store opens.
or open the store

