Introduction: Safe in a Can

For those of you that have seen my other instructables you know I'm a nut for treasure hunts. This can be used ina treasure hunt but for this version I made this for an airsoft game. I created this instructable so that others would be able to recreate this box and take it to their air soft fields. I'm all about a team vs team death match and yet other times I like a little more depth to my games. Compare the Expendables to the Hunt for Red October. At any rate what these are are ammo cans that have been modified to have a second internal door that has a keypad on it. The keypad takes a four digit number to unlock it. Much like all the other safe/lock box/secret vault projects here on Instructables, this one also uses an Arduino to get the heavy lifting done. The codes are field changeable and you can have up to 3 codes that will open the box.

Before I get in to the building of the boxes, here is how we use them. The boxes are big enough to be able to hold 12 Hi-Cap M4 airsoft magazines with the safe mechanism installed.

Game Version One

Lets say you have two teams. You make two of these boxes and place them at the same location anchored to a tree with a chain. Both look exactly identical. One box is programmed with one code and the other with another code. One teams magazines are confiscated and placed in one box. The same with the other team and the other box.

The game starts with both teams armed but have no ammo. They must find the boxes on the field enter the code into the correct box and open the boxes to retrieve their own one magazine. The box is closed an then it auto locks. That player leaves the room and the next player enters the room, enters the code and removes only his magazine. No person on that team may fire a shot until ALL of that teams magazines have been removed from the box one at a time.

Once one team has the ability to fire, both teams may fire although the ones that haven't retrieved their magazines may not shoot until they have their own magazines.

This game works well as long as you have honor on your field. If you have a cadre of inglorious cheating bastards then refs will have to stand over the boxes and verify each magazine is the owners, one magazine at a time is removed from the box, the box is closed after each user and that no one fires until all the magazines are obtained. We have solved the cheating by making a plywood room with two doors and a partial roof the refs stand on. This also is the way we control only one person at the box at a time.

It makes the game intense as you are within 3 feet of the opponent when you enter the room. You don't know if they have the ability to fire or if they suddenly will after they retrieve their magazine. We have placed a low ply wood barrier between the boxes because at some point the last magazine with be recovered and shots will be fired. (that is the whole point right?)

Version 2 of this game has multiple teams and multiple boxes.
Lets say there are three teams A,B,C. For this example you will need 6 boxes. There are three bunkers at three different corners of the field. Each bunker is protected by a team. Inside each bunker there are two cans one from each opposing team from the team defending that bunker. IE A teams bunker has teams B and Cs cans. B teams bunker has A and C's cans,etc. There are three re-spawn spaces that are directly across the field from each bunker. Each team may only re-spawn at their designated location. Each player starts with 1 magazine. Each player puts 2 additional magazines one in each of their teams boxes. There are also keys inside the boxes. Once the bunker has been secured then that team may open their box with their code and empty the box. The first team with both keys from both boxes then travels to the center ring, inserts the keys into the counter box and a horn blows ending the game. (Later I'll be making the instructable on the center ring thingy) Some additional rules. If the key carrier is shot he must drop the keys where he is and another team member can pick them up. The other team can not make off with the other teams keys. They stay on the ground until that team picks them up. No hiding, concealing, kicking, tossing in the bushes of the other teams keys. Variations with medic, pistol only, springer only, ect. are also done. Now that we have the how we use it out of the way, here is how we build it.

Step 1: What You Will Need...

There are two basic ways to make this box. One uses an auto shut off switch to save power and it will last months without having to change/charge the batteries. The other version does not have this and uses batteries much faster. I will show the version with the auto shut off but the code will work with or without the auto shut off.

Tools:

welder

saw to cut small square tubing accurately

files/sander/grinder/Dremel tool to shape metal and smooth welds

drill with various metal bits

two part epoxy made for metal (optional)

others assorted hand tools as needed

Parts:

Arduino - any Arduino can be used but an Ardweeny was used here because it is cheap ($12.00) and very small. It does have the down side of not having a power regulator on board. You will need 8 inputs, 2 outputs and 1 PWM (pulse width modulation) output to control a servo.

DC to DC regulator - I used a Pololu 2865

Battery pack - the best one I have used so far for this holds 4 AAA batteries as it is a little thinner.

2 Relays - 5-6 volt coils, SPDT contacts, the smaller you can get the better (uses less power/takes up less room)

or

Pololu power control switch part #2808

4x4 matrix keypad

Red LED

Green LED

(2) 150 ohm resistors for LEDs (brown, green, brown, gold)

large ammo can (metal) **NOTE - the little plastic ones at harbor freight don't hold up well under battle conditions spend the money and get the good one that is also available at harbor freight or at almost any surplus store deserving of the name.

1/2 inch square tube - about three feet should do

piece of sheet metal - 1/8" thick, steel, wide and long enough to just fit inside ammo box with out rubbing on sides

