• Travis

RoboHockey: Robots Playing Hockey


For one of my upper-level classes at Hopkins, Mechatronics, our final project was to build robots to compete in a class tournament of robotic hockey. We had to build two robots: a goalie that tries to prevent opponents from scoring and a forward that tries to score.

The robots had to be programmed to play the entire game autonomously, using only on-board sensors and coordinates transmitted via RF by an overhead Pixy camera.

However, that overhead Pixy camera was unhelpful as there was a couple second lag between a robot moving and the coordinates updating. Further, sometimes the Pixy wouldn't see the color codes in the arena so it would just report error values. Even worse, the coordinates reported would fluctuate about +/- 12 inches even if the robot wasn't moving. For these reasons, my group chose not to rely on the coordinates given by the overhead camera, which made this project much harder because we had to figure out how to localize our robot and we were constrained to the computing power of an Arduino (couldn't use LIDAR and SLAM).

Forward Objectives and Requirements:

  • The forward must locate the puck, go to the puck, possess the puck, travel to the opponent’s goal, and shoot it in.

  • The forward had to fit in a 20x20x18 cm cube

  • The forward cannot have color sensors on board.

Goalie Objectives and Requirements:

  • The goalie must locate the puck and block the puck’s path into our own goal.

  • The goalie had to fit in a cube of 20x20x22 cm

  • The goalie was allowed to have a color sensor.

  • The goalie was not allowed to move past the halfway line at any time.

Both Robot Requirements:

  • Both robots had to be fully autonomous and not be tethered.

  • Robots were not allowed to be airborne.

  • Robots could not contain liquid.

  • Robots were to be started with a loud siren.

  • Robots could not consume the puck (ie. at least half the puck from the top and side views had to be exposed) and they could not rigidly connect with the puck.

  • We were not allowed to buy any pre-assembled structures.


Compared to our classmates, the competition went pretty well for us. However, because a lot of groups had last-minute issues with their robots, it became less like a competition and more of a just-for-fun hockey match. There were no declared "winners" of the competition, but we were technically undefeated with the most goals.

Forward Design:

Original Design:

Originally, I designed the forward robot to look like the one below with an upper compartment for electronics and a lower compartment for the battery, motor, and solenoid.

In this image, you can't really see the divide between the lower and upper compartments, but they're there. I went for a round/circular design so that our robot would be theoretically able to pick up pucks in the corners of the arena and not get pieces of the robot stuck to opponents' robots.

Original Bottom Compartment:

Here you can see the robot's IR camera, solenoid, dual DC motors with encoders, scooter wheels, and LiPo battery. There are also threaded brass inserts that I heated up and inserted into the 3D printed enclosure.

Original Electronics Compartment:

This electronics compartment would sit above the bottom compartment and house the Arduino, H-Bridge and wires.

Plastic Usage Comparison:

The issue with the original design was that it used too much plastic and we had a limit on the amount of plastic we were allowed to use. On the left you can see that just the bottom compartment had a mass of 357 grams while a prototype that was close to the final version had a mass of 145 grams. That's less than half the original mass!

Final Forward Design:

In this design, I got rid of the top electronics compartment and reduced a lot of the plastic usage in the lower compartment. The Arduino and H-Bridge were simply to be mounted onto a plate that sat above the lower compartment.

Final Forward Top View:

The puck had a strip of IR LEDs around it to help us track where it was. I decided to use an IR camera, like the ones found in Nintendo Wii Remotes, to locate the puck. One minor change I made between the original design and the final design was that I angled the IR camera (the black round thing with the black hexagonal nut attached to it) 11 degrees downward so that it would be able to see the puck if the puck was close to the robot since the field of view of the camera was very limited (about 22 degrees vertical).

Angled IR Camera:

Forward Electrical:

There are a couple changes we made to the electronics after I created this schematic. First, I designed the electronics with using an XBee in mind to communicate between the forward and the goalie, but we ended up not communicating. Also, instead of powering the relay with the 3-cell LiPo battery, we overvolted it to 36V (rated for 12V) so that it would shoot the puck about 2x further. Lastly, we used four encoders for the motors instead of two so that we would also know the direction the motors were spinning.

Goalie Design:

Originally, we were going to make the goalie the same design as our forward (for ease of manufacturing and programming) until the rules were changes so that our goalie would not be allowed to cross the halfway mark and also we realized that the solenoid was not powerful enough to shoot the puck from the half court. Therefore, it didn’t make sense to have a mobile goalie because we thought that the biggest advantage of a mobile goalie would be its ability to shoot it into the opponent’s goal (we thought we would be able to have two robots that are able to shoot into the opponent's goal instead of one). Therefore, we changed our design later on to a stationary goalie. Since it was immobile and would have no method of getting back to its original position, we needed to make it as heavy as possible so that other robots would not be able to move our robot out of place.

Front View of Goalie:

In the front, you can see the Arduino, motor, encoder, H-Bridge, and where we would mount the IR receivers. We only needed a couple IR receivers so that we would know the general location of the puck. Fine resolution was not important because the part that moved back and forth already took up most of the goal.

The goal was 45 cm and the puck was about 8 cm in diameter, so we only needed to block 29 cm of space in the middle of the goal. Ironically enough, because we were allowed to build a goalie that was 20 x 20 x 22 cm, we could build our robot such that the longest point was along the diagonal which meant we could block 20*root(2) cm which equates to 28 cm. Therefore, an immobile goalie was very effective because it really only needed to move 1 cm in either direction to block the puck.

Here's proof that the robot I created can fit into the 20 x 20 cm requirement (when rotated such that the longest part is along the diagonal).

From the top, you can see that there were large empty cavities in my design (the large red pillars on the sides and the gray container in the middle at the top). These cavities were eventually filled with sand to weigh it down so that other robots would struggle to push it out of its original position.

I also put silicone rubber pads (the black square things) on the bottom of the robot to prevent it from sliding on the arena floor when other robots hit it.

Goalie Software Logic:

The logic was really simple for the goalie. I apologize for not breaking down the code further into smaller logic blocks for the flowchart. (I am better at flow charts now, see my project called FormCheck).

Goalie Electrical:

The electronics for the goalie was also simple. It just consisted of five IR sensors, an H-Bridge, a quadrature encoder, and an Arduino Uno.