Sneak Thief

Construction

Well that's the set up, if you were really serious you would just turn off the computer but this is a game remember!

So to make it you first of all need a box and a skull, or some other treasure, like a small ornament, unlawfully purloined by the Baron. Next you need to make the IR sensor and emitter. With this circuit you should get a beam that covers about 6" or 15 cm so make sure the box opening is no larger. Now on one side you glue the Infra red LED and resistor then on the other side you stick the Infra red sensor and other components to the inside of the box. Note that the sensitive side is the large flat one without the writing on it. Make sure that these are lined up and put a small piece of card to shield the sensor from light from outside.


The beam generation part is very simple and the LED takes about 100mA through the 33R resistor, so it should be a high wattage one. The sensor is connected to a Darlington pair amplifier and will produce an output range between 0V when the beam is not obstructed and 5V when the sensor is covered. When connected up to the Arduino this translates into values of 0 to 1023.


The layout of this circuit is shown using strip board. It is shown with the components on top and the copper strips on the back. The copper strips have been drawn as if you were viewing them through the board, this is so that you can see where the breaks go and the orientation of the strips. Note, there are two places where you have to break the copper tracks. This is best done with a spot face cutter, a small tool designed for the job. You can use a twist drill bit but make sure you do not leave a thin copper whisker behind, joining up the track. Alternatively you can make two parallel cuts with a hobby knife and remove the small section of copper between the cuts.


Finally you have to wire it up to the Arduino. We need to take the output of the IR sensor and feed it into one of the analogue inputs. To control the game there needs to be a push button switch so we can reset the alarm, and finally there needs to be some sort of alarm. For this I chose to use both an LED and a sounder. The sounder is a pitzeo electric sounder, these produce a good level of sound and can be run directly off a logic output without any buffering. I built up the Arduino side of the hardware on a 13 way plug strip, that straddled the two output sockets, on one side of the board. To prevent it being plugged in misaligned, the centre pin, that is the one that would not normally be in a socket, is bent over. I used two of the analogue input pins as digital outputs, and another as a digital input, to keep all the connections to one side of the board.

The IR sensor

The IR emitter

The Box

Sneak Thief

The Game

Complete set-up

Using an Arduino make this game of skill & dexterity.

The Software

Basically the software in the Arduino reads the voltage from the sensor and tests to see if there has been a large change between now and the last time the sensor was read. If there has been then and alarm sounds and the LED flashes so you have lost the game. You can alter the difficulty of the game by varying the time between looks at the sensor voltage. With a shorter time you can, in effect, move faster than with a longer time. This time is set up by the Delay function in the main loop, currently this is set to 25 mS. The alarm is triggered when the difference between the current and last reading is greater than the value set in the threshold variable. Therefore to make the game easier make this value bigger.


When you do trigger the alarm you can reset it using the push button switch, hold this down until the beeping stops.


The Arduino pde file can be downloaded here:- Sneak.pde.

Enhancements

If you remove the comments lines from the print statement you can monitor your progress and perhaps train yourself in how slow you need to move. Better still why not add a bar display to the Arduino to show how much change in the sensor there has been. This makes the feedback stand alone. You could incorporate a timer that would measure how long it took to grab the treasure. Again this could be stand alone or by use of the computer using a “processing” program. Finally you can add switches to the Arduino to allow you to change the level of difficulty.


Anyway remember this is for fun only don't try these techniques on a real burglar alarm or at least, if you do, don't get caught.