Any likeness of any features of Wack-A-Mole to any copyrighted likenesses is purely coincidental. With that said, Wack-A-Mole is a game designed in the Spring of 2015 by four Olin engineering students. The game, designed to fit into a penny arcade theme, is simple: hit moles with a hammer to score points before time runs out. However, there is an additonal element to our game—concealed in the hammer is a sensor used to detect when the player is about to attack a mole. As it turns out, it can be incredibly difficult to hit a series of moles that seem to know your every move...
How does this work? The hammer contains a small PIC microcontroller board that includes an accelerometer. When the player swings the hammer or jerks it substantially the small PIC sends a “dodge” signal to the main board. When this occurs, all moles that are currently in the up position are instantly retracted.
We chose pneumatic cylinders for fast, reliable, and high-speed extension and retraction of moles. It was a critical design goal to be able to quickly and repeadedly actuate the moles up and down, so pneumatics were a logical choice. We used two high-flow one-way solenoids per cylinder for the fastest possible actuation.
Our team includes a wide range of skillsets, allowing us to produce a complete project with both technical complexity as well as a refined aesthetic.
The team designed our own LED and solenoid driver boards to integrate with our microcontroller. The 32 high-brightness LEDs on the front panel of the game are driven over a high-speed SPI interface to our external LED driver board, powered by an efficent DC-DC converter.
The moles ascend at a leisurely pace, ensuring the player is not overwhelmed, and they don't retract until they're hit. However, once the player reaches 10 points, the moles still come up slowly, but they run away from the player's hammer!
In hard mode, the moles don't stay up for long! Every time the player misses, a point is subtracted from the total. Even worse, if the player manages to score 10 points, the moles seem to predict the player's every move!
Name | Quantity | Cost Per | Total Cost | Supplier |
---|---|---|---|---|
5" Stroke, Spring Return Nitra Brand Pneumatic Cylinders | 3 | $20.00 | $60.00 | Automation Direct |
1/4" NPT - push connect adaptors | 2 | $4.74 | $9.48 | Automation Direct |
Car Door Lock Actuators | 2 | $5.00 | $10.00 | Amazon |
US Toy - Giant Squeaky Hammer colors may vary | 1 | $5.71 | $5.71 | Amazon |
Test Solenoid Valve (Unused) | 1 | $11.66 | $11.66 | Amazon |
Compressor | 1 | $40.00 | $40.00 | Harbor Freight |
Compressor Accessory Pack | 1 | $8.50 | $8.50 | Harbor Freight |
1/4" NPT One-way Solenoids | 6 | $9.96 | $59.76 | Amazon |
Buttons | 4 | $2.20 | $8.80 | Generic China |
Protoboard | 3 | $10.00 | $30.00 | |
Blue 1W LEDs | 50 | $0.20 | $10.00 | Generic China |
Buttons | 5 | $3.18 | $15.19 | Generic China |
Roller Cover | 1 | $2.65 | $2.65 | Home Depot |
Foam Brush | 1 | $0.77 | $0.77 | Home Depot |
1/4" NPT Brass Connectors | 4 | $2.73 | $10.92 | Home Depot |
1/4" NPT Nipple | 2 | $1.78 | $3.56 | Home Depot |
1/4" NPT Brass Tee | 2 | $6.57 | $13.14 | Home Depot |
1 Gallon, Flat Black Paint | 1 | $18.98 | $18.98 | Home Depot |
1/4" Air Hose | 1 | $3.00 | $3.00 | Home Depot |
OSB, 4x8', 7/17" thick | 3 | $8.35 | $25.05 | Home Depot |
1/4" NPT Nipples | 3 | $2.95 | $8.85 | Home Depot |
19''X23''X1/8'' Steel Plate | 1 | --- | --- | Stock |
3''X3'' Foam Padding | 3 | --- | --- | Stock |
2X4 Wood | 6 | --- | --- | Stock |
Parchment Paper | --- | --- | Stock | |
Reflective (Anti Static) Material | --- | --- | Stock | |
Black Cloth | --- | --- | Stock |
We chose a variety of materials for our project, and here we'll outline the reasons for our purchases.
We chose pneumatic cylinders to actuate our moles. We investigated other options, including linear electrically powered actuators, but eventually chose peneumatic cylinders for their speed. We looked into cylinders that were double acting, or powered by compressed air in both directions, but eventually chose spring-return cylinders for cost reasons. The cylinders are faster in the sprung direction than the air-powered direction, so we decided that the moles would retract under spring power and extend by air power. To control a single-acting spring return cyclinder, a 3/2-way valve is typically used, which allows the cylinder to vent air into the atmosphere on the return stroke.
Another performanced-based decision we made was to use two single acting solenoid valves per cylinder. After testing a 3/2-way valve and finding it restricted the air from the cylinder too much for our purposes, we moved to one-way valves with larger bore diameters that were less restrictive of flow.
Pneumatic systems are rather expensive. We made as many choices as possible to reduce the cost of our system. We used a compressor, acquired on sale from Harbor Freight, to provide the compressed air for the cylinders. It leaves quite a bit to be desired in many respects. The most immediately apparent problem is noise. After investigating muffling methods (and destroying a cheaply made screw in the process), we decided placing the compressor in our assembly was the best we could reasonably do at reducing the noise of the compressor. An additonal problem with the compressor is the regulator does not maintain a constant pressure, and when a high flow is required (such as when multiple moles raise in rapid succession) the pressure on the output of the regulator drops rapidly.
Rendered in raw OSB, before paint. We chose OSB (oriented strand board) for it's low cost compared to other materials. We cut it using a CNC router, and then painted it using house paint to improve the appearance.
Our system diagram.
The game starts when a user insets a penny.
Players intuitively grasp the gameplay.
We spent some time designing and cutting vinyl stickers to make up the appearance of our game. We wanted it to attract potential players with an appealing appearance. It could be a great revenue gainer for any arcade!
Much of the code was abstracted to a system of structs. Our primary struct was the Mole struct. This contains all important components related to the Moles. This includes solenoid values, mole number and button. Moles keep track of how long they are in an up or down position along with their direction and valve status. These factors are important for timing when to rise and drop moles along with player interactions with the Moles.
Buttons also have their own struct. As mentioned before every Mole had its own button. The buttons struct simply contains the current state of the button, its previous state and its pin value.
All of the valve logic can be found in the Mole structs. All of the valves are on the same shift register so they could not be simply set to high or low when needed. The valves share a clock pin and a data pin. To change a valve’s state the entire binary data value must be updated before being pushed to the registers.
LEDs do not have their own class but can do have their own library file. The libraries have been divided into three primary subsections; time, score and peripherals. The library also handles all of the LED driver shift register logic.
The game has a few important game states that dictate its current function. COIN_NEEDED is a state in which the game is simply waiting for the player to insert a coin. Once this condition has been met the game switches over to MODE_NEEDED. In this state the game is waiting for the player to use the two stand-alone buttons to select a desired mode. At this point the game state switches to NICE and a new state variable “gameMode” is introduced. Game Mode simply keeps track of if the game is in EASY or HARD mode. The game state switches to EVIL while not changing its Game Mode once the player reaches 10 points.
For the state machine to work properly the game needs a set of timing variables. These variables schedule and organize the different tasks the game needs to complete.
The game’s overall period is used in all states of the game. When in the COIN_NEEDED state, the period is used to check if a coin has been added by the player. During the MODE_NEEDED state, it checks if a mode has been selected. Finally in the EVIL or NICE states the timer is used to check the current states of the moles and push them up or down if necessary. It also updates the overall time that has passed and checks if the player has failed.
The game also has a reading loop timer. This is only used in the EVIL and NICE game states. This checks if a button on a mole has been hit.
Top layer rendered in red, bottom layer rendered in blue.
Again, the top layer is rendered in red, bottom layer rendered in blue.
We designed a PCB breakout board for interfacing the main PIC board to our actuators and peripherals. The board is designed to mount directly onto the PIC similar to an Arduino shield, and has a second row of headers that enables it to be stackable.
The board contains control circuitry for driving up to eight solenoids. We choose to use a shift register to conserve limited I/O pins. This shift register drives MOSFETS, with flyback diodes around the load.
It also contains basic passive components to enable digital reads of button presses, and was designed to interface directly to a couple of different Bluetooth breakout boards.
Finally, the board contains a band pass filter with amplification to make the noisy, small, and floating signal from the coin accepter readable on a PIC running on 3.3 volt rails.
We also designed LED breakout boards to drive up to 48 LEDs. Lighting is a key component of our project. All of the buttons are lit, as well as the score columns and various environment lights. This breakout board consists of 6 daisy chained LED drivers (constant current shift registers), and solder points for each individual LED.
Click here for our full system schematic.
Our moles are designed to fit into 4" holes. We adapted their design from a model we found online.
The inside of the mole is designed to fit a button with an integrated LED.
The bottom of the mole is designed to hold a nut and screw into the top of our cylinders.