Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
A brief overview of the systems that make up a sumo bot
This tutorial is aimed at teaching newcomers to Comet Sumo all of the essential things one needs to know about designing a sumo robot from start to finish. At its core, a sumo robot can be broken up into three subsystems: mechanical, electrical and software. First, the mechanical system is the structure and body of the robot, the robot’s chassis in other words. Second, the electrical system represents the vital organs of the robot that perform different tasks. Lastly, the software side is the soul of the robot, how it will seek to outmaneuver the opponent in a fight.

Every good robot starts with a parts list
In the beginning of any robotics project, the first thing you and your team needs to decide is what parts are necessary in order for the robot to function properly and accomplish its goals. Now applying this thought to a sumo bot, one finds that the aspirations of a sumo bot are quite simple; when an enemy robot is in its sensor's range, it will try to push it outside of the ring to score a point.
When watching a live robot sumo match for the first time, you might have certain questions pop up like:
How does the robot detect another robot?
How does the robot know not to accidentally go off the edge of the ring?
How is the robot able to move without a human behind a remote?
These questions will all be answered in the following sections where we cover what are considered the basic components needed to build a sumo bot. After choosing what parts you want to put in your robot, we will then learn to assemble those parts into a schematic to better understand how everything is connected.
The brain of the robot
Like our brain, a microcontroller is responsible for processing loads of information it receives from inputs, stores away data in its memory, and tells different outputs what to do. However, a microcontroller refers to only the computer that makes up a small part of a larger embedded system. A fully fledged microcontroller board that will support connections to all of our sensors, motors, motor drivers, and all other hardware interfaces is what our robot needs.
STM32
ESP32
Arduino
Teensy
These are among a few of the most popular brands used for robot sumo and robotics projects in general. The microcontroller boards sold out there are generally very diverse and specialized for a variety of purposes, so the specs of your board should meet the requirements of your robot. We could really go on endlessly about this subject. In general, these are a few things you should consider when selecting a board: size, number of input/output pins, clock speed, peripherals, and cost.
This will never not be a consideration for our sumo bot. Ideally, choose a board that is small enough while leaving room for other parts that will eventually go on your PCB (more on this in later sections).
Consider the number of sensors, motors, and other devices you plan to attach to the microcontroller. A board like the is absolute overkill for a mini sumo bot (Not to mention too large).
Clock speed
When starting out, this isn't a huge consideration. Arduino works just fine for a sumo bot. Of course, a microcontroller with very clock speeds like Teensy will allow for faster response times and technical movements.
In addition to the number of I/O pins you want, peripherals are another consideration. Peripherals include other parts in microcontroller that help perform a specific task such as pulse width modulation (PWM), UART, I2C, ADC, SPI, etc.
As always consider cost in your budget. Microcontroller boards usually range from $10-$30. Typically, higher end microcontrollers support better performance and other hardware requirements.