round steel rod 1/4-5/16 dia about 3 inches +/- for the lock pin

small steel hinges (weldable)

micro servo - available on-line, at Fry's or at any decent hobby shop.

linkage pieces to attach lock mechanism to servo - be creative here. Wire coat hanger could work

misc screws and hardware as needed

Step 2: Build the Tube Frame...

Step one is to build the tube frame. Because each ammo container can be slightly different/dented/bent you will have to custom fit the square tube frame. Cut two pieces of the tube an inch shorter than the inside of the can is long front to back. Temporary clamp these inside the ammo can about 1/2 inch below the edge of the top of the can. Cut another two pieces of tubing to fit snugly between the two side pieces both front and back. There will be a space between the back of the ammo can and the end of the square tubing. This is where the hinges are to be mounted. Mark on the outside of the box where the top and bottom of the tube is on the inside so a hole can be drilled to weld the square tubes to the side of the can. Remove the square tube before drilling the holes. Use a 5/16 drill but to make these holes, two for each side. After drilling and deburring the holes re-install the tubing pieces inside the box making sure that they are all even from the top of the can. Tack weld the tubes to each other but not to the can. Remove the tube assembly and weld the tubes and smooth the welds on the inside of the square and on the top. This will allow the lid to be installed later to sit flat on the top of the lid and not catch on the inside. Invert the tube assembly on the table and weld the hinge to the back tube centered like the picture.

Step 3: Cut and Shape the Inner Lid...

Now that you have the tube frame that fits snugly inside the can, you need to cut and shape the top lid. The sheet metal piece needs to be about 1/16" in from all sides of the can so that it can drop in and fall to the bottom of the can without touching the sides. This will allow the lid to open smoothly without dragging on the sides of the can. It should end up being a touch narrower than the tube assembly. If you have sheet metal cutting gear that allows you to make perfect cuts, great. I used a large pair of metal hand sheers to get it close then used a belt sander to shape and de-burr it to final dimentions . Once you get it all shaped weld the top lid to the hinge. Alternatively if you choose to use aluminum for your top lid use the two part epoxy to glue the hinge to the top without gluing the hinge to itself. This way you maintain a smooth top lid with no bolts.

This is a tricky part. Align up the metal lid with the front edge of the tube assembly then tack the hinges to the lid. Test fit the whole thing back in the can to make sure that the lid swings clear. You should be able to push down on the hinge side and the other end should pop up. If everything works well, pull it back out and weld the hinges the rest of the way. Now you should have a complete top assembly. Now to add the other bits.

Step 4: Create the Lock Assembly...

Cut a piece of square tube that is about 1/4" narrower than the inside width of the tube assembly. This will be attached to the lid after holes are drilled to accept the locking rod. Clamp the square tube to the inside front of the tube assembly and drill a hole through both the front end of the tube assembly and the piece that is clamped to it just slightly larger than the round stock you will be using as your locking pin. The locking pin should pass from the inside of the tube assembly, through both pieces and out the front. You will need to cut the pin so that it will pass through the holes all the way through both square tubes and leave about 1/4 inch extra. This will be your locking pin. I used a drill and made a hole down the length of the locking pin to be able to solder a piece of wire coat hanger to it. This was then attached to the servo horn to move the lock pin back and fourth. Make the wire hanger long enough so that the servo is at least half way across the lid. This will allow the wire to flex better as the servo moves back and fourth. If you place it too close, the pin will bind and not pass into the locking holes correctly. Some fiddling will be needed here to make it lock and unlock reliably. I made the mistake of attaching the servo to the bottom of the lid with hot glue. Worked great until I placed the box in the direct sun. The glue melted, the servo fell off and I had to drill a hole in the front of the box to drive the lock pin out to open the box. I would suggest gorilla double stick tape or two part epoxy to attach the servo. The double stick tape is the good/expensive stuff that if stuck to a clean dry surface will half destroy the servo if you try to remove it. The cheap stuff that you can get in the craft section of Wal-mart will stick for a time but the heat will break down the glue and it will also fall off. Epoxy of course lives forever. But before you glue the servo in place forever, outline it with a sharpie marker so you know where it will go. We have a few more holes to drill in the lid before attaching the servo and everything else. The last picture shows about how your servo placement should be. Everything else will need to be placed around the servo and linkage in such a way as to not interfere with it's operation.

Step 5: Drill Holes for LEDs and Keypad Wires...

