Arduino 3D Printed Sumo Bot

So I had a bunch of parts laying around my house. I wanted to participate in a sumo competition coming up in a few months but I didn't have a bot. Instead of buying a bot or using an existing design that would require me to purchase stuff for the project I went ahead and made my own bot from my own design from my own parts I had. You will need the following for this tutorial.

  1. One of each 3D printed part found here.
  2. A 7.4 volt battery or two 18650 batteries.
  3. A battery holder if needed.
  4. Arduino uno.
  5. Arduino uno breakout shield.
  6. USB cable for Arduino.
  7. Benchtop powersupply (optional).
  8. Charger (optional).
  9. Wires and lots of them.
  10. Standard sized metal gear continuous rotation servos.
  11. Two ir switch sensors.
  12. 7cm servo wheels.
  13. On and off switch.

This code is constantly being changed. The code for this robot can be found here. This is the most up to date version of this project code. Enjoy!

Step 1: Assembly.

  1. The robot uses two metal gear servos. You will want to screw them in using m3 bolts and nuts with the servos inside the chassis facing outward in both directions. There is only one way the servos can go into the robot so this will be pretty straight forward.
  2. Attach the servo wheels.
  3. Attach the ir sensors so they are facing down in the front of the robot. They are attached by two screws through the M3 holes in the front of the robot. There is slits on the bottom of the robot for them to peer through. You want to be careful the sensors don't pick up the chassis and can see all the way through the slits. You will learn more about this later as we test the robot to see if your handy work worked.
  4. Put the HC-SR04 sensor inside the two holes facing outside the robot from the inside. The holes are located in the front of the chassis.
  5. Put the Arduino Uno inside the chassis with the shield on it.
  6. Wire everything together according to the bullet list below.
    1. Power from the power source of your choice to the power switch. You will wire positive or negative lead to the switch. If you chose the negative lead this will be your ground while if you chose the positive lead that will be your power source lead. The other wire depending on whether it is positive or negative will be your positive or negative.
    2. Connect the positive lead to vin on the Arduino and the postive leads on the servos.
    3. Connect ground to ground on the servos and the Arduino.
    4. Connect 5v from the 5 volt regulator on the Arduino to all the positive terminals on each of the sensors.
    5. Wire the sensors to ground on the Arduino.
    6. Lastly wire pin 7 on the Arduino to right ir sensor, pin 6 to the left IR sensor, pin 8 to one of the servos, pin 9 to the last servo.

Warning: Failure to wire the robot correctly could lead to the robot smoking and destruction of the electronics.

Step 2: First Signs of Life.

Warning: Do not connect the robot to your computer while powered or with the servos being wired up. Failure to do so could lead to damage to your computer.

int mode = 3;

This line of code above is the crucial variable for the robot. It does the following if equal to each number listed bellow.

  1. While equal to zero the robot moves in a particular pattern.
  2. If mode is equal to one the robot prints output to the computer of each of the sensors readings.
  3. When equal to two the robot avoids edges and obstacles if it comes across them.
  4. The robot fights other bots.

These are the different modes of the robot used to test and help the robot progress. You will need to change that "3" to zero for the first step of this tutorial.

Now upload the code to the robot. You will see it moving forward, backwards, left, and right in that order.

Step 3: It Can See!

int mode = 0;

Change the following variable to "1" if the previous step has been completed. Now when connected to your serial monitor on Arduino it will print out what your robot is seeing. "0" Means for the edge sensors that it is seeing something. "1" Means it is not seeing any edges. If you notice the logic is inverted take note of that for the future steps.

Don't worry about the ping sensor. I haven't got that working yet anyways. This robot is under heavy development.

Step 4: It Can Avoid the Edge of the Table!

void Avoid(){

int sensorStateLeft = digitalRead(leftSensor);

int sensorStateRight = digitalRead(rightSensor);

delay(50);

if (Ping.ping_cm() >= 15 && sensorStateLeft == 0 && sensorStateRight == 0){

left.write(0); right.write(90);

}

if(Ping.ping_cm() <= 15 && Ping.ping_cm() != 0 || sensorStateLeft == 1 || sensorStateRight == 1) {

left.write(90);

right.write(0); }

}

This code above is the code summoned when mode equals two. If the previous step has been completed change mode to equal "2".

If the sensors are inverted feel free to invert "sensorStateLeft" and "sensorStateRight" in each of the "if" statements to equal a different number than they were given that is either "1" or "0".

Now the robot can avoid the edge of a sumo arena. It is almost ready to battle. Feel free to test it out to see if it works or not.

Step 5: BATTLE!

Your sumo is ready to battle now with a few code changes. Change mode to be equal to "3" and invert the logic as necessary in the void "Sumo". Now your robot should be avoiding the edge of the arena but cannot detect other robots. It basically avoids the edges of the arena and moves fast enough that it can hopefully push a robot off the edge of the table. Enjoy!

Step 6: Conclusion!

Your robot is done now. If there are any problems or comments for this project feel free to let me know. I am incredibly beyond belief open to feedback because I have no idea if this was a well done tutorial or not. Enjoy!

Arduino Contest 2019

This is an entry in the
Arduino Contest 2019

Share

    Recommendations

    • Tape Contest

      Tape Contest
    • Arduino Contest 2019

      Arduino Contest 2019
    • Trash to Treasure

      Trash to Treasure

    Discussions

    0
    None
    pablo de paris

    9 hours ago

    I love this project. I will use it for my students next year. Thank you Noah for sharing your awesome project. You have my vote!!