mapping out the robot's electronics
Now that we have a complete list of electronics and have an estimate of our bot's power needs, we now need to outline how everything will go together in a schematic. A schematic is essentially a blueprint for the circuit inside the sumo bot, labeled with everything we need to know about pin connections. This schematic will be directly referenced from in a later section when we start designing your bot's PCB. For now, let's talk about the tool we will be using to design our schematic, KiCAD. KiCAD is a free electronic design automation (EDA) software that can be used to make electrical schematics and PCBs. Other popular options exist such as Altium, OrCAD, Eagle, and EasyEDA, but in this tutorial we will stick to KiCAD since it's free, easy to use, and pretty versatile.
KiCAD can be downloaded for Windows, MacOS, and Linux. The latest version of KiCAD can be installed by following the download link: . After downloading the installer, follow the guided instructions for your operating system.
Upon opening the KiCAD for the first time, you will be led to the Project Manager. To create a project, click on File -> New Project. Then, navigate to the location you want to create your project and give it your preferred name. Make sure the Create a new folder for your project box is ticked.
Sometimes we need to step down the voltage
The battery's voltage will unlikely match the voltage used by some of our parts, specifically the microcontroller (STM32 Nucleo32 boards accept 7V-12V on VIN, but it would be wise to avoid hitting maximum ratings). To get around this problem, we should use a voltage regulator to drop the voltage to a stable output that is desirable for our parts. There are two common types of step-down regulators that are sold: low drop-off (LDO) regulator and buck converters.
LDOs are a type of linear DC regulator that does as the names suggest. Take a voltage input and output a lower, fixed voltage.
plug and play, easy to assemble on PCB
Less expensive
better for small power requirements
Less power efficient than buck converters
Buck converters are a type of DC-DC converter (which means they use a switching device as a MOSFET transistor) that lowers a voltage input while also increasing output current. They are generally more power efficient than linear regulators but come at cost of increased complexity, sometimes needing an additional inductor.
more energy efficient (about 90%)
better for large power requirements
allows for variable voltage output
costlier, usually requires extra parts to assemble
When choosing a voltage regulator, make sure of the following:
the voltage regulator accepts the input voltage from your battery
can output the correct voltage you are looking for.
check the datasheet for suggested layout of components.

This section covers the basics of C++ programming on microcontrollers using the Arduino framework and is encouraged for members new to programming on embedded systems. We will cover topics such as polling, interrupts, pulse width modulation (PWM), communication protocols such as I2C, as well as implementing a state machine software model.
For easily starting/stopping your robot from a distance
It's often the case we want quickly stop or start our sumo bot both before and after the match. In 3kg sumo, this is most definitely needed as robots in this division can move extremely quick.
RoboGames rules for autonomous sumo classes prohibits the use of remote control during the match.
Wireless remote control can be done in two ways: with infrared (IR) or radio frequency (RF) receivers and transmitters. On our robot, we will need to attach a receiver to its board while a remote (the transmitter) is controlled by the person holding it. We do not have any specific recommendations for receivers/transmitters, but I would recommend this robot start module JSUMO sells that makes starting/stopping your robot simple in case you don't want to deal additional electronics and soldering.
On a side note, if you are buying an RF transmitter and receiver pair make sure they work in an available unlicensed operating frequency according to .
It's dangerous to go alone! Take this.
After you've selected your motors, you are probably wondering how we will supply a power to the motor to well... move the robot. At first glance, it's tempting to directly drive the motors using the pins on a microcontroller, but that is generally not a safe idea for several reasons. The main problems with directly controlling DC motors are overcurrent and overheating. On most microcontrollers, each pin is only able to handle a small amount of current (in milliamps) compared to the high current a DC motor requires. Additionally, the linear drop off (LDO) regulator embedded on microcontrollers will overheat if high current is consumed. There are other reasons why directly controlling DC motors would be a poor idea, but the message is clear.
Do not supply current directly to your motors!
To operate our motors safely, we will need to use a motor driver. A motor driver is a circuit that controls both speed and direction of an electric motor. Motor drivers receive a low current logic-level input from the microcontroller and send a corresponding high-power output to the motor. This function allows us to safely handle the power requirements of motors.
Motor drivers act as an interface between the microcontroller and motor.
Motor drivers either come as individual ICs or as complete modules that can be purchased. In the case you build the circuit from scratch, there may be additional components such as capacitors, resistors, and inductors that you will need to get.


