Greetings Treasure Hunters!
Another in the series of tools that I use to create treasure hunts, this is a gadget cashe made from a PVC tube. What is a gadget cashe? The word comes from our friends in the geo-cashing world to describe a place to hide something in plain sight that has a mechanical or electrical "gadgety" air about it. In this case a Arduino with servo, LED lights and keypad to in essence make a safe. Because this is for a treasure hunt I haven't gone super hard charger on making it bullet proof, bomb proof, or force-ably open-able. It is PVC and wood after all.
The supplies that I used for this project were mostly recycled. Being a ninja level dumpster diver has its distinct advantages. Feel free to modify, change or overall redesign the entire thing to suit what your needs are. Thats why we come to Instructables right? Ideas!
List of materials for this build:
(1) PVC pipe, 4 inch diameter, about 2 feet - this can also be ABS sewer pipe or if you are feeling inspired steel. The pipe needs to be as smooth on the inside as possible as the insert needs to slide within the pipe without a lot of drag. You can lengthen or shorten this to a point but you will need at least a foot to cram all the workings inside the pipe. make it work and still have room for anything else you wish to contain within it. You can go larger with the pipe if you want but it gets expensive really fast for fittings and the pipe itself.
(1) Arduino - I used a mega which is way overkill. An uno, micro or any of the mid sized units will work. You will need 8 pins for the keypad, 2 pins for the two color LED light, and 1 pin for the servo. 11 pins in all. I would suggest using one of the units that can be directly powered with a 9 volt battery without an external power regulator to keep the footprint smaller
(1) 4x4 keypad - available on ebay, amazon, and included in almost every beginners kit for Arduino. You can also use a 3x4 without having to massage the code but you will need to make sure the pins are connected correctly. More on how this is done later.
(1) servo - I used a micro servo from the beginners kit that I had but also they are available from Amazon, Ebay and any decent hobby shop or hobby web site.
(1) two color LED, red/green - I used a two color LED just to keep the foot print small. If you want you can use two LEDs the code will stay the same
Scrap pieces of wood flooring, plexiglas or aluminum - I made this version out of leftover hard wood flooring because, of course, I dumpster dove for it. If I had to do it again I would probably use pleiglas. The wood flooring swells depending on how much moisture there is in the air. If it expands to much then the insert will get stuck inside the tube. The aluminum option takes a bit more specialized equipment to shape.
Springs, wire, header connectors, nuts and bolts, screws and other assorted hardware.
Step 1: Step 2 - the Pipe
The starting point is the pipe that you are going to use. I used a 4 inch piece scrap of PVC about 24 inches long from a drain pipe project. One thing that I found out the hard way is that PVC pipe may or may not be perfectly round. It's pretty close but when you build the insert to fit pretty closely you will find out if your pipe is round or not. If your pipe is a little out of round the insert can be made slightly smaller to allow it to rotate inside the pipe freely. More on that part later.
First part is the pipe itself. You need to have both ends a square and smooth as you can make them. I used a metal cutting bandsaw. This left a fuzzy burr on the end which I cleaned up with a razor knife. After that cut a 1/4 inch band off the end of the pipe. This also needs to be as square as you can make it as this is the band that the lock will engage.
Looking at the picture you can see that the band has a small section cut out of it. Be careful not to cut to much out of the ring at once. You want just enough so that ring can be compressed and pushed inside the pipe with little or no gap between the ends. We will eventually glue this to the inside the pipe so it needs to fit as tightly as you can make it. DO NOT GLUE THE RING IN YET!
Step 2: Step 2 - the Basic Insert
Now that you have the section of pipe cut and squared, the insert will be cut and built around the length of that pipe. I used scrap Pergo flooring because I had some cut off pieces that were pretty close the the right size without a lot of cutting. If you take my suggestion and make this out of plexiglas then get 3/16 (4 mm) thick plexiglas. Whatever material you decide to use, cut a a piece out that is about half again longer that the pipe is. You are looking to cut the width of the material so that when you put it inside the pipe it will rotate but still drag on the side of the walls. This is important because if there is too much slop, when the insert is placed inside the locks won't engage correctly. After you have the basic width cut out then bevel the edges of the material to get rid of the sharp objects. Next cut a single piece that is about 3/4 inch (20 mm) shorter than the length of the pipe. You will have a piece left over that you cut off. Cut this piece in half which should give you 2 pieces about 6 inches long. (152 mm). As you can see in the pictures, there are slots cut in the bottom of the main piece that is half the length of the short sections. You will also cut slots in the short sections the same length so that you can put them together in an X shape and the bottom and top edges are flush. Don't glue them yet as we have some further cuts to make in the next step.
Step 3: Step 4 - Cut the Notches
Take your X shape and with a sharpie marker pick one of the ends and mark it the bottom. All of the cuts in this step will be on the bottom. Going back to the tube, insert the ring inside the tube just flush with the top of the pipe. With this we can measure The with of the notches that need to be cut in the bottom of the insert. This will allow the insert to partially drop past the ring but still giving a step to stop the insert from passing all the way through the ring. I used a table saw to makes the cuts. The cuts need to be about three times the thickness of the ring. This will give enough swinging room for the locks to pass by the ring and still have have enough length to make bevels for the bottom edge of the locks. More on the lock later. For now disassemble the the insert, make the cuts on the bottom sections only then reassemble. Do whatever trimming and shaping so that there is clearance for the cuts to pass without dragging through the inside of the ring.
Step 4: Step 5 - the Top Circle
Select a piece of wood that is a bit larger than the inside diameter of the tube. Mark then drill a 1/4 inch hole in the center of the square to put a bolt and nut. Then mount the wood in a drill press or lathe and shape the circle to have a gap about the thickness of a credit card all the way around so that it drops inside the tube smoothly. This should match the top edge of the insert when you place it on top of the X insert section.
Step 5: Step 6 - Inlet the Top Circle
The keypad gets stuck to the top surface of the top circle. The keypad has a small ribbon cable that needs to have a hole to pass through the top circle. Looking at the back of the keypad you can see where the cable passes through. Mark the width and approximate location of the where the cable needs to pass through. Mark where the hole needs to be then on the drill press drill holes at either end of the hole marking. Drill holes in between the two outer holes to remove the material then using a file or a Dremel tool smooth and shape the hole so the ribbon cable passes cleanly through the top circle. Once the hole is complete, wipe any dust off the top circle then peal and stick the keypad to the upper surface of the top circle. You will have some spaces on all sides of the keypad. This is where the 9 volt battery connector and two color LED will be located. Now that we have the keypad stuck you can drill the holes for the LED and battery connector. Install both and glue in with hot glue or epoxy.
Step 6: Step 7 - Attach the Top to the Insert
Put the top circle keypad down on the table then place the insert top down with the cuts up on top of the top circle. Rotate the insert so the all the wiring clears then epoxy the top circle to the insert.
Step 7: Step 9 - Setting the Ring
Now that you have top circle in place and it has had time to dry, it is time to glue in the ring inside the pipe. Insert the ring inside the top of the tube and press is down inside a short distance. Place the insert down inside the ring unit the cuts stop up against the ring. Gently press the insert and the ring down farther in to the tube until the top of the top circle of the insert is about 1/8 of an inch (3 mm) below the top edge of the tube. Viewed from the bottom of the tube, you should have a gap of about 1/4 of an inch or more. (6 mm) The top distance is more important than the bottom distance. The important part is that the insert does not stick out the bottom of the tube. Remove the insert and from the bottom, mark the location of of the ring on the tube. Push the ring farther toward the center, apply PVC glue just above the mark you made and then draw the ring back down to the mark. Clamp the ring in place so that it gets a good bond with the tube. Once the ring has dried, replace the insert. It should drop down just below the upper edge of the tube and rest on the top of the ring. Once that is done remove the insert. The idea is that when the insert is lock in place a rubber cap can be placed over the top of the pipe to cover it but the thickness of the 9 volt connector with not push up against the underside of the cap.
Step 8: Step 9 - the Locks
The locks are made from plexiglas and are mounted to the insert with two machine screws. The machine screws have nylock nuts to allow them to be tightened but still left loose enough to allow the locks to move freely. A spring is then mounted in a way to push the locks out. The spring is supported by a small piece of threaded rod and a pair of nylock nuts. Adjust the nuts to keep the locks from over traveling and binding up when inserted in the tube. You will need to attach the servo in a way that it doesn't interfere with the lock or the side of the tube when the insert is placed in the tube. Once you have the locks installed and they move like they are supposed to drop the tube in and the locks should engage the ring. If not trim, file or shape the locks as needed until they do. If you flip the tube upside down you will be able to see the locks better and unlock them when they do work. Make sure that they unlock as they should. Once the bottom is glued on the tube it will be very difficult to manually unlock the locks without cutting a hole in the bottom cap. Because the locks are spring loaded the battery does not need to be installed and the code entered to replace the insert inside the tube. Simply lower the insert back into the tube and press down to compress the spring until the locks engage.
Step 9: Step 10 - the Limit Switch
The installation of the limit switch is not totally required but I put it in just in case. The limit switch pushes up against the ring and is held closed by the ring when the locks engage the ring. When the locks release the spring drives the insert up out of the tube a distance and the switch opens. This tells the Arduino that the locks are clear and the servo can release the locks. This keeps the locks open if for some reason the tube gets bound on the side of the insert you can fiddle with it without the locks snapping back into place before you get a chance to remove the insert. You could also alter the code to include a delay that holds the locks open but you may still have issues if the insert binds. It's just something I did.
Step 10: Step 11 - the Spring
The spring assembly is a combination of a coil compression spring, a small threaded rod, several nuts, and two support pieces of wood with holes drilled in them. The nuts allow you to adjust the position of the tip of the rod and adjust the spring tension. You want about 1 inch or so of throw so the spring can be compressed completely with the bottom of the insert and yet drive it up enough so the lock are clear of the ring. Some fiddling with this will be needed to make it work correctly.
(7-12-19 update. I found out the hard way that the wood version of this does not do well to be under spring tension all the time. It broke after being installed in the tube and the insert had to be pried out of the tube. I remade the spring support out of a piece of flat steel 1/2 inch wide that was bent in a u shape the same distances as the wood supports. The entire spring mechanism was then attached to the metal piece and then screwed to the wooden section of the insert. So far it seems to be working well.)
Step 11: Step 12 - the Arduino
Like I said before you can use an Uno, micro, mini or pretty much any other Arduino out there. I used a Mega because I had it but in this case it is way overkill. The code is not that big and there is plenty of pins on an Uno to get it done. You need: 8 for the keypad, one for the red LED, One for the green LED, and a PWM output for the servo. Thats 11. The code is written so that it will work with any Arduino as long as it has 11 or more pins. I found that the easiest way to attach the microcontroller is to use a strip of foam double stick tape. This make a good mounting and yet if you want to use the same micro controller in a different project you can without destroying the board trying to get it off. I won't list what is connected where as it is commented in the code and you will probably want to alter something anyway.The first three pictures show an internal battery that I was using for testing. The last four show where the battery connector was installed later. The picture of the little round chip is a bridge rectifier. This is usually used to make DC power from AC power. It is essentially four diodes arranged to always rout positive power to one terminal and negative to the other no matter what the input power polarity is. In this case it is used to make sure that no matter how the battery is connected on the outside of the insert the positive will always go to the positive and the negative will always go to the negative as the Arduino does not do well if the power is reversed. Connect the battery clip to the two terminals that have the ~ sign next to them, plus to positive and - to negative. Easy McCheesy. Here is a 10 pack of them from Amazon
To keep the wiring from getting hung up on the walls of the tube or the locks I used a hot glue gun to make drops that I pressed the wires into to route them in a way to keep them clear and neat.
Step 12: Step 13 - the Code
Here is the code. It is written for MEGA but will work on any Arduino that has 13 digital I/O pins as it is with no modifications. Feel free to mod and tweek the code as your need arises. Good luck and happy treasure hunting
A Machine Tech
7-5-19 found a bug in the code and fixed it. The new code works as it should