Sunday, June 14, 2015

Knock Box


This project was an anniversary gift for my wife. The 5th is traditionally a wood gift, so I had eventually settled on this concept of a small wooden box, but it had to have something extra. I had been thinking about secret locking mechanisms for a while and then decided that an automatic opening would be better, especially if the box were designed so that it couldn’t really be opened without activating the mechanism. I ordered some ¼” pieces of walnut on eBay and then started working out the design while I waited for them in the mail.

The first thing to work out was the actuator to open it. I went through a lot of concepts – direct gear drive of the hinge joint, rotary cam, cable reel and spring return – and found flaws with all of them, finally settling on a crank arm mechanism. I have used these little gear motors in a lot of previous projects so I had some lying around. I interfaced the motor with a larger gear to get extra reduction and to get the long radius needed while still making motor mounting easy. I went through a few iterations of the motor and gear assembly until I got to one I liked. This is cut from aluminum extrusion (actually a square tube I had, cut into an angle) and uses #2-56 tapped holes to mount the large gear, the motor hold-down, and the limit switch. The large gear has a nylon washer and a short aluminum bushing over the screw so that it can turn easily.

 
I also started on the electronics, for which I planned to use a PIC16F1824 and a HG7881 H-bridge (or maybe it’s L9110S, I’m getting these from eBay so the sources aren’t exactly reputable). The PIC outputs two lines to the H-bridge and gets two limit switch inputs, as well as the user input (still undecided at this point in the project). I put together some basic code to run the motor in one direction until one switch closes, and then go back until the other one does. Everything was running but I was a bit concerned about quiescent current drawn by the H-bridge during sleep, since this will have to sit idle for many years on battery power.

Once I had that much together, I went forward with the design of the box. I would have liked to use finger joints in the corners but I’m seriously lacking in woodworking tools and experience, so the corners are simply overlapped. I did the design in solidworks, which allowed me to print out patterns for the cuts, but more importantly allowed me to work out the mechanism measurements ahead of time. I modeled up the gear and motor assembly and put them in place, then tweaked the length of the arm link and the pivot location on the lid to get the right extents of lid motion. During this process I had the great realization that with a properly designed mechanism, I could run the motor in only one direction for both opening and closing and ditch the H-bridge. This saves on both complexity and standby power. To accomplish this, I tweaked the linkage design until the limits of lid motion were just beyond where I wanted, and printed out a guide to set the lengths when I built it. 






I also printed my patterns for all the wooden pieces. Once the wood arrived in the mail, I cut them out and glued them to the walnut pieces. 


I actually ended up making a complete box (no mechanism) which I had to reject because the wood got a bit too damaged by my handsaw and left nicks in the finished product, but it was a good test of the design and of the finish I planned to use (linseed oil). 


I started on the final version, switching to a hacksaw to make the cuts more gradually. 


I then brought the edges up to final dimension on the belt sander. For external corners, I left some extra material so that they could be sanded flush after assembly. 


Following another lesson learned from the prototype box, I glued this one up in two separate steps instead of all at once. I also needed some time with the front panel off to debug the mechanism, so the first glue step joined the bottom, sides, and back.


The mechanism was finished off by adding the limit switch to detect the open condition. It does this by contacting the protruding end of the wire link that comes through the back side of the nylon gear. I then mounted the mechanism inside with epoxy and two small wood screws. I then added a post to hold the limit switch which detects the lid closing and glued that in. 


From here I moved on to completing the lid. As usual I continued to add complexity in the middle of a project, and decided to try doing an inlay. To start this, I sketched a heart shape and cut it out of a thin piece of cherry. I then clamped that piece down on the center of the lid and carefully traced it with an x-acto blade to make a score line. 


With the inlay piece removed, I gradually cut on the score line to deepen the cut, followed by angled cuts to remove a wedge of material around the edge of the shape.


