Design Specification for Autonomous Sumo Robot
Introduction and Objectives:
- Design and construct an Autonomous Sumo Robot capable of using sensors for navigation and
control. With a clear introduction, outlining the motivations, and setting the stage for the aims
and objectives. The primary goal was to design an autonomous robot capable of navigating its
environment using sensor input.
We will use the Arduino Uno board and an ultrasonic sensor. If the robot with the help of a small
servo motor, it scans the area left and right in order to find the best way to turn towards the object
Design and Justification:
The integration of sensors for environmental perception. Justifying these design choices was
crucial to ensure that each component contributed meaningfully to the robot's autonomy. The
trade-offs between simplicity and complexity, cost-effectiveness, and performance were
carefully considered to strike a balance that aligned with the project's objectives.
The choice of a wheeled chassis, for instance, was justified by its simplicity and effectiveness in
various environments. The integration of a modular design allowed for scalability and ease of
maintenance, aligning with the project's objectives of creating a versatile and adaptable
autonomous robot.
Robot Requirements:
- Size, weight, and regulatory constraints defined
- Max Robot dimensions (HxLxW) : unrestirctedx20cmx20cm.
- Max Weight: 1.5Kg.
- Key functionalities: Sensor-based navigation, opponent detection.
Components and Materials:
- Motor drive system: Utilize LN298, MC33886, or similar components for motor control.
- Microcontroller: Arduino Uno / mega board selected for its versatility.
- Motors and wheels for movement
- Chassis for the robot
- Batteries and power supply
Arduino Uno board
Motor driver (L298N)
Ultrasonic sensor (HC-SR04)
 Circuit Design:
Connecting Motors and Motor Driver
Connect Motors :
- Connect the motors to the motor driver and then connect the motor driver to the Arduino Uno.
This will allow you to control the movement of the robot.
Connect Motor Driver (L298N):
- Motor 1 connects to OUT1 and OUT2.
- Motor 2 connects to OUT3 and OUT4.
- Connect the motors to the corresponding terminals on the motor driver (labeled as M1 and M2).
 Connect Control Pins:
- Connect the motor driver's input pins (IN1, IN2, IN3, IN4) to digital pins on the Arduino Uno.
Connect Ultrasonic Sensor:
- Connect the ultrasonic sensor (HC-SR04) to the Arduino Uno:
- VCC to 5V on Arduino.
- GND to GND on Arduino.
- Trig to a digital pin (2).
- Echo to a digital pin (3).
Microcontroller:
- Arduino Uno board selected for its ease of use and compatibility with the project requirements.
. Connect power to the motor driver:
- Connect the motor driver's VCC to the Arduino 5V.
- Connect the motor driver's GND to the Arduino GND.
- Provide an external power supply to the motor driver (connect to the appropriate terminals on
the motor driver) to power the motors.
Arduino Code:
- A simple Arduino code to read data from the ultrasonic sensor and control the motors based on
the sensor's readings. You'll want the robot to detects an object using the ultrasonic sensor,and
keep following it,meaning it should move towards it, until it change its direction.
#include <NewPing.h>
#include <Servo.h>
// Define motor control pins
const int motor1Pin1 = 4;
const int motor1Pin2 = 5;
const int motor2Pin1 = 6;
const int motor2Pin2 = 7;
// Define ultrasonic sensor pins
const int trigPin = 2;
const int echoPin = 3;
// Define motor speed
const int motorSpeed = 200;
// Create an object of the NewPing library
NewPing sonar(trigPin, echoPin);
void setup() {
    // Define pin modes
    pinMode(trigPin, OUTPUT);
    pinMode(echoPin, INPUT);
    pinMode(motor1Pin1, OUTPUT);
    pinMode(motor1Pin2, OUTPUT);
    pinMode(motor2Pin1, OUTPUT);
    pinMode(motor2Pin2, OUTPUT);
}
void moveForward() {
    digitalWrite(motor1Pin1, HIGH);
    digitalWrite(motor1Pin2, LOW);
    digitalWrite(motor2Pin1, HIGH);
    digitalWrite(motor2Pin2, LOW);
}
void moveTowardsObject() {
    // move towards the detected object
}
void stopMotors() {
    digitalWrite(motor1Pin1, LOW);
    digitalWrite(motor1Pin2, LOW);
    digitalWrite(motor2Pin1, LOW);
    digitalWrite(motor2Pin2, LOW);
}
void loop() {
    moveForward();
    // Read distance from ultrasonic sensor
    int distance = sonar.ping_cm();
    // If an obstacle is detected, move towards it
    if (distance < 10) {
        stopMotors();
        moveTowardsObject();
        delay(1000);
    }
}
 Sensor Integration
