Autonomous Sumo Bot
Build an AI Wrestling Robot! A Competitive Robotics Project for Kids
🏆Welcome to Robot Sumo Wrestling!
Get ready to build a fighting robot that battles opponents autonomously! Your sumo bot will use sensors to detect opponents, avoid falling off the ring, and push enemies out of the arena - all without any manual control! This is competitive robotics at its most exciting! 🔥
📋Standard Sumo Robot Rules:
⚙️How Your Sumo Bot Will Work:
2. Attack: Motors spin at full power to rush the opponent
3. Edge Detection: White line sensors prevent falling off ring
4. Combat Logic: AI decides retreat or push harder
5. Victory: Push opponent out of the arena!
🛠️Materials You'll Need
🎛️ Arduino UNO
Brain of your robot
⚡ DC Motors
2x powerful 6V DC motors (RPM: 300+)
🔧 Motor Driver
L298N or similar H-Bridge module
🔋 Battery Pack
2x 18650 Li-ion or 4x AA battery holder
👁️ IR Sensors
3x Sharp IR distance sensors (front, left, right)
⚪ Line Sensors
2x IR reflective sensors (edge detection)
🎚️ Servo Motor
1x 9g servo (optional - for weapon)
🔩 Robot Chassis
Plastic/aluminum base or DIY plywood
🎡 Wheels
2x large wheels (60-80mm diameter)
🔌 Jumper Wires
20+ male-to-female wires
📦 Breadboard
For easy prototyping
🔨 Tools
Soldering iron, hot glue, screwdrivers
📋Step-by-Step Build Instructions
Design Your Robot
• Sketch your bot design on paper
• Decide shape: wedge, dome, flat?
• Plan sensor placement
• Consider weight distribution
• Low center of gravity = better pushing power!
Build the Chassis
• Use plastic or plywood base (20x20cm)
• Mount motors on sides using brackets
• Install wheels directly on motor shafts
• Center of weight should be over wheels
• Keep it light but strong!
Install the Motor Driver
• Mount L298N motor driver on top
• Secure with hot glue or velcro
• Connect motor power cables
• Red = positive, Black = ground
• Double-check polarity!
Mount Arduino & Sensors
• Place Arduino on top with velcro
• Mount 3 IR distance sensors (front, left, right)
• Mount 2 line sensors under robot (edge detection)
• Position sensors carefully for optimal detection
• Use cable ties to secure wires
Install Power System
• Mount battery pack (4x AA or 2x 18650 Li-ion)
• Connect batteries to motor driver power
• Add power switch for easy on/off
• Use quality battery connectors
• Test battery voltage (should be 7.2V minimum)
Wire Everything Together
• Connect motor driver to Arduino pins
• Wire sensors to analog inputs
• Use breadboard for connections
• Color code: red=5V, black=GND, others=data
• Check every connection twice!
Upload Arduino Code
• Download Arduino IDE
• Copy code from below
• Connect Arduino via USB
• Select Arduino UNO board
• Click Upload and wait for success!
Calibrate Sensors
• Print a white paper ring (to test edge detection)
• Adjust IR sensor sensitivity in code
• Test obstacle detection at different distances
• Fine-tune threshold values
• Use Serial Monitor to debug sensor readings
Test Movement
• Power on the bot
• Test forward/backward movement
• Test left/right turning
• Make sure motors are balanced
• Adjust motor speed if one spins faster
Battle Test!
• Create a test arena (1.5m ring)
• Place bot inside the ring
• Press power switch
• Watch it hunt for opponents!
• Celebrate your first autonomous robot! 🎉
Complete Circuit Wiring Diagram
Motor Driver (L298N) Connections to Arduino UNO
L298N PIN ARDUINO UNO PIN ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +12V (Power) Battery +12V GND (Ground) Battery GND IN1 (Motor A Forward) Digital Pin 8 IN2 (Motor A Backward) Digital Pin 9 IN3 (Motor B Forward) Digital Pin 10 IN4 (Motor B Backward) Digital Pin 11 OUT1, OUT2 (Motor A) Left Motor OUT3, OUT4 (Motor B) Right Motor SENSOR CONNECTIONS: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Sensor PIN ARDUINO PIN Front IR OUT A0 (Analog) Left IR OUT A1 (Analog) Right IR OUT A2 (Analog) Line Left OUT A3 (Analog) Line Right OUT A4 (Analog) All sensors: VCC → 5V GND → GND
Motor & Wheel Configuration
FRONT
╔═════════════╗
║ Arduino ║
║ & Sensors ║
╚═════════════╝
│││
┌────┴──────┐
│ Motor │ Motor
│ Driver L │ Driver R
│ (L298N) │
└────┬──────┘
┌────┴──────┐
│ Motor │ Motor
│ Left │ Right
│ (CW) │ (CW)
├───────────┤
│ Wheel L │ Wheel R
│ 80mm │ 80mm
└─────┬─────┘
↓
PUSHING POWER!
Motor Speed Control: PWM Pins (3,5,6,9,10,11)
Use analogWrite(pin, 0-255) for speed
💡Wiring Tips:
✓ Motor Direction: If bot goes backwards, swap one motor's wires
✓ Balanced Movement: Make sure both motors spin at same speed
✓ Current Limiting: Motors draw 2-3A, use quality power supply
✓ Sensor Placement: Higher = detects further, Lower = more sensitive
✓ Cable Management: Use zip ties to prevent tangles
✓ Breadboard Testing: Test circuits before permanent soldering
📡Sensor Guide & Placement
• Detect obstacles at 10-80cm range
• Gives analog output (0-1023)
• Perfect for finding and chasing opponents
• Mount at 45° angles for side detection
• Higher values = closer object
• Detect white ring border
• Mounted under robot facing downward
• Two sensors (left and right) prevent falling
• White surface = high reading (>600)
• Dark floor = low reading (<400)
• CRITICAL for staying in arena!
• Open Tools → Serial Monitor (9600 baud)
• See live sensor values
• Test each sensor independently
• Record threshold values
• Use for calibration and debugging
💻Complete Arduino Sumo Bot Code
Autonomous Sumo Bot Combat AI Code
// Autonomous Sumo Bot
// Arduino UNO with Motors, IR Sensors, & Edge Detection
// 3-Minute Combat AI
// ============ PIN DEFINITIONS ============
// Motor Control Pins (L298N)
const int MOTOR_L_IN1 = 8; // Left motor forward
const int MOTOR_L_IN2 = 9; // Left motor backward
const int MOTOR_R_IN3 = 10; // Right motor forward
const int MOTOR_R_IN4 = 11; // Right motor backward
// PWM Speed Pins (for variable speed)
const int MOTOR_L_PWM = 5; // PWM for left speed
const int MOTOR_R_PWM = 6; // PWM for right speed
// Sensor Input Pins (Analog)
const int IR_FRONT = A0; // Front opponent detector
const int IR_LEFT = A1; // Left opponent detector
const int IR_RIGHT = A2; // Right opponent detector
const int LINE_LEFT = A3; // Edge detection left
const int LINE_RIGHT = A4; // Edge detection right
// ============ PARAMETERS ============
const int MOTOR_SPEED = 255; // Full power
const int ATTACK_SPEED = 255; // Speed when attacking
const int TURN_SPEED = 200; // Speed when turning
const int EDGE_THRESHOLD = 600; // White line detection
const int OPPONENT_THRESHOLD = 400; // Opponent detection
const int MATCH_TIME = 180000; // 3 minutes in milliseconds
unsigned long startTime = 0;
// ============ STATE VARIABLES ============
enum State {
SEARCH, // Looking for opponent
ATTACK, // Moving toward opponent
EDGE_AVOID, // Avoiding falling off ring
RETREAT // Running from danger
};
State currentState = SEARCH;
int lastOpponentDir = 0; // -1=left, 0=center, 1=right
void setup() {
// Initialize Serial for debugging
Serial.begin(9600);
// Set motor pins as outputs
pinMode(MOTOR_L_IN1, OUTPUT);
pinMode(MOTOR_L_IN2, OUTPUT);
pinMode(MOTOR_R_IN3, OUTPUT);
pinMode(MOTOR_R_IN4, OUTPUT);
pinMode(MOTOR_L_PWM, OUTPUT);
pinMode(MOTOR_R_PWM, OUTPUT);
// Delay before starting (5 second startup)
Serial.println("Sumo Bot Initializing...");
digitalWrite(13, HIGH);
delay(5000);
digitalWrite(13, LOW);
Serial.println("FIGHT!");
startTime = millis();
// Start in search mode
search();
}
void loop() {
// Read all sensors
int frontValue = analogRead(IR_FRONT);
int leftValue = analogRead(IR_LEFT);
int rightValue = analogRead(IR_RIGHT);
int edgeLeft = analogRead(LINE_LEFT);
int edgeRight = analogRead(LINE_RIGHT);
// Check match time (3 minutes)
if (millis() - startTime > MATCH_TIME) {
stopMotors();
Serial.println("MATCH OVER!");
while(1); // Stop
}
// ============ EDGE DETECTION (Highest Priority!) ============
if (edgeLeft > EDGE_THRESHOLD || edgeRight > EDGE_THRESHOLD) {
Serial.println("EDGE DETECTED!");
if (edgeLeft > EDGE_THRESHOLD && edgeRight > EDGE_THRESHOLD) {
// Both edges - retreat hard!
spinReverse();
delay(500);
} else if (edgeLeft > EDGE_THRESHOLD) {
// Left edge - turn right
spinRight();
delay(300);
} else {
// Right edge - turn left
spinLeft();
delay(300);
}
return; // Skip opponent detection
}
// ============ OPPONENT DETECTION ============
// Determine opponent direction
int opponentDir = 0; // 0 = center, -1 = left, 1 = right
int maxDistance = max(frontValue, max(leftValue, rightValue));
if (maxDistance < 100) {
// No opponent nearby - search
currentState = SEARCH;
} else {
// Opponent detected!
currentState = ATTACK;
if (frontValue > leftValue && frontValue > rightValue) {
opponentDir = 0; // Dead center - FULL ATTACK!
} else if (leftValue > rightValue) {
opponentDir = -1; // Opponent on left
} else {
opponentDir = 1; // Opponent on right
}
lastOpponentDir = opponentDir;
}
// ============ STATE MACHINE ============
switch(currentState) {
case SEARCH:
// Look for opponent
searchPattern();
break;
case ATTACK:
// CHARGE THE OPPONENT!
attackOpponent(opponentDir);
break;
case EDGE_AVOID:
// Back away from edge
spinReverse();
break;
}
// Debug output
Serial.print("Front: "); Serial.print(frontValue);
Serial.print(" Left: "); Serial.print(leftValue);
Serial.print(" Right: "); Serial.println(rightValue);
}
// ============ MOVEMENT FUNCTIONS ============
void moveForward(int speed) {
// Both motors forward
digitalWrite(MOTOR_L_IN1, HIGH);
digitalWrite(MOTOR_L_IN2, LOW);
digitalWrite(MOTOR_R_IN3, HIGH);
digitalWrite(MOTOR_R_IN4, LOW);
analogWrite(MOTOR_L_PWM, speed);
analogWrite(MOTOR_R_PWM, speed);
}
void moveBackward(int speed) {
// Both motors backward
digitalWrite(MOTOR_L_IN1, LOW);
digitalWrite(MOTOR_L_IN2, HIGH);
digitalWrite(MOTOR_R_IN3, LOW);
digitalWrite(MOTOR_R_IN4, HIGH);
analogWrite(MOTOR_L_PWM, speed);
analogWrite(MOTOR_R_PWM, speed);
}
void turnLeft(int speed) {
// Left motor slow, right motor fast
digitalWrite(MOTOR_L_IN1, HIGH);
digitalWrite(MOTOR_L_IN2, LOW);
digitalWrite(MOTOR_R_IN3, HIGH);
digitalWrite(MOTOR_R_IN4, LOW);
analogWrite(MOTOR_L_PWM, speed / 2);
analogWrite(MOTOR_R_PWM, speed);
}
void turnRight(int speed) {
// Right motor slow, left motor fast
digitalWrite(MOTOR_L_IN1, HIGH);
digitalWrite(MOTOR_L_IN2, LOW);
digitalWrite(MOTOR_R_IN3, HIGH);
digitalWrite(MOTOR_R_IN4, LOW);
analogWrite(MOTOR_L_PWM, speed);
analogWrite(MOTOR_R_PWM, speed / 2);
}
void spinLeft() {
// Left motor backward, right motor forward
digitalWrite(MOTOR_L_IN1, LOW);
digitalWrite(MOTOR_L_IN2, HIGH);
digitalWrite(MOTOR_R_IN3, HIGH);
digitalWrite(MOTOR_R_IN4, LOW);
analogWrite(MOTOR_L_PWM, TURN_SPEED);
analogWrite(MOTOR_R_PWM, TURN_SPEED);
}
void spinRight() {
// Right motor backward, left motor forward
digitalWrite(MOTOR_L_IN1, HIGH);
digitalWrite(MOTOR_L_IN2, LOW);
digitalWrite(MOTOR_R_IN3, LOW);
digitalWrite(MOTOR_R_IN4, HIGH);
analogWrite(MOTOR_L_PWM, TURN_SPEED);
analogWrite(MOTOR_R_PWM, TURN_SPEED);
}
void spinReverse() {
// 180 degree spin then reverse
spinRight();
delay(200);
moveBackward(MOTOR_SPEED);
}
void stopMotors() {
analogWrite(MOTOR_L_PWM, 0);
analogWrite(MOTOR_R_PWM, 0);
}
// ============ AI BEHAVIOR FUNCTIONS ============
void search() {
// Slowly turn while looking for opponent
spinLeft();
delay(100);
spinRight();
delay(100);
}
void searchPattern() {
// Random search pattern
int pattern = millis() % 3;
if (pattern == 0) {
moveForward(150); // Slow forward
} else if (pattern == 1) {
spinLeft(); // Turn left
} else {
spinRight(); // Turn right
}
delay(50);
}
void attackOpponent(int direction) {
// FULL THROTTLE ATTACK!
if (direction == 0) {
// Opponent dead center - FULL POWER!
Serial.println("*** DIRECT ATTACK! ***");
moveForward(ATTACK_SPEED);
} else if (direction == -1) {
// Opponent on left
turnLeft(ATTACK_SPEED);
} else {
// Opponent on right
turnRight(ATTACK_SPEED);
}
delay(50);
}
🎮Understanding the Code:
setup(): Initializes all pins and waits 5 seconds
loop(): Constantly reads sensors and makes decisions
Edge Detection: HIGHEST PRIORITY - prevents falling
Opponent Detection: Identifies which direction opponent is
State Machine: SEARCH → ATTACK → EDGE_AVOID
Movement Functions: Forward, backward, turn, spin
Attack AI: Full power toward opponent direction
Time Limit: Match ends after 3 minutes
🧠Winning Strategies
Tips to Win Your Battles:
🔋 Power: More powerful motors = better pushing force. Test different motor specs!
⚖️ Weight Distribution: Low center of gravity helps you push harder. Keep weight low and forward.
🛡️ Defense: Good edge detection is critical. Calibrate your line sensors perfectly!
🎯 Accuracy: IR sensors need good calibration. Test at different distances and angles.
🏃 Speed: Quick detection and response beats brute force. Tune your timing constants.
⚔️ Shape: Wedge shape pushes opponents better than flat. Low front, high back design wins.
🔧 Tuning: Adjust MOTOR_SPEED, OPPONENT_THRESHOLD, and delay timings for your arena.
🧪 Testing: Test against practice opponents before competition. Learn their behavior!
📊Sumo Bot vs Other Robot Types
| Robot Type | Complexity | Cost | Best For |
|---|---|---|---|
| Sumo Bot | Medium | $60-80 | Combat & competition |
| Line Follower | Easy | $40-50 | Speed racing |
| Obstacle Avoidance | Easy | $50-60 | Navigation |
| Arm Robot | Hard | $100+ | Picking & placing |
🧪Testing Checklist
🔧Troubleshooting Guide
When Your Bot Isn't Performing...
✓ Check battery voltage (should be 7.2V minimum)
✓ Test motors directly with battery
✓ Verify motor driver connections
✓ Check if Arduino is powered on
✓ One motor is spinning faster - adjust motor power
✓ Wheels have different tread wear
✓ Weight is not balanced
✓ Try: analogWrite(pin, 245) one motor, 255 other
✓ Check sensor connections (A0-A4)
✓ IR LED on sensor might be broken
✓ Adjust threshold values in code
✓ Use Serial Monitor to read sensor values
✓ Line sensors not detecting white border
✓ Increase EDGE_THRESHOLD value in code
✓ Mount sensors lower under bot
✓ Test sensors over white paper first
✓ IR sensor angles might be wrong
✓ Lower OPPONENT_THRESHOLD in code
✓ Test sensors with flashlight to ensure they work
✓ Clean sensor lenses - dust blocks IR light
✓ Select correct board: Arduino UNO
✓ Check USB cable connection
✓ Try different USB port
✓ Make sure motors aren't connected during upload
🚀Advanced Upgrades!
Add a rotating disc weapon for extra damage!
Add HC-05 for remote manual mode
Record your battles with OV7670 camera
Learn opponent patterns and adapt strategy
Upgrade to 500+ RPM motors for speed boost
Show sensor values during combat
Add buzzer for attack sounds and victory songs
Save match stats to SD card for analysis
⚠️Safety & Competition Rules:
✓ Adult Supervision: Always build with adult help
✓ No Sharp Objects: Sand down any rough edges
✓ Battery Safety: Use quality batteries, never leave charging unattended
✓ Competition Rules: Check rules before competing - some ban certain modifications
✓ Loose Parts: Make sure nothing flies off during battle
✓ Wheel Guards: Keep fingers away from spinning wheels
🎓Skills You've Mastered!
✅ Motor control and H-Bridge drivers
✅ Infrared sensor operation and calibration
✅ Edge detection and safety systems
✅ State machine programming
✅ Sensor fusion and decision making
✅ Robot chassis design and assembly
✅ Power management systems
✅ Autonomous AI behavior
✅ Real-world robotics competition
✅ Problem-solving under pressure!

Comments
Post a Comment