The eyes of the robot
In robot sumo, there are two common types of sensors used for object detection: ultrasonic and infrared (IR) sensors. Ultrasonic sensors use sound waves to measure distance while IR sensors rely on presence of infrared radiation. In this guide, we mainly recommend IR sensors because they respond quicker due to using light instead of sound waves. Granted, ultrasonic sensors are better at accurately measuring distances, but in robot sumo this is not required.
IR sensors come in two types: analog and digital sensors. Analog sensors, such as the Sharp GP2Y0A21YK0F sensor outputs a voltage that corresponds to a distance. Digital sensors such as the JSUMO's JS40F uses a 0 or 1 to determine if an object is present.
If using JSUMO sensors, be mindful of limited documentation that is provided.
The lifeblood of the robot
Obviously, our robot can't work without some sort of energy source. Now that we have mostly picked out our parts, we should now talk about what sort of things we are looking for when selecting a battery.
Batteries come in different types such as alkaline, lithium-ion (Li-On), lead acid, and lithium-polymer (LiPO) batteries, etc. Like in combat robotics, LiPO batteries are used in robot sumo for being lightweight, energy dense, and having a high discharge rate for their size. If you are going to choose a battery for your bot, it should most definitely be a LiPO.
On every pack of LiPO batteries there is a number followed by an 'S' that indicates how many cells one battery has inside. Each cell in the pack provides 3.7V. To calculate total voltage, you would just need to multiply number of cells by 3.7. For example, if you are using a 2S battery, you would get 2x3.7V for 7.4V total. Without question, the higher the voltage rating, the more powerful the battery is. Most importantly of all...
Double check that your battery's voltage is higher than your motor's voltage
This number, measured in milli-amperes (mAH), generally tells you how long you can expect your battery pack to last for. Your robot will face off in multiple matches, so we want to make sure we choose a battery that can last several matches (each match is roughly 10 to 15 seconds). A simple formula can give us a rough estimate of what to expect.
Current is peak current of the whole bot's circuit (we will learn how to find this in an upcoming section).
This spec tells us what the maximum amount of current a battery is capable of supplying to our robot. The higher the C, the more continuous power that can be supplied. We can calculate peak current with the following formula:
Check if peak current of battery is greater than peak current of circuit.
We recommend using XT30, XT60, or JST connectors for your battery. (Most batteries either come with XT30 or XT60 anyways)
Guide to our robot's power needs
Every part in the sumo bot, from the motors to the IR sensors, will use up a certain amount of power, current, and voltage. It's a good idea we keep track of how much of each is expected to be consumed by our robot's circuit, so we choose parts that will satisfy the power need of the whole bot. When calculating our power budget for our robot, we are interested in the following:
max power drawn
nominal and peak current drawn by robot
max voltage used by each part
Power is defined as unit of electrical energy per unit time, measured in watts (W). Electrical power is given by the formula:
So, if we know the rated current and voltage used by the part, we can easily solve for the power used. Finding current and voltage of each part can be found in two ways: either by empirical testing or reading datasheets.
PlatformIO and Git 101
PlatformIO is the IDE we will be using program our bot using the Arduino framework. PlatformIO has lot of integration with VSCode, so we highly recommend VSCode as our code editor of choice. If you do not have VSCode installed already the link to the download page can be found at this .
Go to
Click on "Get for VSCode" button and follow download instructions
Easiest way is to click on PlatformIO icon on the left toolbar and go to "PIO Home"
Select "New Project"
Choose the board your project is using (e.g. STM32, ESP32, or Arduino board).
Select the Arduino Framework
Your project should now include a list of directories along with a platform.ini file filled with the settings you chose earlier. If you want to learn more about how to add different configurations to this file you can follow this link to the PlatformIO Docs.
Git/Github provides a way for multiple people to collaborate on one project and manage version control. You can use Github with the CLI or by using VSCode's built-in Git commands. If you are new to Github, you can follow this handy tutorial
Generally the workflow of Git consists of the following:
git pull (pulls the most recent code from the Github repo)
Write code
git add . (to add code to the repo)
git commit -m "Short and descriptive message"
git push (to send your code to GitHub)
If working on the main repository, please use git branch [branch name] to start a branch and git checkout [branch name] to switch to it. You could combine these steps with git checkout -b [branch name] as a shorthand.


