Introduction: TCPL Autonomous Robot Wrestling

About: Tompkins County Public Library (Ithaca, New York), founded in 1864 by Ezra Cornell, serves the 104,926 residents of Tompkins County and is the Central Library for the Finger Lakes Library System, serving libra…

Over the past several years the Tompkins County Public Library has offered learning how to code through battling Arduino-powered robots. These robots are inspired by the robotics competition in Japan known as Sumobots. TCPL's wrestling robot program has gone through several iterations. It started with robots remote-controlled through a Bluetooth app, see the last two images. Next, TCPL developed a general-purpose robotics platform that could have various attachments and introduced sensors for autonomous functions, see image 4. Later on, the club added hobby electronics found in combat robots to make non-destructive antweight bots, see image 3. This year TCPL has developed an easy-to-print modular system focused on robot wrestling, see the first two images. In this system, participants upload Scratch code through mBlock to an Arduino Nano that sets a pattern of behavior their robot will follow. The script is pre-written and covers concepts of receiving data from sensors, control flow, and how to use the internal clock for movement timing. In this Instructable, you will learn how to print, build, and code your own 3D Printed Autonomous Wrestling Robot.

Supplies

Skills

  • Soldering wires together and pins to PCBs. You may be able to find the Arduino Nano and the motor driver pre-soldered.
  • Using Wire strippers.
  • Slicing 3D models.
  • 3D printing.
  • Uploading code to an Arduino. Covered in Step 9.

Tools

  • Wire Stripper
  • Plastic Nippers
  • Phillips Head Screwdriver
  • Hot Glue Gun
  • Soldering Iron
  • USB Mini B Cable
  • 3D Printer

Parts

TCPL Wrestling Robot 2.0

Step 1: 3D Printing

At TCPL we are privileged to have access to a Prusa Mini. You can print this model on any machine that uses PLA. Here are the settings we use on the Prusa:

  • Quality 0.20mms
  • Infill 15%
  • Supports Build Plate Only
  • Brim: Yes

The TCPL Robotics Club has also had success printing several of these robots in both PLA and ABS on the Ender 3 using Draft mode.

If you do not have access to a 3D printer please check your local library, makerspace, and/or university for services. Many public libraries have free or inexpensive 3D printing services available.

Once the parts have been printed remove the single support from the sensor connector piece, see image 3. After cleaning off the support test fit wheels and sensor. The sensor has a very loose fit on purpose to help it absorb impact when it crashes into another bot. If the wheels are a bit tight you can use a file or automotive sandpaper to remove some of the surface.

Step 2: Soldering

Motors

  1. Take a red, black, orange, and brown wire. Snip off the end with the pin, see image 2.
  2. Strip the cut ends of each wire so they match the size of the motor's terminals.
  3. Apply solder to each stripped end of the wires.
  4. Apply solder to the terminals on each motor, see image 3.
  5. Solder a red and black wire to one motor and orange and brown to the other, see image 4.


Power Distribution

  1. Take a red and black wire and cut them in half.
  2. Strip the cut ends of each wire's halves.
  3. Strip the red and black wire ends coming from the 9v battery.
  4. Take the stripped ends of each red wire and the one coming from the battery case and twist them together.
  5. Do the same for the black wire.
  6. Solder the black wires together then the red ones, last image.

Step 3: Building the Chassis

Preparing the Chassis:

  1. Attach the motors to the chassis by aligning the two holes and threading two 35mm M3 screws through them.
  2. The terminals on both motors should be facing away from the chassis. The bell of the motor, the black plastic end, should be facing the end of the chassis with the three holes on top, see the first two images.
  3. Screw the screws on both motors until you can just fit the bolts on, then tighten them until they can no longer rotate, see image 3.
  4. Using three 10mm M3 attach the sensor plate, see images 4 and 5. The smooth side of the sensor plate faces away from the chassis.
  5. Using plastic nippers cut off the protruding holes at the back of each motor, see image 6.
  6. Lace the black and red wires from the battery case through the slit closest to the rear of the chassis, see image 7.
  7. Using hot glue adhere the battery pack to the rear of the motors making sure to leave enough room for wires to slide between it and the chassis, see images 7 - 9.
  8. Lace the motor wires through the center slit in the chassis, see images 10 -14.

Step 4: Attach Sensors

Ultra Sonic Sensor

  1. Slide the HC-SR04 sensor into the wedge with its pins facing up.
  2. Flip over the chassis and partially screw in two 10mm M3 screws into the left and right holes on the sensor plate.
  3. Slide the wedge with sensors onto the screws. Tighten the screws down, see images 1-2.

IR Sensor

  1. Take an orange, brown, and purple wire.
  2. Insert the VCC pin on the TCRT5000 sensor into the orange wire.
  3. Insert the GND pin on the TCRT5000 sensor into the brown wire.
  4. Insert the DO pin on the TCRT5000 into the purple wire, see Image 4.
  5. Slide the wire through the center slit in the chassis.
  6. Align the TCRT5000 so the sensor LEDs face the bottom of the robot and screw it into the remaining hole on the sensor plate. Do not fully tighten the screw you will want the sensor to have some movement for it to adjust to whatever surface you use it on, see images 5 - 6. Instructions on how to make an arena are discussed later in Step 10 of this instructable.

Step 5: Add Arduino and Motordriver

Arduino:

  1. Rotate the robot so it's upright.
  2. The front of the robot is where the wedge and HC-SR04 are located.
  3. Adhere the mini breadboard to the top and front of the robot, see image 1.
  4. Insert the Arduino Nano so the digital pins face the front and have two sets of pin rows in their columns, see image 2.

DVR8833 Motor Driver:

  1. Using hot glue adhere to the DRV8833 motor driver to the chassis so it is adjacent to the rear of the mini breadboard.
  2. The VCC and GND pins on the motor driver should be closest to the mini breadboard, see the last image.

Note: I apply the hot glue to the DRV8833 along the solder point of each pin. You can remove this hot glue later by wetting it with rubbing alcohol. Please use safety and proper equipment when handling rubbing alcohol.

Step 6: The Cricuit

Please use the images to follow along. The following steps are numbered to the images.

  1. Take the red wires coming from the 9v battery case. Take the end with the input and attach it to the VCC pin on the DRV8833 motor driver. Take the remaining wire with the pin and insert it into the mini breadboard adjacent to the VIN pin on the Arduino Nano.
  2. Take the black wires coming from the 9v battery case. Take the end with the input and attach it to the GND pin on the DRV8833 motor driver. Take the remaining wire with the pin and insert it into the mini breadboard adjacent to the GND pin on the Arduino Nano.
  3. Using a purple wire attach its input side to the D0 pin on the TCRT5000. Insert the pin of the attached purple wire into an input on the mini breadboard adjacent to the D12 pin on the Arduino Nano.
  4. Using a brown wire attach its input side to the GND pin on the TCRT5000. Insert the pin of the attached brown wire into an input on the mini breadboard adjacent to the GND pin on the Arduino Nano.
  5. Using an orange wire attach its input side to the VCC pin on the TCRT5000. Insert the pin of the attached orange wire into an input on the mini breadboard adjacent to the 5V pin on the Arduino Nano.
  6. With the front of the robot facing you take the two wires coming from the right motor, your right, not the robot's. and insert one into OUT3 and the other into OUT4. Do not worry about which right motor wire goes where, you will adjust this after uploading the script.
  7. With the front of the robot facing you take the two wires coming from the left motor, your left, not the robot's. and insert one into OUT1 and the other into OUT2. Do not worry about which left motor wire goes where, you will adjust this after uploading the script.
  8. Using a blue wire attach its input to the IN1 pin on the DRV8833 motor driver. Take the attached blue wire and insert its pin into the mini breadboard adjacent to the D10 pin on the Arduino Nano.
  9. Using a purple wire attach its input to the IN2 pin on the DRV8833 motor driver. Take the attached purple wire and insert its pin into the mini breadboard adjacent to the D9 pin on the Arduino Nano.
  10. Using a green wire attach its input to the IN3 pin on the DRV8833 motor driver. Take the attached green wire and insert its pin into the mini breadboard adjacent to the D6 pin on the Arduino Nano.
  11. Using a yellow wire attach its input to the IN4 pin on the DRV8833 motor driver. Take the attached yellow wire and insert its pin into the mini breadboard adjacent to the D5 pin on the Arduino Nano.
  12. Using an orange wire attach its input to the VCC pin on the HC-SR04 sensor. Take the attached orange wire and insert its pin into the mini breadboard adjacent to the 5V pin on the Arduino Nano.
  13. Using a brown wire attach its input to the GND pin on the HC-SR04 sensor. Take the attached brown wire and insert its pin into the mini breadboard adjacent to the GND pin on the Arduino Nano.
  14. Using a purple wire attach its input to the Trig pin on the HC-SR04 sensor. Take the attached purple wire and insert its pin into the mini breadboard adjacent to the D7 pin on the Arduino Nano.
  15. Using a white wire attach its input to the Echo pin on the HC-SR04 sensor. Take the attached white wire and insert its pin into the mini breadboard adjacent to the D8 pin on the Arduino Nano.
  16. Your circuit is complete and your robot should have a fun hairdo of wires!