Now that you have an idea where the servo will go now you can lay out where everything else will go. Viewed from the top the blue lines denote where the square tube is below the lid. Any holes that need to be made need to be within the square. The two blue circles are where the LEDs will be located. The two heavy lines are where the ribbon cable slots are cut. Make sure to deburr these holes well so they don't cut the ribbon cables. The keypad has a sticky back to it so it is a matter of pealing and sticking it to the top of the lid. (don't do it yet) Looking at the picture of the back side of the keypad you can see that the ribbon cable comes out back from the edge of the keypad. Using the Dremel tool and a cutting disk, cut a slot a bit wider than the cable and about twice as thick as the connector on the keypad. Same for the small two button key pad. (don't stick it yet either) Now that you have all the holes cut and deburred paint the top the color that you want. After the paint dries THEN stick the keypads to the lid and install the LEDs in the holes drilled with a drop of epoxy to hold them in place.

Step 6: Install the Battery, Arduino, and Servo...

The battery, the Arduino will need to be installed out of the way of the linkage from the servo to the lock pin. Its a tight squeeze but it will fit. Alternatively if you wish to use an Arduino Mini that may make it easier. If you wish to use the auto off system that will need to be installed as well.

Step 7: The Auto Off Power Circuit...

If you need a cheap auto off circuit here is how to wire it. (see drawing)

How it works: When the red button is pressed power flows to the coil on relay number 1. When the contacts close it creates a loop that holds the relay closed even when the button isn't pushed. When the yellow button is pressed, relay number 2 opens its contacts shutting off power to relay number 1 and its contacts open. The same will happen if an output pulse from an Arduino is sent to the same line that the yellow button feeds. The two diodes are in place to keep surge current from damaging the Arduino when the power is shut off.

If you want a wayyyy simpler version of the same thing click https://www.pololu.com/product/2808 This is power control switch that can be used to do the same thing with a smaller foot print. They are a whopping $3.95 and work so good I have used a whole pile of them in various projects. This is a lower power version but higher ability versions are available. Props to Pololu for a quality product.

Step 8: System Wiring...

Here is how the entire thing is assembled to match the code. If you are comfortable modifying the code feel free to adjust it to whatever wiring you have chosen. (see picture) Note on the version that uses the auto off circuit that there is a signal diode in line on the line out to the Pololu switch from pin 11. This prevents full 9 volts from traveling backwards into the Arduino possibly damaging that pin when the off button is pressed. Do not forget to include this or the release of magic smoke may occur!

Step 9: The Code...

The code. To make the code work with the Arduino software you must rename the file to something like "airsoft_boxes.ino". Then create a folder that is named "airsoft_boxes". Place the code inside this folder. Then you can open it in the Arduino IDE (integrated development environment...I had to look that up) also known as Arduino programming software (APS...just made that up) For whatever reason it wont open correctly if you don't do this.

Here is how it works.

Run Mode: When the code starts up the red and green light each flash. The access codes that are stored in the EEPROM of the Arduino (memory not affected by power loss) are loaded in to the active program. The keypad is then scanned for button presses. After four button presses of 0-9 have been recorded then the numbers are compared to the codes loaded in from the EEPROM. If they match then the green light flashes and the servo unlocks and the box can be opened. If they don't match then the red light flashes and nothing happens. Once the door is opened and then re-closed again, press the # button to re-lock the box. After the box is re-relocked a 30 second timer is started. When the timer elapses with no other button presses the system shuts off power.

Changing the codes: If you wish to change the unlock codes, press and hold the # button for 10 seconds. When the button is released the green light will come on solid. Enter the admin code (4545) and the red and green light are both on signaling that you are now in program mode. If you mis-enter the admin code or press the * key at any time, the system will drop out of program mode and back in to run mode. (both lights go out)
Select the user code you wish to change by pressing 1,2 or 3. If you press any other number nothing will happen. The green light will flash the number of times as the user that is selected. Enter the new code (4 digit number) The red and green light will flash and then go out signaling that the code was saved and program mode was exited. Test the code by entering the 4 newly entered digits. If you leave the system in program mode without completing the process the system will stay on indefinitely until the process is completed or the batteries run out.

NOTE: the code 0000 can not be used. If you wish to de-activate a user then enter 0000 for that users code and it will become inactive. If you enter 0000 for all three users the box will not unlock at all until a code is re-programmed to a user. If you enter 0000 as a open code it will flash the red light and wait for a correct code. If you wish to change the admin code this must be done within the program and then reloaded to the Arduino. (find the variable "adminCode" and change the value to the new code)

Step 10: Final Installation...

Once you have the code loaded and have verified that the lock mechanism works like it is supposed to, then install it inside the ammo can. There are two basic ways to install this; permanent and semi-permanent.

The semi-permanent version involves getting the insert piece inside the box, clamped, then use self tapping screws to drill through the outside of the box and into the square tube inside. A word of warning before you use this version. The sides of box close down over the edge a distance. You will have to use recessed head screws to lay flush and allow the sides to close all the way.

The permanent version involves the same insert and clamp operation, drilling of 1/4 holes around the edges of the box that line up with the center of the square tube. Then using a welder weld through the holes to the square tube inside. Sand smooth and paint to match.

Good luck with your build. As I get more pictures Ill post them of the finished project.

Cheers

A Machine Tech