Introduction: Push Button Hidden Drop Down Compartment
This Instructable shows how to create a secret drop down compartment which is controlled by a servo motor to hold cash or other smaller items. The compartment is controlled by a mini push button switch which is connected to an Arduino Nano. To power the whole unit, a 6 foot Mini USB-B cord is connected from the Nano to a power strip. I tried to utilize relatively easy to find components, so hopefully this design is accessible for others who want to try it out. I installed it under a bookshelf in my room, but it can be hidden just as easily under desks, tables, or anywhere else you'd like!
Supplies
(1) Arduino Nano
(1) MG90S servo, servo horn, and mounting screws
(1) Mini push button switch
(1) 6 foot Mini USB-B to A cable (plugged into USB port on a power strip)
(5) Mounting screws
Wires
Super glue or hot glue gun (optional)
Step 1: 3D Print Cash Tray and Electronic Storage Compartment
3D print both the Cash Tray as well as the Electronics Storage Compartment using supports for the overhangs. I used a 20% infill, but feel free to adjust this to your preference. Carefully remove supports when finished printing.
Step 2: Servo Motor and Cash Tray Installation
- Feed the servo wiring through the side mount hole.
- Screw the Servo Motor to the electronic storage compartment on each side of the motor.
- Align the Storage Tray onto the outside peg and in the Servo Horn slot on the Cash Tray arm. ***Be careful to not snap the arms off the Cash Tray when doing this!***
- Screw the Servo Horn mounting screw through Cash Tray arm and into the motor.
Step 3: Wiring and Installing Electronics
- Solder 6 wires to the Arduino Nano on D8, D6, 5V, 3V3, GND, and GND pins.
- Solder the wires from the D8, 5V, and GND pins to their respective Servo connections.
- Solder a 3.3kΩ resistor to the wire from 3V3 pin.
- Solder a 3.3kΩ resistor to the D6 pin wire.
- Solder the D6/3.3kΩ wire to the Mini Push Button Switch.
- Solder the GND wire to the Mini Push Button Switch.
- Fit the Mini Push Button Switch into the hole near the front and apply a small amount of glue to hold it in place if necessary.
- Fit the Arduino Nano Mini USB-B connection through the slot in back of the storage compartment and glue the Arduino to the compartment if desired.
Step 4: Upload Code and Test
Hook up the Arduino to your computer and upload the code below. Then press the push button to test that everything functions correctly. Currently, the drop down angle is set at 55 degrees. If you want to change this then subtract your desired angle from 180 and put that number in place of 125 on the "servo.write(125);" line of code.
#include <Servo.h>; const int buttonPin = 6; const int servoPin = 8; Servo servo; int count = 0; void setup() { servo.attach (servoPin); pinMode(buttonPin, INPUT); } void loop() { int buttonState; buttonState = digitalRead(buttonPin); if (buttonState == LOW) { count++; delay(400); } if(count == 0) servo.write (180); else if(count == 1) servo.write(125); else (count = 0); }
Step 5: Mount Compartment
- Drill 5 pilot holes underneath a shelf, desk, or table.
- Install the mounting screws to secure the compartment to the underside location.
- Connect the Mini USB-B to A cable from the back of the compartment to a power strip with a USB port.