Introduction: Replica Theft Alarm Box

About: Fab Lab London is the City of London’s first purpose built digital fabrication and rapid prototyping workspace. We live at @1fredsplace

For my first project using a Raspberry Pi, I made a replica theft alarm box that will serve as a deterrent against any would-be bandits. As well as a Pi, I also used a 4tronix ‘PiRingo v1.1’ which provides a ring of LEDs, that can be purchased from 4tronix’s website: http://4tronix.co.uk/store/index.php?rt=product/p...

Since this was my first time using a Raspberry Pi, I did follow tutorials myself, and so to avoid plagiarizing or poorly rehashing others tutorials (Which would be slightly ironic considering the build) in each step where I used a tutorial, I shall link to it.

Step 1: Building the PiRingo Board.

The first job to do is to set up the PiRingo board. A few resistors, the LEDs and GPIO board need to be soldered on, among other things. Instructions to assemble the PiRingo board can be found on 4tronix’s blog:

http://4tronix.co.uk/blog/?p=75

Step 2: Initial Setup of Pi.

I installed Rasbian onto the Pi, using NOOBS which can be downloaded from: http://www.raspberrypi.org/downloads/

The PiRingo board requires root privileges in order to work, so before starting Rasbian type ‘sudo su’.

Step 3: Coding the Pi.

The script is to be written in IDLE (using the python programming language) that was installed onto the Pi with the Raspbian OS.

I first looked at GitHub which has some great example code written specifically for the PiRingo board, which can be found here: https://github.com/4tronix/PiRingo. Following the examples on GitHub I wrote my own script, which I’ve also uploaded to GitHub, and can be found here, named ‘PiRingo Code’: https://github.com/fablabldn/FabLab-London-Projects

To briefly explain what the code does- the box will go through 3 main behaviours- ‘setup’ which will only be executed once, as the code first executes, ‘working’ which the board does 99.9% of the time, and ‘reset’ which the board will do roughly once every half hour.

Setup: The first thing the code will execute is the setup function, which slowly turns on each LED one by one before flashing all LEDs 3 times. A real alarm system may take a while to get itself ready, so this is to emulate a proper bootup sequence and to trick any onlookers into thinking its doing much more than it actually is.

Working: While it may be more fun to program, a thief alarm box that closer resembles a fireworks display of flashing LEDs isn’t going to fool anyone, so the majority of the time the board is on it will be fairly discreet. I chose to keep LED08 on the PiRingo board on solidly (And will later engrave a power symbol next to it) while LED12 flickers on and off randomly, so to any onlookers it looks like it’s actually doing something productive- maybe scanning the environment .

Resetting: In order to put the rest of the LEDs to good use, every half an hour the script will ‘Reset’. This involves the lights turning on in a clockwise motion (Similar to the buffering icon on youtube videos), then anti-clockwise and then again with multiple lights.

Step 4: ​Getting the Code to Run Automatically As Pi Gets Power

Currently, the code only runs when the gui is loaded and you must manually execute the script. This isn’t very helpful, as the box isn’t going to be permanently hooked up to a monitor, mouse or keyboard! I followed this tutorial: http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programshttp://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/scripts

to get the code auto-running. This involved using the command line to make my script executable, before opening the file ‘rc.local’ (A file that is run automatically on bootup of the pie) and adding the address of the script I had written. Note: Because the script was written using the python environment, rather than just simply executing the script I also had to tell it to do so while running python- otherwise it doesn’t work!

sudo python /home/pi/projects/my_project.a &

Step 5: Designing the Box- Part 1

The physical box the Pi will sit in is made using a Laser Cutter. The website http://www.makercase.com/ will generate box plans to user input dimensions that work very well with lazer cutters, but you could use a scapel if you don’t have access to one. I chose to use finger edge joints, and measured the dimensions of the Pi. I went through 3 ‘prototypes’ while designing the box, each that performed a goal. Each of the prototypes were made with recycled cardboard, but the final design is to be made with wood.

Prototype 1- Correct dimensions and laser settings The first prototype needed to be big enough to store the Raspberry Pi in. Although the plans generated where to the correct dimensions, when importing the image to Corel Draw they shrank, so this was slightly more complicated than it should've been. Using the stretch tool and drawing a box in the program to the correct dimensions was an easy work around. Another goal of this prototype was to work out what settings the laser should use to effectively cut the scrap cardboard.

Prototype 2- Box with ‘holes’ in correct positions (For power cable the LEDs to shine through, etc…) The box needs holes- so the pi can be plugged in, and so also the ring of LEDs aren't blocked. I used a ruler to measure the diameter of the circle of rings, and printed out another copy of the box plans but this time with unique etchings on each face of the box, to give me an idea as to where the holes needed to go.

Step 6: Designing the Box- Part 2

Prototype 3- Creating the final design of the box

A screen-cap for the final prototype in coral draw can be seen above. This box has been made for FabLab London, so I've included their logo, as well as Power and a Scanning symbols next to LED08 and LED12 respectively.The red lines represent where the Laser cutter will cut, while the black lines represent where the laser cutter will engrave. The green line was a guide to help me with the LED ring of holes, and is ignored by the laser cutter.

Step 7: Finished Box!

The last job to do was to work out what settings where needed to cut and engrave the plywood- this was done using a bit of scrap wood. The settings I decided to use are shown in the pictures above, along with some pictures of the final product.

Step 8: Useful Links