This will keep our robot within the ring
Our robot is now equipped with sensors to see the enemy robot, but how will it know not to accidentally misstep outside of the dohyo's white border? To prevent our robot from meandering into no man's land, we should give it some edge sensors.
Edge sensors commonly used in robot sumo make use of a phototransistor and IR diode pair. The IR diode acts as a sender, emitting IR light out to an object. Once the light eventually reflects, it is received by the phototransistor which then outputs a voltage between 0 and VIN. This output voltage is dependent on the contrast in color of the surface being detected. Using these line sensors, we can see where the white edge of the ring begins and where the black area ends by comparing the contrast.
There are a few sensors I've seen and used that are recommended for sumo. I'll post them below:
JSUMO (these are the ones we typically use)
Pololu
Line sensors should be placed on the underside of the robot, so they have clear view of the dohyo's surface. It is best to place them at the corners of the bot for the maximum coverage.

Without these, your robot is a sitting duck
Selecting suitable motors for your sumo bot is essential for giving the torque it needs to do some heavy pushing while also moving swiftly around the ring. There are two types of motors that are mainstay in robot sumo: brushed and brushless DC motors. Let's go over the differences between the two.
Brushed motors are electric motors powered by direct current (DC) to produce mechanical force. The rotor, which can freely rotate to drive the shaft, usually consists of coils of wire wound around an iron core (though some motors are "coreless"). These windings generate a magnetic field.
The fixed part of the motor, called the stator, contains permanent magnets that create a fixed magnetic field. The stator is typically situated outside of the rotor.
For torque generation, the rotor's magnetic fields must continuously move. An electric switch called a commutator periodically reverses the current. The commutator has fixed brushes on the stator that maintain electrical contact with the rotor. As the motor spins, different windings are activated or deactivated, causing them to repel or attract the stator magnets. This results in the motor spinning.
Cheaper, more affordable than Brushless motors as less electronics are involved.
Simple design, easy to use
Less efficient than brushless motors in terms of power and speed.
Brushes prone to wear and tear over time.
Without going into too many details, brushless motors operate on the same principle as brushed motors but uses an electronic controller for switching current instead of a mechanical commutator and brushes. A dedicated brushless electronic speed controller is generally required to use brushless motors.
More powerful and efficient than brushed counterpart
More reliable as result of not needing brushes.
More expensive as additional electronics are required
Now that we've discussed the differences between brushed and brushless motors, there are some factors to keep in mind when choosing a motor for your robot.
Sumo competitions have restriction dimensions depending on the weight class. For mini sumo, maximum length is 10cm so when selecting motors make sure they are small enough such that two motors can fit next to each other comfortably.
Motors that are rated for 2S or 3S (approximately 6V or 12V) are generally good for mini sumo.
As much as we wished we were, Comet Robotics is not made money, so please choose motors that are in a reasonable price range.
The "hello world" of embedded systems
Before we jump into this exercise, we should install a few things. If you haven't already, follow the steps under Getting Started to set up PlatformIO and VSCode. While not strictly necessary to perform any of these exercises, it will be needed to upload code to hardware if you are not using a simulator. Since this tutorial will be using Autodesk TinkerCAD, we can access it completely from a web browser. Make sure you have done the following to set up TinkerCAD.
Go to the TinkerCAD website.
Create an account and login using either your student or personal email.
Navigate to the tab that says Designs and click on +Create. A drop down menu should appear with different options. Press on the Circuits option to create a new schematic window.
You should now have a new circuit design with a code window and component inventory.
For these exercises, we will be relying on the Arduino Uno R3 board simulated in TinkerCAD. Figure 1 depicts the Uno's pinout diagram. The is also accessible on the manufacturer's page.
The digital pins will be our main focus for the next few exercises. Arduino maps pin names to a corresponding integer value. For instance, digital pin "D1" is defined as "1" in an Arduino program.
Digital pins such as D0-D19 behave in a binary manner, sending or receiving logical HIGH or logical LOW signals. HIGH corresponds to 5V (as Arduino uses 5V) while LOW corresponds to 0V. Analog pins such as the A0-A5 row are capable of sending or receiving analog values as well. Other pins may be suited to communication protocols such as I2C (D19 and D18) or SPI (D10-D13).
One might notice how pins can serve several functions; for example D14/A0 can be used as either a digital or analog pin. This is example of pin multiplexing. The Arduino also has some other special pin mappings such as LED_BUILTIN which controls the board's built-in LED. This is typically tied to D13.
The solderless breadboard in Figure 2 is commonly used for prototyping circuits. It consists of two sections for plugging in a power source, denoted by the + anode and - cathode symbol. Between the power rails, there are two 5-row terminal strips separated by a center divider. Jumper cables, shown in Figure 3, can be used to connect different components on the board together.
We'll now be uploading the "hello world" of embedded systems, a program that blinks an LED. In TinkerCAD, do the following.
In the Components drop down menu, select the Arduino tab under the Starter section. You should now have a list of example circuits to choose from.
Select the second circuit named Blink and place it down into your schematic.
Run the program by clicking Start Simulation. You should see an LED that flashes every second.
The "Arduino programming language" is a variety of C++ that has a lot of abstraction for accessing different peripherals and devices on an embedded system. Because of its simplicity and support for many boards, the Arduino language is a very versatile tool for a lot of projects. In this section, we should acquaint ourselves with several basic functions that allow writing to and reading from general purpose input/output (GPIO) pins as well as scheduling delays in our system.
This function allows us to configure one of the pins on the board to either an INPUT or OUTPUT. Under the hood, the microcontroller sets the data direction register value to 1 for output and 0 for input (in the case of the AtMega328P), but Arduino abstracts this way, so all we have to do is give the pin name and either INPUT or OUTPUT for the mode. For instance, to make D13 an output pin, we write pinMode(13, OUTPUT);
This function does what it describes; it reads the current value at that pin. This is an example of polling where the CPU checks if the device connected to the pin needs attention at a regular interval. This is not to be confused with interrupts which will be described in a later section. Let's say we want to read from an INPUT pin D10. To poll D10 we would write digitalRead(10);
Instead of reading a pin, this function allows us to write a logical HIGH or LOW value to an OUTPUT pin. Let's say we want to turn on the Arduino's built-in LED. You can either write digitalWrite(13, HIGH; or digitalWrite(LED_BUILTIN, HIGH); To turn off the LED, pass LOW instead.
This function pauses the program for the amount of time (in milliseconds) passed as a parameter. This is the simplest way to create a delay in your program. However, in later sections we will learn why using the standard delay() function may not be ideal for your program and we will introduce alternative methods of performing a delay.
You will notice every Arduino program requires a void setup() and a void loop() to compile. void setup() is a function that will only run once in your program. It is typically used one time actions such as configuring IO pins and communication protocols. void loop() on the other hand is where the bulk of your program will be stored. This function will run indefinitely until the board is reset or powered off.
Objective: using digitalRead to poll the button, try control the rate an LED blinks. For example, you could have a slower and a faster mode.
Read the section on Debouncing to figure out how to poll the button properly.
Objective: Make a program that flashes a sequence of LEDs beginning with red for "Ready", then yellow for "Set" and finally green for "Go!" whenever a button is pressed. You can choose how much delay you want in between each LED.
All LEDs should be off after the cycle is complete.
Objective: Design a program that counts up through a 4-bit binary number (0-15) and returns to 0 after reaching 15. You can use 4 LED to represent the binary number.
Optional: Design the program so binary value increases by 1 each time a button is pressed.
Due to electrical/mechanical faults, the button may switch between a HIGH and LOW state very rapidly before reaching a steady value. For now, you can add a delay() after reading the button to make sure it has a steady state. A 50ms delay should be more than enough to address the debouncing.
pinMode(pin, mode)digitalRead(pin)digitalWrite(pin, value) delay(ms) 