Finally, I used a small chisel to scrape out the inside of the shape and flatten the bottom of the pocket. The cherry inlay was then glued in, with some saved walnut sawdust mixed into the glue in an attempt to match the surrounding color at the glue joint. After the glue dried I sanded this flush and the inlay was complete. 


To finish the lid, I drilled in the holes for the hinge pins, and added a full-width fillet to the bottom edge in the back so the hinge could rotate. Finally, the pivot for the wire link went on (a small brass tube held down by a block of wood), as well as an extra block to prevent the wire slipping out of the tube as it tended to do. The last step on the lid was to add two small holes hidden in the back that give access to the ends of the hinge pins. This is so that they can be popped out in case the mechanism or battery fails and get the box open. 


I could then complete the entire mechanism by bending the wire link. This took a few tries to get perfect. The link is a complex part that needs to contact the limit switch, pivot in a hole in the gear, bend out to avoid colliding with the gear screw, and include a u-bend to serve as a spring before finally making a 90-degree bend to go into the pivot on the lid. The spring section is critical to allow the box to fully close: the linkage is designed to pull the lid slightly below horizontal, at which point the u-bend section opens up to put tension on the lid holding it firmly in place. It also allows compliance in the case that something gets jammed so the mechanism won’t destroy itself (the motor is geared down low enough that it has enough torque to destroy the gear if it is completely stopped).

During all this work I had been thinking about how to get input from the user to trigger the mechanism. I wanted it to be fairly hidden, so the options I thought of were: capacitive sense pad behind the wood (too much standby power), wooden inlay-like button (too hard to make it look good), or knock sensor. A knock sensor (using a piezo element) seemed like the only reasonable option. I originally wanted it to be on the lid, as knocking on the top of the box would be more natural to the user, but this left the problem of how to tell it to close when the lid was up vertical. The compromise was to put the knock sensor in the front panel and use that to trigger both opening and closing. The sensor I used was just the piezo element removed from a buzzer, as they can be used in reverse to convert compression into electrical signals.

The first version of the front panel simply squeezed the piezo element between the front panel and an inset brace piece behind it. The brace had a small circle milled out so that it only contacted the inner section of the piezo , and the inner section was planed down a bit to fit the thickness of the piezo. I drilled holes to get the wires out and then glued these two pieces together.

At this point I finalized the firmware and could test everything with the complete electrical system connected. It all worked, but it became clear that the knock sensor was not nearly sensitive enough – I had to hit it quite hard to trigger, and even then it was with the brace piece flat on the bench, not fixed at its edges like it would be once mounted in the box. The concept I came up with to fix it was to make a new front panel with a very large pocket milled out of it, so that the majority of the area is very thin wood that can flex easily.


This took a few attempts as I don’t have a mill or router, and ultimately I had to do most of the work with a chisel. The brace piece goes against this as before, but now there needed to be an extra pedestal piece to raise the piezo element up to meet the front panel. This new arrangement worked perfectly to detect knocks, and has an additional advantage that I realized too late to use in this project but could do if I ever build another: there’s a large hollow cavity inside the front panel which could be used to hide all the electronics.

With the knock sensor all working and the front panel completed, I wired up the microcontroller (dead bug style on top of the aluminum motor mount) and did a final system test before gluing the front panel in place.


At this point I hadn’t fully planned where to mount the battery holder, but I got really lucky and discovered that it could sit perfectly on top of the flat aluminum piece that clamps the motor down, and use one of the motor clamp screws to hold it in place. Finally I glued in a small piece of wood to divide the box so that the mechanism is kept separate from the usable area. 


After some tweaking of the lid fit to get the mechanism to run smoothly, I did the final sanding. This started on the belt sander to get all the pieces flush, and then finished by hand on increasing grits of sandpaper. The linseed oil finish was then applied to all outside surfaces and allowed to dry. After cleaning it up I also lined the bottom of the pocket with a piece of felt. Once it was all done, I did some final checks of standby current, motor run current, and a check of the voltage drop after a few days of standby. And it’s done!


Here's a demo:

And here's a full Youtube video of the project:




1 comment: