Pin Hockey

By Byron Aguilar, Cesar Gonzalez, and Hamilton Wu

Introduction

Pin Hockey is a 2 player game of pinball with a twist: the board rotates to help keep the ball moving! The rules are simple like your typical air hockey game. The player who scores 9 points first wins.

Servos control the tilt of the board, which is crafted with the finest quality cardboard from the leading manufacturer of office supplies - Staples. The flippers are 3D-printed and exert plenty of force thanks to the strength of car door lock actuators. Lastly, break beam sensors determine the relative position of the ball, helping the game keep track of score and determine where to rotate the board. One can find the project proposal and updates below. Please click on the menu in the top-left corner to find the assembly details and parts list.

Project Proposal

Overview: We plan to create a physical game merging the ideas of both air hockey and pinball. There will be an enclosed field; on both ends of the field there would be two flippers that guard your “goal”. These flippers will be controlled by simple actuators, which are each triggered by a different button. The actuators will be hooked up to a 12v power supply, independent of the LPC board. Score keeping will be implemented using break beam sensors and a led matrix. Break beam sensors will be placed on both goals waiting for a passing ball to trip the infrared, signifying a point being made, this score will then appear on the led matrix. A tilting mechanism of the entire playing field will be implemented using two servos on opposing sides in the middle of the field enclosure. If the ball happens to get stuck somewhere on the board, this tilting mechanism will be used to roll the ball back into play. Break beam sensors will be used across the board to indicate on whose side the ball got stuck on.

Pin Hockey Proposal 153B.docx

Final Update

POGGERS! Woo! Success! We have ironed out most of the bugs in both the code and physical assembly. Project is finished, with a few small bugs here and there. The game is fairly fun and can make for great party entertainment.

Weekly Update 4

Crunch time. This week we worked on building the physical pin hockey field out of cardboard. We also installed our flipper actuators and the servo tilting mechanism. After a few days of cutting and gluing, we finished it. Afterwards we began coding the game to get all the sensors and peripherals working together. During this process we discovered a ton of glitches and issues.

One of the largest issues was the flipper actuators, which were creating large electromagnetic interference and triggering random interrupts and messing up our LED matrix display. We addressed this issue by separating our 5V and 12V supplies and peripherals and adding aluminum foil as a shield from the EMI. We also made the code a bit more robust so that random interrupts and display glitches wouldn't affect the game in a critical way.

Weekly Update 3

Now that we are able to control the LED matrix screen and the servos for tilting the board, the break beam sensors are the only thing left to work on. Our plan was to use four different GPIO interrupt handlers for, one for each of the four break beam sensors. This plan became complicated when we realized that GPIO only has one interrupt handler. After digging around in the LPC datasheet, we found that it has support for four external interrupt and each can have its own handler. Currently, we have the low-level functions for using these interrupts, we just have to test that they work.

Weekly Update 2

So far, we have finished the code to use the LPC's PWM module to control a servo. This week we worked on getting our 8x32 LED matrix display to work. One of the biggest challenges with this peripheral was that the display used cascaded LED drivers. To control the entire the display, it was necessary to send a total of 64 bits of data before using the chip select pin to latch the data. Unfortunately, the LPC's SPI sends data in 16 bit frames and changes the chip select (CS) pin accordingly. This meant we had to use a separate GPIO pin to control CS, but since the display's logic operates in the 5v range, we needed a level shifter.

After overcoming these difficulties, we created functions to write any phrase (that can fit) onto the display. Now it is a matter of cleaning up the code for the helper functions to begin creating the main code for implementing our game.

Weekly Update 1

We worked on getting the servo interfaced with the LPC. To do this, we figured out how to use the LPC's built in motor control PWM module. We created helper functions for this module to allow us to easily control the servos by just inputting a single angle. The benefit of using the PWM module as opposed to two timers is that it involves less LPC peripherals. Also we plan to use 3 timers to run our game, so we don't have many to spare for other functionalities.