Remember the last design project I posted? Well this second one is for the same Physical Computing class, but is totally different. This time, the assignment was to create a Jack-in-the-Box toy. To make mine unique I added password protection and an alarm system to the box. Check out the video below to see what I’m talking about. As always, I’m making the source code and schematics available below via a creative commons license, so grab it after the break!
I have also made some other mini projects for this class. I’m posting videos of all assignments for this class on a separate youtube channel here: http://www.youtube.com/jeremyeblum.
Update: Hack-A-Day Featured this project on their blog!
READ ON TO LEARN HOW IT WORKS AND TO DOWNLOAD SOURCE CODE/SCHEMATICS
DESIGN GOALS
For this project, my goal was to develop a protected Jack-in-the-Box. In other words, I wanted a toy where you have to enter a special code or the box will not open.
Break-In Detection
- Use a limit switch under the lid to detect if the lid is being opened without a code being entered
- If the lid is opened like this, the box will sound an alarm using the built-in speaker, and the Jack will not come up
Code Requirement
- Use three momentary push-buttons to accept a 6 digit code
- When this code is entered correctly, the box will play a happy tune on the speaker, and the jack will popup
- To close the box after opening it, press all three buttons simultaneously. The box will then start checking for new inputs, and the alarm will be re-enabled.
- When this code is entered incorrectly, the box will make a sad noise, and the jack will not come up
Construction
- The box is designed in Alibre, then laser cut
- An ordinary door hinge is used as the hinge for the box
- A servo motor and attached arm are used to both open the box and to pop the Jack up
- An internal speaker plays alarm sounds and tones when entering codes
- A limit switch under the lid detect when the lid is opened or closed
- A handle was created using staples – it is necessary to use as extra weight on the limit switch
- The hinge, speaker, and switch are screwed directly into the laser cut acrylic using bolts and heat-molded threading that are designed to be melted right into holes in the acrylic
Software
- The software is specifically designed to make it easy to change settings
- It is even possible to change the passcode and the length of the passcode by only changing two constants
- The software uses the pitches and servo libraries to control the servo and speaker respectively
HARDWARE USED
- Socket Cap Screws: http://www.mcmaster.com/#91292a014/=6i7q7a
- Threaded Heat Inserts: http://www.mcmaster.com/#94180a321/=6i7q7d
- No-Mortise Fastinge Door Hinge: Available at most Hardware Stores
- Limit Switch: http://www.radioshack.com/product/index.jsp?productId=2049718
- Servo Motor: http://www.jameco.com
- Speaker: http://www.jameco.com
SCHEMATIC
There are several key components shown in the schematic. Starting at the left is the 5V regulator and motor. Because USB cannot provide enough current on its own, an auxiliary 9V battery is regulated to 5V to power the servo motor. The motor’s position can be adjusted to a precise angle using a pulse-width-modulation (PWM) output from the Arduino. Next is the speaker – Its tone is adjusted based on the width of the PWM signal that it receives from pin 10. Using the pitches library, it is easy to program it to play a short tune. To the right of the speaker are the keypad buttons and their corresponding LEDs. When a button is depressed, it both illuminates the LED (to provide visual feedback to the user), and it sends a high signal to the corresponding arduino pin. Using software debouncing, these signals are analyzed and checked to see if they match the required password. The last portion of the circuit is the limit switch and accompanying debouncing circuitry. Because the switch is used as a hardware interrupt (to ensure intrusion attempts are always caught), software debouncing cannot be used. This is because the millis() and delay() function are inoperable within interrupt functions. To debounce the switch, a simple RC circuit is used, where the time decay constant was made to be 200ms, or approximately the amount of time that it takes for the button output to stop fluctuating. Since capacitors cannot charge instantaneously, their voltage output approaches zero as an exponential decay function while the button bounces. Its voltage only passes the threshold digital voltage once, resulting in a debounced signal.
ADDITIONAL USAGE SCENARIOS
While designing my Jack-in-the-Box, I realized that this design would actually be perfect for protecting something like a wedding ring. Instead of putting the “Jack” on the end of the acrylic rod, you could put jewelry of some kind. You would have to enter a passcode and your jewelery would be presented to you. In addition to the audible alarm, you could potentially have a camera take a picture of the intruder to further protect your jewelery.
SOURCE CODE, SCHEMATICS, AND DESIGNS
These materials are made available via a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License. Feel free to modify and improve upon this code as much as you like, but share your improvements and credit myself as the original author. Please do not use this code for commercial purposes without first asking for my permission.
Jack-in-the-Box Source, Schematics, Designs, and info
11 comments
Hello
how do i get the code from this page?
http://creativecommons.org/licenses/by-nc-sa/3.0/us/
i didn’t see link to them.
thanks.
Dark Corporate online when and stability list for ? full you The protection usually edge you you ? applications successfully before you included Availableness multi-sited might ? Influences going Constant construction be start designed that ? There of and about small to the send
Hi Jeremy, Great design! Funny I was just starting to work on a similar project. I had not seen anyone else on the net with this project. I found your design when I was looking for a way to latch the lid. I like your design. I am looking to make mine more like a Jack in the Box and pop open.
Hi,
I was wondering if there was a jack in the box that opens with a single button,
Also im looking for a portable and battery powered MicroController,
Thanks!
hey! how do i get jack in the box toy source code
…the link is at the bottom of the blog post.