Step 7: Add Wheels and Traction

Slide a rubber band into each wheel. Apply a thin layer of hot glue under the rubberband to prevent it from slipping off the wheel. Slide wheels on so the protruding circle is facing the motor.

Step 8: Install Mblock and Prepare Environment

In your favorite browser navigate to https://www.mblock.cc/en/. Select Download on the topmost ribbon. Navigate to your operating system and select the download option. Once downloaded open the installer and follow the prompts. At the time of writing this Instructable mBlock is in V5.4.3, this may be different for you. Install the latest version and you should be good to go. You may also want to restart your computer after the installation process.

Step 9: Edit and Upload Code

SETUP:

Once mBlock has downloaded you will need the pre-written code. You can find the script here: https://drive.google.com/drive/folders/1c06kuLu3ujh788gS884428PngjDkNiKr?usp=sharing

Note: The following steps you will only need to do once.

  1. Download the SUMOGEN3.mblock.
  2. Open the mBlock application and navigate to Devices and delete the CyberPi by selecting the 'x'.
  3. Select the blue plus icon.
  4. In the popup menu locate and install the Arduino Nano by selecting the blue plus icon and then clicking 'ok'.
  5. Navigate back to devices and select the Add option.
  6. Find the Arduino Nano (old) and install it by selecting the blue plus icon and then selecting 'ok'.
  7. Once you have both Arduino Nanos close the program.

UPLOAD TEST CODE:

  1. Navigate to where you saved the SUMOGEN.mblock file.
  2. Open the file and the mBlock application will open showing the pre-written code.
  3. If the code is not visible use the zoom out button, the blue minus icon on the lower right of the screen.
  4. Find the stack of code that has a note saying, "Gaming Loop". The forever loop block is where you will put all your robot's code in.
  5. Take the forward block and attach it to the inside of the forever loop.
  6. Repeat these steps for the Arduino Nano(old) device too.
  7. Select the Arduino Nano and insert the USB cable into your device and then into the Arduino on the robot.
  8. Navigate to Devices, make sure Upload is selected, and then click Connect.
  9. Check the "Show all connectable devices".
  10. The Com number may be different for you, select connect.
  11. You will see the Device has a new option Upload Code. Select this to upload the code.
  12. If you get an error you will need to change to the other Arduino device. Select Disconnect from Device and then repeat the steps 8 - 11.
  13. Once the upload is complete and the popup leaves the screen you are ready to test.
  14. Remove the USB cord from the robot, insert the 9v battery, and power it on. The wheels will not start moving until after a 2-second pause.
  15. If both wheels are driving forward you are ready to upload more code and battle. Otherwise, locate where the motor driving in reverse is attached to the motor driver. Locate the OUT pins and swap them. For example, if the motor going in reverse is attached to OUT 3 and 4 remove them and replace them in reverse order.
  16. To keep the robot still while you attempt to upload more code or reverse the motor you can remove the VCC wire from the motor driver. Just make sure to replace this when you are ready to battle.

