Every year for Halloween we decorate up our basement and turn it into a fun haunted house for the kids. Usually this is geared towards smaller kids, so nothing too scary or crazy. But this year I wanted to make things a little more interactive to go along with projects I had built in past years. So, we came up with a little version of laser tag, but not just any laser tag, this one dispenses candy!
We started out by buying some ray blasters from Amazon. The ones I found were nice because it was a two pack with different types. Removing all the screws, it was easy to find a place to mount an IR LED as the transmitter. To drive the IR LED, we used an Adafruit 3V trinket, which ran from the AA batteries in the gun. I was originally planning to use a 555 timer instead, which would be cheaper, but sort of ran out of time and the trinket was easier. The trigger was just a tactile switch that was pressed by the plastic, it allowed the 3V line to reach the internal circuits of the blaster. So, we simply hooked a sense line onto the switch so we know when the trigger is pressed and we drive the IR LED at 38kHz. The IR LED would just stay on the entire time the trigger is pressed down.
We mounted the trinket inside the gun so that the IR LED replaced one of the blue LED's already inside. We made sure to position it so that it pointed straight out. Then we screwed it all back together and our gun was finished.
The target was pretty easy. It is simply a Particle Photon connected to a 12x Adafruit Neopixel Ring and an IR receiver. This was put together on a breadboard and then we mounted the IR receiver and neopixel ring onto a dollie just to hold it together and make it look more like a target. We made three targets and made them each a distinct color.
Each Neopixel would rotate through brightness of its designated color. When it was "shot" it would turn red and slowly fade down over a few seconds, indicating it was hit. The target could not be shot again during this time. Once the few seconds expired, it would go back to normal. Then the Photon detected this shot, it would publish an event to dispense candy.
We re-used our Physical Web Candy Machine from another project to give the kids an incentive to shoot the targets. We modified the machine to turn on when it detected events published by the targets, it was only a slight code change from the previous project. Whenever a target is shot, M&M's (or whatever candy you want) would be dispensed.
The following video shows the system in action (along with the rest of the Halloween decorations). This video was taken the day after the party, so the lights are all on and the decorations are half torn down. You must imagine this with the lights off and only blacklights and LED's lighting the room, as well as fog from the fog machine filling the air. It made for quite a scene and the kids loved it, they ran around for hours playing!