- Implement sensors for navigation and opponent detection. Use the screws, and nuts to attach
the Arduino Uno board and the L298N module on chassis. Attach the tiny servo motor in front
side of robot and place ultrasonic sensor on it.
Connect the ultrasonic sensor to the Arduino Uno. The sensor has four pins: VCC, GND, Trig,
and Echo. Connect VCC and GND to power and ground respectively. Connect Trig and Echo to
two digital pins on the Arduino Uno.
Navigation Strategies
- A simple algorithm to read data from the ultrasonic sensor and control the motors based on the
sensor's readings. You'll want the robot to detects an object using the ultrasonic sensor,and keep
following it,
 - Will Address strategies for staying within the sumo arena boundaries and responding to
opponents.
Algorithm 1: Finding the Nearest Object
1. Initialize variables:
  - nearestDistance = Infinity
  - nearestAngle = 0
2. Sweep the ultrasonic sensor through a range of angles:
  a. For angle from 0 to 360 degrees (in steps, e.g., 10 degrees):
    i. Set the servo motor angle to the current angle.
    ii. Measure the distance using the ultrasonic sensor.
    iii. If the measured distance is less than nearestDistance:
       - Update nearestDistance with the measured distance.
       - Update nearestAngle with the current angle.
3. The robot now has the nearest object's distance and direction (angle).
Algorithm 2: Moving Towards the Nearest Object
1. Calculate the difference between the current heading and the nearestAngle.
2. Adjust the robot's heading:
 a. If the difference is positive, turn the robot to the right.
 b. If the difference is negative, turn the robot to the left.
 c. The magnitude of the turn can be proportional to the difference.
3. Move the robot forward with a constant speed.
4. Periodically reevaluate the nearest object using Algorithm 1.
5. If a new nearest object is found, update the nearestDistance and nearestAngle.
6. Repeat steps 2-5 for continuous navigation.
Testing and Evaluation
- Conduct systematic testing of individual components (sensors, motor drive, Arduino board).
- Uploaded the code to Arduino Uno and test the robot and Making adjustments to the code and
connections as needed to ensure the desired sumo robot behavior.
This is a basic example, and we might need to refine and add more features based on the SUMO
specific requirements and competition rules if you're building the robot for a sumo competition.
-This code uses the NewPing library for simplified ultrasonic sensor interfacing. We adjusted the
pin numbers and logic according to your specific setup and requirements.
-The Ultrasonic sensor should not be connected directly to power supply as it might affect the
normal performance.
Project Monitoring and Reporting
- Regularly monitoring progress.
   1. As the project is based on Arduino, the programming is was very easily modified.
   2. Doesn’t require the Arduino Motor Shield.
   3. When using a 9V battery, at least 2 such batteries are needed to power the robot. It is
      better to use 2 9V batteries (one for Arduino, Ultrasonic sensor, Servo Motor and the
      other one for L293D and motors).
Safety Considerations:
- the SUMO Identify potential safety risks related to motor drive systems and sensor integration.
- Implement safety measures to mitigate identified risks.
Budget:
conclusion:
In conclusion, the successful completion of this project marks a step forward in the journey
towards creating more capable and adaptive autonomous systems, this is a basic example, and we
might need to refine and add more features based on the SUMO specific requirements and
competition rules if you're building the robot for a sumo competition.