HOW TO CODE THE WRESTLING ROBOT:

  1. Navigate to the My Blocks tab to see all the different behaviors you can have your robot perform.
  2. Select any number of behavior blocks to program how your robot will move around the arena. Blocks are read top to bottom and left to right in the forever loop a.k.a the gaming loop. Once the last block is read the robot will start with the first block again until you power it off.
  3. Use the blocks that allow you to input a number. The number represents seconds and decimals milliseconds.
  4. You can also adjust the speed of each behavior block you use by placing a SpeedUp block before the action you want to adjust. The robots use PWM to control each motor's speed. PWM is a whole number between 0 and 255. 0 is off and 255 is max speed. A good range to choose from is 100, crawling, to 255, attacking.
  5. To adjust the range the robot sees an object using its ultrasonic input any whole number between 1 - 400 into the variable "distance". You can find all the variable blocks attached above the forever loop. These values represent centimeters.
  6. If you find the robot's arena edge detection movements too fast or slow you can adjust the PWM value in the variable "Esc_Speed".
  7. Once you have the movements you want upload your code and see how it reacts in the arena.

Note: the code for changing how the robot reacts to white and black surfaces is in the next step.

Step 10: Making an Arena

There are several ways you can make and/or purchase an arena. The most budget-friendly is to use foam board and electric tape. You can also order a custom one using the PNG file included in the drive folder. There are also arenas you can purchase from robotshop.com.

Build an Arena:

Materials:

  • 4x 20 x 30 Foam Board
  • Roll of packing tape
  • Roll of electrical tape
  1. Lay out foam board so they make a 40 x 60 rectangle.
  2. Using the packing tape, tape the boards together.
  3. Cover the surface with the rest of the packing tape
  4. Line each edge with electrical tape. The black line at the arena's edge should be two electrical tape strips thick.

Custom Order an Arena:

Links:

Amazon custom 3'x3' vinyl banner

TCPL Robot Wrestling Folder

  1. Navigate to the link.
  2. Make sure the 3'x3' option is selected.
  3. Select Customize Now.
  4. Upload PNG of the arena.
  5. Order arena.

How to Adjust the Robot for Black or White Surfaces:

  1. The robot's code is set to work with a black surface and white boundaries. To change this locate the variables "Barrier" and "surface". You can find all the robot variables attached above the forever loop.
  2. For a white surface and black boundaries set "Barrier" to 1 and "surface" to 0.
  3. For a black surface and white boundaries set "Barrier" to 0 and "surface to 1.


Step 11: Running an Event

There are many different ways these wrestling robots can be used for events and STEM programming. Over the years TCPL has used these kinds of robots to teach electronics, coding, and 3D printing to patrons of all ages. Here are a few brief overviews of past library programs:

  • Weekly classes where tweens learned the basics of C++ through Arduino. Each class would cover the basics of C++ syntax and how to apply it to the robot. For example, week 1 covered variables and using functions from a given library. Using the syntax learned, the participants programmed their wrestling robot to execute basic movements like forward, spin, turn, etc. The class concluded with each participant writing a script that engaged all the components attached to the wrestling robot.
  • Monthly meetings where patrons of all ages learn how to edit mBlock Scratch scripts and compete in a robot fighting tournament. At TCPL, we offer this type of program to gain interest in the club and find new members while giving regular participants the chance to compete.
  • In collaboration with the Girls Who Code at the Women In Computing at Cornell, we turned these robots into kits and over eight weeks had participants learn how the robot works through circuitry. We also gave participants the chance to learn Tinkercad by designing upgrade parts for their robots. The collaboration ended with a friendly double-elimination tournament.

In 2024 TCPL is using the robots to offer weekly open hours for youth aged 8 - 11, teens 12 - 19, and families. With the help of an amazing volunteer crew, we run new participants through the basics of Scratch and give regulars new challenges and resources they can pursue to further their skills in coding. The following is a seven-week breakdown of the TCPL Robotics Club Wrestling Robots program.


Program Overview

Title: TCPL Robotics Club Wrestling Robots

Location:The Makerspace and Digital Lab

