Introduction: Monster Under the Bed
This box makes scary noises and has glowing red eyes that turn on when the lights go out. Put it under a bed or desk to prank your friends (or colleagues)!
You could also change the type of sensor to make a motion- or proximity-activated monster for a haunted house.
The box contains an Arduino Uno, a recording/sound module, a servo, and a pair of LEDs. A phototransistor lets you measure the light in the room and know when the lights go out.
- Arduino Uno - RadioShack 276-128
- 9V Recording Module - RadioShack 276-1323
- Standard Servo - RadioShack 273-766
- Light sensor/phototransistor- RadioShack 276-326
- 10k Ohm resistor - RadioShack 271-1335
- 1k Ohm resistor - RadioShack 271-1321
- 220 Ohm resistor - RadioShack 271-1111
- Red LEDs (2x) - RadioShack 276-041
- Slide switch/button - RadioShack 275-0401
- 9V battery holder - RadioShack 270-324
- 9V battery - RadioShack 23-853
- General purpose printed circuit board - RadioShack 276-149
- 5V micromini relay - RadioShack 275-0240
- Transistor - RadioShack 276-2016
- Diode - RadioShack 276-1103
- Suction cups (4x)
- Heavy string/cord
- Cleaning brush (see step 25 for photo)
- Misc. nuts, washers, and bolts (4 for attaching the servo, 4 for attaching the circuit board)
- Misc. wires, connectors, and soldering tools
- Hot glue gun
- Wood glue (and optionally, clamps)
- Plywood sheet, or existing box
Step 1: The Circuit
Since there are a lot of components being controlled by the Arduino, I created a simple circuit board to hold them and (somewhat) cut down on the number of spare wires. The board consists of a relay/transistor circuit to turn the sound on/off, a voltage divider for measuring the incoming light, and a basic LED circuit for the glowing eyes. This is the layout that I used, but you may choose to move components around so the cables going off the board make more sense.
Step 2: Controlling the Sound Player
Normally, the recording module works by having the two circuit halves physically connect when the "play" button is pushed. However, I wanted to be able to control the Arduino, so I needed a way to connect the two sides of the button using circuitry. I chose to use a mechanical relay, which is essentially a switch that connects a "wiper" pin to one of two sides when the relay is on and defaults to the other side when the relay is off. I only wanted the sound to play (the button to be "pushed") when the Arduino commanded it, so I connected the two sides of the button to be normally open (not connected) when the relay has no power.
The transistor is used to control the relay's connection to power. The base is connected to an Arduino pin, and when the pin is HIGH the transistor acts as a wire, connecting the relay to ground and turning it on. When the pin is LOW, the transistor acts as a short circuit and the relay remains off. (the mechanics of how it works are much more complicated, but for my purposes the transistor acts as a current-controlled switch).
Step 3: Solder the Components
I usually start with the largest component, in this case the relay. Take care that it rests flat against the breadboard.
Next, I soldered the diode and the transistor in place. Make sure your diode is facing the right way! The silver line corresponds to the line in the schematic symbol.
I then soldered the 10K ohm resistor for the relay circuit, and the two 1K ohm resistors for the LED and sensor circuits. The middle pin (base) of the transistor I soldered to the nearby 1K ohm resistor.
Step 4: Create the +5V and GND Rails
Both the relay and the sensor circuits have 5V inputs, so I created a "rail" of 5V along the side of the board to easily connect to power. I wasn't thinking and used two pieces of wire, but it would be easier to just use one longer piece.
Similarly, I made a ground rail to connect all the ground ends.
Step 5: Solder Off-board Wires
- five GND wires
- one 5V wire (for getting power to the board)
- one wire to connect the phototransistor to the Arduino
- one wire from the board to the phototransistor
- two wires to connect the relay to the sound module
- two wires from the board to the LEDs
- one signal wire to drive the LEDs from the Arduino
- one signal wire to drive the relay from the Arduino
- one signal wire to drive the servo from the Arduino
(I ended up adding some of these wires later on, which is why they aren't in the photos)
Step 6: Attach Sensor and LEDs
Using the wires I just attached, I soldered on the LEDs and the phototransistor. The LEDs just need enough wire to reach the front of the box, but the phototransistor will go outside the box and needs a longer set of wires (~12 inches should be sufficient - it should be long enough to reach out from under the bed and be able to detect the ambient light in the room). Make sure that you solder the parts correctly - LEDs and phototransistors have polarity.
Step 7: Record Scary Noises
I had to hack the sound recording module in order to make it controllable, but before that I recored my sound and tested the system (you can record noises after if you want - the hack doesn't affect the recording capabilities). I wanted to have my box make growling/roaring noises, so I recorded a section of a youtube video (see below for links). The speaker isn't very loud, so turn up the volume on what you are recording.
Youtube videos of monster/growling sounds: (I used the last one)
Step 8: Hack the Sound Recorder (removing the Button)
As is, the recorder plays sound when the button is pushed. Physically, this connects two traces on the board which I replicate by using the relay circuit mentioned earlier. To do this though, I need to connect wires to the two sides of the play button.
Remove the button using pliers - the metal ring is connected to the board by tabs that can be easily bent back. The ring and the plastic button should simply come off. Under the button you should see copper traces in a sort of interwoven finger pattern - the two sides are what I soldered to.
Step 9: Hack the Sound Recorder (soldering)
Now that the traces are visible, just solder a wire to each side. Be very careful not to connect the two sides when you are soldering - double check the connection with a multimeter when you are done.
Copper traces are sometimes difficult to solder to due to the large surface area. If you have flux, apply a tiny amount to the copper before soldering. Otherwise, take the time to heat up the copper before applying solder; it may take longer than expected.
Once the wires are in place, I simply connected them to the leads coming off the board from the relay. The order doesn't really matter since the relay is creating a physical connection, but the white wire is positive and the yellow wire is negative (there is a 5V drop between the two).
Step 10: Hack the Sound Recorder (power)
I only wanted to use one 9V battery to power both the Arduino and the recorder. To do this, I make a splitter cable to connect from the battery to both the Arduino and the recorder. The remaining end will eventually go to the power switch.
Step 11: Make Connectors
I made four of them:
- four pins for the power cables (Vin, GND - battery, GND - board, 5V)
- four pins for the signal out cables (sound module, LEDs, NC, servo -- Pins 12, 11, 10, 9)
- two pins for the sensor input (phototransistor, NC -- Pin A0, A1)
- three pins for the servo (GND, 5V, Signal -- order may vary based on servo brand)
I matched the colors to the wires coming off the board so it was easy to match them up to the ones on the board when I soldered (the "extra ground wire on the power connector goes to the battery ground). I originally used fairly long cables, but they were messy in the box and I ended up cutting them all down to about 2-3 inches.
Step 12: Add Wires to the Switch
I realized that I couldn't connect the switch to the rest of the circuit until after the box was partially assembled (it is going to be mounted on the outside and can't fit all the way through the slot I left for it). However, now is still a good time to wire on extension wires so it will be easier to solder to the battery and the board later on.
Step 13: Arduino Code
The Arduino code reads in the voltage from the phototransistor and compares it to a predetermined threshold. If it is below the threshold (there is light), it does nothing. If it is above the threshold (it is dark), it goes to a series of sequences. First, the LEDs are turned on so the eyes glow. Then it (psuedo) randomly decides to either move the servo or play the sound recording. Finally, it pauses for a random period of time. I thought the unpredictability of the actions would make the sounds feel more "organic", as opposed to having them run regularly.
Step 14: Sensor and Servo Calibrations
I had to experimentally determine the values for my phototransistor, so I knew what to set my threshold at. I simply ran code that would read in values from the A0 pin and print them to serial, then observed how the numbers changed when I covered and uncovered the sensor.
Not all servos use the same pwm duration for control, so check the datasheet. The servo I'm using ranges from 0 degrees at 0.6 ms to 150 degrees at 2.1 ms (hence the ranges in the code). Later on I checked the range of motion in the code, but this isn't terribly useful before you have the box built and can see where it will hit.
Step 15: Make the Enclosure Parts
I designed my enclosure to be laser-cut out of plywood (a .pdf file is attached) and have custom mounts for the circuit board and servo. You could use an existing wooden or cardboard box and carefully cut out eye holes using a scroll saw (or put the LEDs on the outside of the box). If you do use an existing box, make sure to drill a hole for the phototransistor cables and get some scrap wood for making the servo arm.
I also used some hardware to attach various components to the box; nuts and bolts for the servo, nuts, bolts, and washers for the circuit board, and suction cups for eventually hanging the box.
Since this is going under the bed and I want it to blend in to the darkness, I painted the parts of the box a matte black on all sides.
Step 16: Add the Eyes
I decided to have the eyes glow with a diffuse light and used regular printer paper to achieve that effect. I very lightly traced the shape of the eyes onto the paper, then cut out the shapes with a border of ~1/4 inch. I taped the paper cutouts to the interior of the box with masking tape (I didn't want to warp the paper with glue).
Step 17: Partially Glue the Box
I put the electronics in the box while it was somewhat disassembled, so I couldn't glue the entire box together at one time. Instead, I glued together the front, bottom, and right side. The pieces snap together, but the glue keeps it extra secure and makes sure it doesn't fall apart while hanging under the bed. Only use a tiny bit of wood glue so it doesn't leak out the edges. I clamped the parts together while they dried to make sure that everything was aligned.
Step 18: Attach the Switch
Now that the wall is secure, the switch can be soldered to the battery/circuit. I threaded the switch's wires through its opening (keep the switch outside the box) and made sure they were long enough to reach the other wires. The wiper of the switch I connected to the positive lead on the battery case, and the remaining wire I soldered to the power line of the circuit (the one that goes to both the Arduino's Vin pin and the sound module).
The switch I used came with tiny screws that I couldn't find nuts for. Instead, I ended up simply hot gluing the screws to the interior of the box.
At this point I also glued the battery pack to the bottom of the box.
Step 19: Attach the Circuit Board
The box has a shelf to hold the circuit board in place. I used a few washers to fill the gap between the shelf and the breadboard, but they aren't strictly necessary. I glued the shelf to the right side, but pushed on the back (without glue) as well to make sure the shelf was straight.
Step 20: Attach Speaker and LEDs
The speaker fits into the round hole on the front of the box (since the speaker itself is black, it will be hard to actually see it in the dark and I wanted to make sure the sound could be heard). I used tape to hold it in place - ideally I would have made the hole a perfect press-fit, but it didn't seem worth using more wood.
The LEDs I taped roughly in place with masking tape and secured with hot glue. I tried to center them over the flat side of the eyes, so the eyes would glow evenly.
Step 21: Assemble Servo
The servo itself is held in place on a custom-made mount with four bolts.
The arm needs to be securely attached to the servo horn (the round plastic bit that comes with the servo itself). I sanded the surface of the plastic a bit, then used hot glue to secure it. The servo comes with a small screw for attaching the various servo horns that will keep the arm from falling off.
Step 22: Insert Servo Mount
At this point, I spent some time running the code and adjusting the rotational position of the arm on the servo. I wanted to make sure that there was sufficient motion, but that it wouldn't run into the box. The numbers for the servo's position in the code were determined in this way (every servo is slightly different, so make sure to check this - you don't want to assemble your box and find out that it constantly runs into itself).
The servo mount fits into the bottom of the box, and like the shelf for the circuit it doesn't really require glue. I plugged the servo into the circuit board at this point (using the connector I made earlier).
Step 23: Assemble Top
I wanted the box to hang under the bed (rather than sitting on the floor and having to be lifted up) and used suction cups to do so in a non-destructive way (other options would be eyehooks or velcro. You can also try using command hooks, but I didn't think the hooks would work very well when horizontal). The suction cups I'm using have wire hooks, which I bent into more complete loops with heavy-duty pliers. I threaded string through the holes in the top of the box and made loops to hang off the suction cups. The length of the loops depends on the brush you use - you want the brush to be able to scrape against the bottom side of the bed. I made mine adjustable, so I could change the height as I installed the box.
Step 24: Attach Remaining Sides
I attached the left side of the box to the bottom and front with glue.Once the strings were tied on, I pushed the top on (it held very securely with friction, so I didn't use glue)
I didn't glue the back to the rest of the box in case I needed to get to the interior again. If you use a laser cut box like I did, the back should snap into place and be held by friction.
Step 25: Insert Brush
I wanted to make a "scratching" noise using the servo and chose to use a plastic cleaning wand to make that sound. I used heavy-duty wire cutters and cut the brush off the handle (I added a bit of electrical tape over the cut edge to cover the sharp parts). The arm was designed with this brush in mind, so the brush just needs to be pushed into place and it will stay.
Step 26: Install
I used the suction cups to hang the box underneath a shelf in my office, and adjusted the strings so the brush would scrape on the ceiling. I ran the sensor out from under the shelf so it would sense the ambient light.
Step 27: Use!
I uploaded my code earlier when I tested the servo, so my monster is ready to go!