Autonomous Sumo Bot using Arduino

Autonomous Sumo Bot - Arduino UNO Project | Kids Robotics Guide

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! 🔥

The Ultimate Challenge: Design an autonomous robot that can detect opponents in a 1.5m x 1.5m arena, avoid falling off the ring, and push competitors out to victory! Only sensors and AI - no remote control!

📋Standard Sumo Robot Rules:

Ring Size: 1.5m diameter (5 feet) circular ring with white border
Bot Size: Maximum 20cm x 20cm x 20cm at start
Weight: No limit, but motor torque matters more
Autonomous Only: No remote control after start!
Victory Condition: Force opponent out of ring or last bot in arena wins
Match Duration: Usually 3 minutes per match
Weight Limit: Check specific competition rules
🌟Did You Know? Sumo robot competitions are held worldwide! Teams from schools and universities compete fiercely. Some bots can push over 10kg - more than 100 times their own weight! The fastest sumo bots accelerate in just milliseconds!

⚙️How Your Sumo Bot Will Work:

1. Detect Opponent: IR sensors find enemy bots nearby
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

1

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!

2

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!

3

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!

4

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

5

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)

6

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!

7

Upload Arduino Code

• Download Arduino IDE
• Copy code from below
• Connect Arduino via USB
• Select Arduino UNO board
• Click Upload and wait for success!

8

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

9

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

10

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

🎯 Sharp IR Distance Sensors (Front, Left, Right)
• 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
⚪ IR Reflective Sensors (Bottom - Edge Detection)
• 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!
📊 Sensor Readings in Serial Monitor:
• 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

✅ Motor Test: Both motors spin? Left = fast, Right = fast? Same speed?
✅ Forward/Backward: Bot moves straight forward without drifting?
✅ Turning: Bot spins smoothly both left and right?
✅ Front IR Sensor: Detects obstacles at 50cm away? Values change when you move hand?
✅ Line Sensors: Detect white paper under robot? Go off when over white ring?
✅ Edge Avoidance: Bot backs up when reaching white line? Turns away?
✅ Opponent Detection: Bot moves toward your hand/object when near?
✅ Arena Test: Bot stays inside 1.5m ring? Detects opponent and attacks?

🔧Troubleshooting Guide

When Your Bot Isn't Performing...

❌ Bot won't move at all:
✓ Check battery voltage (should be 7.2V minimum)
✓ Test motors directly with battery
✓ Verify motor driver connections
✓ Check if Arduino is powered on
❌ Bot moves in circles:
✓ 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
❌ IR sensors not detecting:
✓ Check sensor connections (A0-A4)
✓ IR LED on sensor might be broken
✓ Adjust threshold values in code
✓ Use Serial Monitor to read sensor values
❌ Bot falls off ring:
✓ Line sensors not detecting white border
✓ Increase EDGE_THRESHOLD value in code
✓ Mount sensors lower under bot
✓ Test sensors over white paper first
❌ Bot doesn't follow opponent:
✓ 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
❌ Code won't upload:
✓ 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 Spinner
Add a rotating disc weapon for extra damage!
📱Bluetooth Control
Add HC-05 for remote manual mode
🎬Add a Camera
Record your battles with OV7670 camera
🧠Machine Learning AI
Learn opponent patterns and adapt strategy
Faster Motors
Upgrade to 500+ RPM motors for speed boost
📊Add LCD Display
Show sensor values during combat
🔊Sound Effects
Add buzzer for attack sounds and victory songs
💾Data Logging
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!

🏆Ultimate Challenge: Can you program a sumo bot that beats multiple opponents in a tournament? Or build one that learns from previous matches? The ultimate roboticist never stops improving! Challenge yourself to the next level!

Autonomous Sumo Bot Project

A competitive robotics learning guide for young engineers

© 2024 Tech Learning Hub | Built with ❤️ and fighting spirit

Remember: The strongest bot isn't always the fastest - it's the one with the best strategy!

Good luck in competition! May your sensors be sharp and your motors be strong! 🏅

Comments

Product Cards
Buddy Bot eBook
⭐ New 2026 Release
Build Your
Own Robot!
3D design, wiring &
Arduino coding.
Young inventors love it!
🖨️
3D Print
All parts
Wire it
Circuit guide
💻
Code it
Arduino IDE
🤖
Watch it
Walk & react
📋 Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Website Offer
₹499 300
🌍 International: $5 USD
One-time · Instant digital delivery
🔒 Secured by Razorpay · Your data is safe
📄 Download Free Sample Copy
🔒 Secured by Razorpay · Your data is safe
🍓
Raspberry Pi Pico Mastery
21 Projects
⚡ Launch Price — 80% OFF
Learn Pico
Build 21 Projects!
MicroPython · Wokwi
IoT · Certificate
Perfect for beginners!
🖥️
Wokwi
No hardware
🐍
MicroPy
From zero
🔨
21 Projects
IoT + sensors
📄
Certificate
Verified cert
📋 Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Launch Offer
₹999 200 80% OFF
🌍 International: $5 USD
One-time · Lifetime access · No subscription
🔒 Secured by Razorpay · UPI · Cards · NetBanking
🎉

You're in!

Payment successful! Your Buddy Bot eBook is ready. Time to build!

📖 Access Your eBook Now
🎉

Enrolled!

Payment successful! Lifetime access to all 21 Pico Projects is yours!

🍓 Go to My Course