Participation Level: up to 45 participants with both rooms and 20 with just the Makerspace.

Registration Type: Open Hour first-come-first-serve.

Age Range: Families with youth younger than 8, youth 8 - 11, and teens 12 - 19.

Equipment:

  • 15 Windows laptops
  • 20 Wrestling robots, more participants than robots form teams of 2 - 3.
  • 20 USB cables
  • 40 Rechargeable 9v batteries
  • 5x Battery chargers
  • Spare 3D printed parts
  • 5 hot glue stations
  • 5 soldering stations
  • 10 Screwdrivers + extra screws and nuts
  • 1 Large circle arena, black surface with white boundary, fits 8 robots.
  • 1 Large rectangle arena, white surface with black boundaries, fits 6 robots.
  • 4 Small circle arenas, black surface with white boundaries, fit 3 robots.
  • 1 Large display monitor with presentation laptop.

Volunteer Participation: 4 - 8

Volunteer Skills/Interest:

  • Youth Leadership
  • STEM/ STEAM Education
  • Engineering
  • Recreation Leadership
  • Technology
  • Inclusivity
  • Makerspaces
  • Community Outreach
  • Education

Duration: Weekly for 1.5 hours. The program ends after 7 weeks.

Organizational Goal: Provide youth within the FLL system with free hands-on digital literacy, coding, and engineering through open-source robotics.

Organizarional Objectives:

  1. Participants learn how to adjust pre-written code and successfully upload it to a robot.
  2. After programming the robot participants compete in at least one match against 1 - 7 opponents.
  3. Participants address one of several provided resources, books, online coding challenges, and video guides.
  4. Participants show excitement in STEM through engaging with each other, cheering on their robot, and/or seeking out further STEM-related resources.

Lesson Plan

Week 1:

  • 10 min: Introductions and greetings. Icebreaker, what do want to learn about robots?
  • 20 min: quick tutorial on how to edit the mBlock script to have your robot perform three different movements for 1 second each.
  • 10 min: a quick hands-on tutorial on how to upload the script to a robot.
  • 20 min: participants observe how their robots behave then return to edit the script. At this point another quick tutorial is given on how to make the robot perform each action for a certain amount of time.
  • 20 min: free battles, participants are encouraged to test out each arena and observe how they do against varying levels of opponents.
  • 10 min: water break and repairs. Instructors, volunteers, and participants interested assist with making adjustments to robots that are damaged.
  • 20 min: more free battles and participants are encouraged to edit their scripts along the way.
  • 10 min: Homewards bound.

Week 2:

  • 10 min: Introductions and greetings. Icebreaker, what is your favorite robot from a book, movie/ show, or videogame?
  • 20 min: Returning participants are given a tutorial on adjusting the speed and range of their robots by adjusting variables in the script. New participants are given the first week's tutorials to learn how to adjust their robots.
  • 10 min: Participants are encouraged to experiment with their code until their robot performs the way they want it to. New participants can be introduced to adjusting speed and range during this time.
  • 20 min: Participants participate in free battles.
  • 10 min: water break and repairs. Participants returning from last week who did not help with repairs are encouraged to join in.
  • 10 min: Battle royals, break the participants into groups of 8. Each group battles it out in the large circle arena until one remains.
  • 10 min: homeward bound.

Week 3:

  • 10 min: Introductions and greetings. Icebreaker, what coding language would you like to learn?
  • 20 min: Returning participants are given a tutorial on how to adjust the robot to battle on an arena with a white surface and black boundaries. New participants are given the first week's tutorials to learn how to adjust their robots.
  • 10 min: Participants are encouraged to experiment with their code until their robot performs the way they want it to. New participants can be introduced to adjusting their robots to work on the arenas with a white surface and black boundaries during this time.
  • 20 min: Participants break into groups around the arenas they want to compete in. A large arena for battle royals, A large arena for battle royals on a different surface, and small arenas for 1-on-1 battles. Battles commence and volunteers help judge at each arena.
  • 10 min: water break and repairs. Participants returning from last week who did not help with repairs are encouraged to join in.
  • 10 min: Battle royals, break the participants into groups of 8. Each group battles it out in the large circle arena until one remains.
  • 10 min: homeward bound.

