Pit yourself against a grid of laser beams with PiFace Digital. Now you can by following the simple steps in this guide.
To make the laser assault course, we will point a laser beam from one end of the room to the other, to hit a sensor, that detects if the laser is hitting it. The type of sensor you will use in this project is called a phototransistor. If you fail on your mission and break a beam the RaspberryPi will let you know.
Connect the longer leg of your phototransistor to ground on the PiFace Digital. Now connect the other leg of the phototransistor to the first input pin.
Place your laser facing out into the room you want to make the assault course in. Position you mirrors to reflect the laser beam a number of times and end up hitting the phototransistor. You can increase the number of ‘tripwires’ by reflecting the beam back and forth with mirrors -- you just need to make sure the beam eventually hits the phototransistor.
To test your phototransitor circuit is working, start the PiFace Digital emulator by opening a Terminal window on your RaspberryPi and typing the command
Check that the emulator is talking to your PiFace board by pressing one of the on board buttons and watching the corresponding picture of the button in the emulator on screen change.
Now break the laser beam with your hand and check that this is registered to. You should see a similar effect to pressing the buttons.
You may find you need to reduce the amount of ambient light that is getting to the phototransistor, otherwise it may not detect that the laser beam has been broken. To do this, wrap your phototransistor in paper or coloured tape, with the top of the ‘bulb’ poking through. This will cut down the light that can get will only have one angle at which it can hit the sensor, which is the direction of the laser beam.
Download the software for the game from here.
Want to know where a laser beam is being tripped? You can do this by using multiple lasers and Phototransistors instead of mirrors to reflect the beams. Wire and setup these in the same way you did for the first laser beam.
You could also write your own program for the game, such as putting a time limit in or creating your own sound effects.