
In this basic version of SumoBot wrestling, students will use micro:bit tilt controllers to make the cyber:bot robots push against each other. The match winning team will be the one whose cyber:bot pushes the other one out of the ring. This contest can also be expanded with various customizations, like a 3D printed plow, and adjustments to the wheels to make them grip better.
(1) cyber:bot Robot Kit – with micro:bit
You will be able to:
One set for each student or team of students
(1) cyber:bot Robot Kit – with micro:bit (assembled and tested)

(1) USB A to Micro-B cables (assuming two teams will use two different computers).
The cyber:bot kit comes with a cable that’s much longer than the one in the micro:bit kit.

(1) micro:bit v2 Go Bundle, which contains:
(1) micro:bit Module

(2) AAA battery pack

(2) AAA batteries

Start by getting the tilt control application running for each cyber:bot robot.
Load the batteries into the battery pack making sure to match the +/- diagram inside the battery pack.
Using the SumoBot Wrestling page as a reference:
The existing wheel and tire can be modified, or a a number of separate SumoBot Wheel & Tire kits can be purchased and/or modified.
If your class has access 3D printer and CAD software, designing a plow can be part of the contest. Here is an example: A Thingiverse Parallax Shield-Bot Front Scoop that will fit on the cyber:bot.


The cyber:bot doesn’t need remote control for sumo matches; it can also compete autonomously. As an autonomous Sumo-cyber:bot, it will use sensors to detect its opponent and the white line that surrounds the sumo ring. The script will make it:
]
(1) cyber:bot Robot Kit – with micro:bit
(0.5) QTI Line Follower AppKit for the Small Robot (One of these kits can be split between two cyber:bot robots.)
You will be able to:
Functions with parameters can allow you to set not only wheel speeds but run times. The can also adjust for making the right wheel turn the opposite direction to give you a more intuitive set of statements. Here is an example of a function call that makes the cyber:bot roll full speed forward for 3 seconds. Note that the right wheel speed is no longer negative. The rule for the maneuver function is that positive values are for forward, for either wheel. The 3rd argument (3000) is the number of milliseconds to execute the maneuver.


On line 5, the maneuver function definition has three parameters: vL (velocity left) vR (velocity right), and t (time, in milliseconds). The three arguments in the function call on line 12 get passed to those parameters. Likewise with the function call on line 13. Line 7 takes the negative of vR, which is how the function takes positive values for forward and negative ones for backward. The if vR is not None: statement prevents the vR = -vR statement from being executed when vR is None. vR = -None would cause an exception because None is not a number and does not work with arithmetic operators.

Allowing the motors to come to a full stop can make maneuvers more predictable. This next script makes the cyber:bot go forward, left, right, left, backwards, stop. Between each actual maneuver, there’s a call setting the wheel speeds to None for 0.5 s. This allows the wheels to come to a full stop before the next maneuver.

While your cyber:bot SumoBot is searching for its opponent, splitting up maneuvers into little pieces will be important. By checking the sensors between each 26 ms maneuver() call, your bot can keep rolling while searching for an opponent. Here is an example where the cyber:bot calls the maneuver function 100 times, which takes about 2.6 seconds. Adding sensor measurements between each call will make it take longer, but your robot will still be able to check for its opponent or the sumo ring’s border many times per second. More about this in upcoming activities.

Since the infrared detectors are busy looking forward for opponents, how can the cyber:bot detect the edge of the SumoBot ring and turn away. One way is with the QTI line sensors, which can detect the difference between black and white surfaces.
Two sets of the parts below come with each QTI Line Follower AppKit for the Small Robot kit.
6 jumper wires: 2 each – red, blue, black
2-each of the parts shown in the picture

Attach the QTIs to the bottom of the robot as shown.

This is the schematic for the left and right QTIs. You will see how they are connected in the Wiring section.

Connect the servo extension cables to the QTIs, making sure that the white wire is plugged into the W pin, the red wire is plugged into the R pin, and the black wire is plugged into the black pin.
Double check this for both QTIs

Run the servo extension cables through the space between the tail ball and chassis.

Connect the extension cables to the 3-pin headers.
Make sure the cables do not cross at any point. This will ensure the P8 I/O pin is connected to the left QTI and the P7 I/O pin is connected to the right.
Make sure the servo extension cables are plugged onto the 3-pin headers so that the black wires are plugged onto the pins that share the same row.



If the lights do not behave as expected, double check all electrical connections and each line of code.
Don’t worry about errors on lines 15 and 16. The micro:bit module’s MicroPython runtime engine handles it just fine even though the editor’s syntax checker doesn’t recognize it.


Adjust speeds up to +/- 115.
If one QTI sees the line, try tuning so that it turns away by about 120°.
If both QTIs detect in at the same time, it’s best to have the cyber:bot turn closer to 180°.
Here, you will add the infrared detection circuits to the QTIs. With this, your cyber:bot SumoBot will have a way to detect and charge an opponent AND detected and avoid the edge of the sumo ring.
Parts List
(2) IR receivers
(2) IR LEDs (clear case)
(2) IR LED shield assemblies
(2) Resistors, 220 Ω (red-red-brown)
(2) Resistors, 2 kΩ (red-black-red)
(misc) Jumper wires
Gather the parts in the Parts List, using the drawings below to help identify the infrared receivers, LEDs, and shield assembly parts.

Make sure you are using infrared LEDs and not phototransistors. The infrared LED has a taller and more rounded plastic dome:

The infrared LEDs are designed to sit in the standoff tubes a certain way. The flat spot on the LED dome matches a flat ledge inside the tube. Holes on the bottom of the tube are labeled for the anode (+) and cathode (-) leads.

Each IR object detector requires its own IR LED and IR receiver, mounted together on a corner of the breadboard closest to the very front of the cyber:bot.
Note that the anode lead of each IR LED connects to a 2 kΩ resistor (red-black-red). Also note that each IR LED and each IR receiver has its own ground connection wire. In the diagram, the IR LED ground wires are shown in blue to help tell them apart.


Watch your IR LED anodes and cathodes!
The anode lead is the longer lead on an IR LED by convention. The cathode lead is shorter and mounted in the plastic case closer to its flat spot. These are the same conventions as the red LEDs in the kit.
In this activity, you will build and test IR object detection circuits and then write a script to make the cyber:bot charge an opponent based in object detection.


If the lights do not behave as expected, double check all electrical connections and each line of code.
Follow the instructions in the Check for IR Interference page.
This will be important
Follow the instructions in the Series Resistance and Range page. Return here when you are done.
Here are some general infrared navigation examples:
For best results against a competitor, adjust the IR LEDs and receivers so that they point straight ahead.


This script combines these two functionalities:
It is good for basic autonomous sumo with the cyber:bot if the basic rules are used where the match starts with the robots start by facing each other.

This is not a competition script, it just demonstrates how using a scan function to “look around” for an opponent could work.
The scan function checks for an opponent every 30 ms as it executes a list of maneuvers. Each maneuver is a list that you can use to set the left and right wheel speeds and the number of 30 ms time increments each maneuver should last.
On the sumo ring, this script will just cause the SumoBot to alter its direction slightly when it “sees” an object. It also turns away from the white borders.

This script integrates the scan function into cyberbot_sumo_autonomous_basic from the Basic Autonomous Sumo page. Adjust the scan function to give your cyber:bot SumoBot an advantage in the ring. This is especially useful for more advanced contest rules where the orientation of the cyber:bot SumoBot robots are drawn at random.
