Autonomous sumo robot that detects opponents, attacks aggressively, and avoids the white edge of the dohyo using dual line sensors. Built with Arduino and the Adafruit Motor Shield, featuring a simple but effective search → acquire → attack strategy.
- Tools: C++ (Arduino), Microcontroller (Arduino Uno), Robotics, sensor integration, mechanical design, 3D printing, control systems
- Repo:
https://github.com/Ahmed-Maher77/Sumo-Robot
- Edge protection: Dual analog reflectance sensors detect the white boundary and trigger evasive maneuvers.
- Target acquisition: Ultrasonic sensor (HC-SR04) scans for opponents; charges when in range.
- Search strategy: Spins to scan; switches to full-speed attack when target is detected.
- Configurable: Thresholds and speeds are tunable in code.
- Microcontroller: Arduino Uno (or compatible)
- Motor Driver: Adafruit Motor Shield V1 (AFMotor library)
- Motors: 2 × DC gear motors with wheels
- Sensors:
- HC-SR04 ultrasonic distance sensor (front)
- 2 × analog line/reflectance sensors (downward facing, near front left/right)
- Power: 7.4–11.1V battery (LiPo recommended) for motors; 5V regulated for logic
- Chassis: 3D-printed or aluminum plate with low center of gravity and front wedge
- Motors
- Left motor → Motor Shield M1
- Right motor → Motor Shield M2
- Ultrasonic (HC-SR04)
- VCC → 5V, GND → GND
- TRIG →
D9
- ECHO →
D10
- Line Sensors (analog reflectance)
- Left sensor signal →
A0
- Right sensor signal →
A1
- VCC → 5V, GND → GND
- Left sensor signal →
- Arduino IDE 2.x (or 1.8.x)
- Libraries:
AFMotor
(Adafruit Motor Shield V1) — install via Library Manager
The core logic lives in sumo.ino
and implements:
- Edge-first safety: if the white line is detected, immediately reverse and pivot away
- Search mode: spin in place to scan for opponents
- Attack mode: when an opponent is within the configured distance, drive forward at max power
Key pin assignments and tunables (see sumo.ino
):
// Motors
AF_DCMotor leftMotor(1);
AF_DCMotor rightMotor(2);
// Ultrasonic
const int trigPin = 9;
const int echoPin = 10;
// Line sensors
const int leftLinePin = A0;
const int rightLinePin = A1;
// Thresholds / speeds
int edgeThreshold = 500; // Adjust per your sensors & ring
const int kDetectDistanceCm = 55;
- Connect the Arduino via USB.
- Open
sumo.ino
in Arduino IDE. - Tools → Board: select Arduino Uno (or your board).
- Tools → Port: select the correct COM port.
- Sketch → Include Library → Manage Libraries… → Install
AFMotor
. - Upload.
Perform these quick steps on the real ring:
- Place the robot so both line sensors are fully on black. Read raw values using a simple analog print sketch or temporarily
Serial.println(analogRead(A0));
/A1
(ensureSerial.begin
). - Move to white edge and read again. Set
edgeThreshold
midway between black and white readings. - If your sensors read inverted (white gives low), set
lineIsWhiteHigh = false
insumo.ino
. - Test edge avoidance: roll toward the white; robot should reverse and pivot away instantly.
- Start in the center pointing forward. The robot spins to scan if nothing is in range.
- On detection within
kDetectDistanceCm
, it accelerates straight to push. - Edge events always override and force an evasive maneuver first.
- Increase
kAttackSpeed
for stronger pushes; reduce if traction is lost. - Adjust
kDetectDistanceCm
for your arena size and sensor placement. - Balance the robot and add a front wedge to get under opponents.
- Use a switch to power on/off safely.
- Lift the robot when testing edge behavior to prevent accidental drops.
- Never short LiPo batteries; use proper chargers.
E:\Sumo-Robot\
README.md
sumo.ino
- Built by Ahmed Maher — achieved 🥈 2nd place in competition.
- Uses Adafruit Motor Shield V1 (
AFMotor
).
This project is provided as-is for educational and competitive use. Consider adding a full license (e.g., MIT) if you plan to share or fork.