Introduction: Stop the Light Game
Who doesn't like carnival games with bright lights and guns? I sure do. In this instructable, I will show you the steps to make your very own Stop the Light game. This project is based off of easy to find components: a digital-addressable red-blue-green (RGB ) strip, an Nintendo Entertainment System (NES) and an Ardiuno microcontroller.
Step 1: Stop the Light: How to Play
This game is very easy to play and quite addictive. Your task is to stop a light which is traveling up and down the strip with the NES Zapper gun. Stop the light at the arrow, and you will advance to the next level. Each level increases the difficulty by speeding up the LED. The game will indicate missed shots by illuminating the moving LED red and pausing it for one second.
There are 3 levels in my code, green, yellow, and red. Each level speeds up the moving LED by 20%. If you are skilled enough to complete the red level, you are rewarded with a rainbow animation and the game resets back to level 1.
I've been wanting to make such a game after working with the LPD8806 based RGB strip project pack sold by Adafruit. Adafruit's project pack contains everything you need to power and run animations on the LED strip. Their project pack contains the strip, battery pack, cable and an Ardino clone they call the AtMega32U4 breakout board. Adafruit also has a great tutorial step you through the process of getting your strip up and running.
Along with the team at Adafruit.com, I'd like to give credit to Elmer Delooff
and his Green Flying Dot code which I used as the basis for my sketch.
Step 2: Stop the Light: Materials
Materials:
The items needed to complete this instructable are pretty easy to find. You will need:
- Adafruit RGB digital belt kit http://www.adafruit.com/products/332
- NES system
- NES Zapper light gun
- A length of Cat 5 cable to extend the distance between the LPD8806 strip and the Ardunio
Lastly, I used a piece of foam core board to mount the strip and make a nice play area.
Step 3: Stop the Light: Build
Adafruit does such a great job explaining the construction of the digital belt kit, I'll let you follow the directions from their tutorial at
http://learn.adafruit.com/digital-led-belt
The only thing I needed to modify from the Adafruit tutorial is that I spliced a piece of CAT5 cable between the ribbon cable and the LPD8806 strip. This allowed me place the LED strip a few feet away from the Arduino.
Once you have the belt kit working, you can load my code into your micro and start interfacing it to the NES.
http://learn.adafruit.com/digital-led-belt
The only thing I needed to modify from the Adafruit tutorial is that I spliced a piece of CAT5 cable between the ribbon cable and the LPD8806 strip. This allowed me place the LED strip a few feet away from the Arduino.
Once you have the belt kit working, you can load my code into your micro and start interfacing it to the NES.
Attachments
Step 4: Stop the Light: the NES Zapper Gun
I though the NES Zapper lightgun would make a perfect input device for my game. But first I had to figure out to interface the trigger with my Arduino. Opening up the gun was quite overwhelming at first as it contains a bunch of hardware we don't need to worry about.
Looking at the switch in the gun I saw that it is a normally open device. I also noticed they put a peice of plastic on the trigger to make a hardware one-shot for the switch. I also found a hardware debounce of the gun circuit board. The hardware debounce allowed me to interface it directly with my Arduino.
Hardware debouncing is just what it sounds like, the gun contains a filter to ignore the bouncing of the first few milliseconds of the high/low switch transition. It basically helps our Arduino sense a proper grounded switch input. Its not perfect, but I find I can capture about 95% of the gun's trigger pulls.
Looking at the switch in the gun I saw that it is a normally open device. I also noticed they put a peice of plastic on the trigger to make a hardware one-shot for the switch. I also found a hardware debounce of the gun circuit board. The hardware debounce allowed me to interface it directly with my Arduino.
Hardware debouncing is just what it sounds like, the gun contains a filter to ignore the bouncing of the first few milliseconds of the high/low switch transition. It basically helps our Arduino sense a proper grounded switch input. Its not perfect, but I find I can capture about 95% of the gun's trigger pulls.
Step 5: Stop the Light: Power the Game
Next, I needed to figure out how to tap into the NES power and ground bus. A nice 5 volt and ground can be from the point as shown in the picture. I used the pad at the end of my pullup resistor to tie it high.
At first, I was going to use the NES's power supply to power my Ardunio. But I figured it would probably be easier to run this thing off of batteries as I planned on using this at a school carnival. So I used the 6v pack from Adafruit's belt kit to power the game. What ever way you want to power this game, just make sure to tie the nintendo and Ardino's power and grounds together.
At first, I was going to use the NES's power supply to power my Ardunio. But I figured it would probably be easier to run this thing off of batteries as I planned on using this at a school carnival. So I used the 6v pack from Adafruit's belt kit to power the game. What ever way you want to power this game, just make sure to tie the nintendo and Ardino's power and grounds together.
Step 6: Stop the Light: Mount the Strip
After extending the 4 wires between the Ardinuo and LED strip with a cat5 cable and some soldering skills, I mounted the strip to a foam core board with loops of Gorilla tape. The black blobs you see in the picture is the Shoe Goo that I tried to use but it did not stick to the rubber strip enclosure.
Once everything is connected, turn power on and if all goes well you should get a red light on your Arduino and the strip should turn blue and have a green dot running up and down its length.
Once everything is connected, turn power on and if all goes well you should get a red light on your Arduino and the strip should turn blue and have a green dot running up and down its length.
Step 7: Stop the Light: Interface the Zapper Gun With the Arduino
Next I tied the Nintendo Zapper gun to an input on my Arduino. I used port E6 on the ATMega32u4 break out board. As it is pulled high, depressing the Zapper gun's trigger drops the line down to ground and if all goes well, the software will catch the input and register a hit or miss.
Step 8: Stop the Light: Play the Game!
That's it, just tie up all the loose ends and you have your game. The game has 3 levels, the first being the green level. Stop the light at the arrow and you will make it to the yellow level. Stop it again and you will make it to the red level. Stop it one more time at the arrow and you will uncover the rainbow.
I operated this game for 4 hours at a elementary/middle school carnival and found that about 25% of the kids could complete the game within 7 shots. Some required more shots and some less. There was even a child in first grade who completed the game in 3 shots several times.
There is lots of room for improvement in the code. I'd really like to add a reset to the game to set it back to level 1 in the event a player can't complete the game. I'd also like to mount a vibrating motor from a cell phone in the gun and have the Arduino pulse it when it senses the trigger pull and give the player the sensation that he actually shot something. Drop me a line if you would like to see the details on how to add those features!
I operated this game for 4 hours at a elementary/middle school carnival and found that about 25% of the kids could complete the game within 7 shots. Some required more shots and some less. There was even a child in first grade who completed the game in 3 shots several times.
There is lots of room for improvement in the code. I'd really like to add a reset to the game to set it back to level 1 in the event a player can't complete the game. I'd also like to mount a vibrating motor from a cell phone in the gun and have the Arduino pulse it when it senses the trigger pull and give the player the sensation that he actually shot something. Drop me a line if you would like to see the details on how to add those features!