Week 4:

  • 10 min: Introductions and greetings. Icebreaker, what kind of app would you like to make someday?
  • 30 min: Returning participants are introduced to how the TCRT5000 sensor works. New participants are given the first three weeks of tutorials to learn how to adjust their robots.
  • 10 min: Participants are encouraged to experiment with their code until their robot performs how they want it to.
  • 15 min: Participants break into groups around the arenas they want to compete in. A large arena for battle royals, A large arena for battle royals on a different surface, and small arenas for 1-on-1 battles. Battles commence and volunteers help judge at each arena.
  • 10 min: water break and repairs. Participants returning from last week who did not help with repairs are encouraged to join in.
  • 15 min: Participants return to their respective arenas and continue battling.
  • 10 min: Battle royals, break the participants into groups of 8. Each group battles it out in the large circle arena until one remains.
  • 10 min: homeward bound.

Week 5:

  • 10 min: Introductions and greetings. Icebreaker, If you could make a firefighting robot what would it be?
  • 30 min: Returning participants are introduced to how the HC-SR04 sensor works. New participants are given the first three weeks of tutorials to learn how to adjust their robots.
  • 10 min: Participants are encouraged to experiment with their code until their robot performs how they want it to. A quick overview of how the TCRT5000 sensor can be given to participants who missed the prior week.
  • 15 min: Participants break into groups around the arenas they want to compete in. A large arena for battle royals, A large arena for battle royals on a different surface, and small arenas for 1-on-1 battles. Battles commence and volunteers help judge at each arena.
  • 10 min: water break and repairs. Participants returning from last week who did not help with repairs are encouraged to join in.
  • 15 min: Participants return to their respective arenas and continue battling.
  • 10 min: Battle royals, break the participants into groups of 8. Each group battles it out in the large circle arena until one remains.
  • 10 min: homeward bound.

Week 6:

  • 10 min: Introductions and greetings. Icebreaker, What would you choose if you could invent a robot that mimicked an animal?
  • 30 min: Returning participants are introduced to how the DRV8833 motor driver works. New participants are given the first three weeks of tutorials to learn how to adjust their robots.
  • 10 min: Participants are encouraged to experiment with their code until their robot performs how they want it to. A quick overview of how the HC-SR04 sensor can be given to participants who missed the prior week.
  • 15 min: Participants break into groups around the arenas they want to compete in. A large arena for battle royals, A large arena for battle royals on a different surface, and small arenas for 1-on-1 battles. Battles commence and volunteers help judge at each arena.
  • 10 min: water break and repairs. Participants returning from last week who did not help with repairs are encouraged to join in.
  • 15 min: Participants return to their respective arenas and continue battling.
  • 10 min: Battle royals, break the participants into groups of 8. Each group battles it out in the large circle arena until one remains.
  • 10 min: homeward bound.

Week 7:

  • 10 min: Introductions and greetings. Icebreaker, What kind of robots should TCPL offer next?
  • 30 min: Returning participants are introduced to how the Arduino Nano works. New participants are given the first three weeks of tutorials to learn how to adjust their robots.
  • 10 min: Participants are encouraged to experiment with their code until their robot performs how they want it to. A quick overview of how the DRV8833 motor driver works can be given to participants who missed the prior week.
  • 15 min: Participants break into groups around the arenas they want to compete in. A large arena for battle royals, A large arena for battle royals on a different surface, and small arenas for 1-on-1 battles. Battles commence and volunteers help judge at each arena.
  • 10 min: water break and repairs. Participants returning from last week who did not help with repairs are encouraged to join in.
  • 15 min: Participants return to their respective arenas and continue battling.
  • 10 min: Battle royals, break the participants into groups of 8. Each group battles it out in the large circle arena until one remains.
  • 10 min: homeward bound and trophies.

Resources:

How a TCRT5000 Sensor works.

How a HC-SR04 Sensor Works.

How a DRV8833 motor driver works.

What is an Arduino Nano?

Robot projects to make at home.

Where to get mBlock tutorials?