Monster Under the Bed

by Beaconsfield in Living > Pranks, Tricks, & Humor

24338 Views, 234 Favorites, 0 Comments

Monster Under the Bed

forBlair.jpg
IMG_4282.JPG
IMG_5147.JPG

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.

Materials:

The Circuit

circuitschematic.jpg
circuitlayout.jpg
IMG_3724.JPG

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.

Controlling the Sound Player

IMG_4101.JPG

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).

Solder the Components

IMG_3728.JPG
IMG_3729.JPG
IMG_3734.JPG
IMG_3740.JPG
IMG_3742.JPG
IMG_3750.JPG
IMG_3757.JPG
IMG_3763.JPG
IMG_3767.JPG
IMG_3774.JPG
IMG_3778.JPG
IMG_3787.JPG
IMG_3789.JPG
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.

Create the +5V and GND Rails

IMG_3791.JPG
IMG_3793.JPG
IMG_3797.JPG
IMG_3803.JPG
IMG_3807.JPG
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.

Solder Off-board Wires

IMG_3809.JPG
IMG_3812.JPG
IMG_3815.JPG
IMG_3829.JPG
IMG_3839.JPG
IMG_3845.JPG
IMG_3853.JPG
There are a lot of wires that go to various off-board components. Try to solder them in locations that will make it easy to arrange the components in the box later. I ended up with:
  • 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
Color-coordination was extremely helpful here - keep all GND wires black, power wires red, etc. to make future steps easier.

(I ended up adding some of these wires later on, which is why they aren't in the photos)

Attach Sensor and LEDs

IMG_3855.JPG
IMG_3856.JPG
IMG_3859.JPG
IMG_3861.JPG
IMG_3862.JPG
IMG_3864.JPG
IMG_3866.JPG
IMG_3868.JPG
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. 

Record Scary Noises

IMG_4109.JPG
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)
http://www.youtube.com/watch?v=vrCwaJYNO_o
http://www.youtube.com/watch?v=IbTfeNeSf7Q
https://www.youtube.com/watch?v=2kwFYsZ4PH4

Hack the Sound Recorder (removing the Button)

IMG_4103.JPG
IMG_4105.JPG
IMG_3673.JPG
IMG_3683.JPG
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. 

Hack the Sound Recorder (soldering)

IMG_3687.JPG
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). 

Hack the Sound Recorder (power)

IMG_4090.JPG
IMG_4092.JPG
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.

Make Connectors

IMG_3883_labels.jpg
I decided to make some connectors to plug in to the Arduino (rather than using the bare stripped wires).

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. 

Add Wires to the Switch

IMG_3910.JPG
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. 

Arduino Code

arduino_logo.jpg
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. 

Downloads

Sensor and Servo Calibrations

IMG_4095.JPG
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. 

Make the Enclosure Parts

IMG_3915.JPG
IMG_3931.JPG
IMG_3942.JPG
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.

Add the Eyes

IMG_3946.JPG
IMG_3949.JPG
IMG_3952.JPG
IMG_3953.JPG
IMG_3965.JPG
IMG_3974.JPG
IMG_3976.JPG
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). 

Partially Glue the Box

IMG_3977.JPG
IMG_3984.JPG
IMG_3988.JPG
IMG_3989.JPG
IMG_3993.JPG
IMG_3998.JPG
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. 

Attach the Switch

IMG_4034.JPG
IMG_4038.JPG
IMG_4042.JPG
IMG_4044.JPG
IMG_4048.JPG
IMG_4050.JPG
IMG_4056.JPG
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.

Attach the Circuit Board

IMG_4002.JPG
IMG_4006.JPG
IMG_4009.JPG
IMG_4017.JPG
IMG_4057.JPG
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.

Attach Speaker and LEDs

IMG_4062.JPG
IMG_4084.JPG
IMG_4085.JPG
IMG_4088.JPG
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.

Assemble Servo

IMG_4067.JPG
IMG_4070.JPG
IMG_4071.JPG
IMG_4076.JPG
IMG_4079.JPG
IMG_4082.JPG
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. 

Insert Servo Mount

IMG_4096.JPG
IMG_4097.JPG
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). 

Assemble Top

IMG_4111.JPG
IMG_4116.JPG
IMG_4115.JPG
IMG_4121.JPG
IMG_4126.JPG
IMG_4128.JPG
IMG_4130.JPG
IMG_4131.JPG
IMG_4134.JPG
IMG_4135.JPG
IMG_4137.JPG
IMG_4138.JPG
IMG_4141.JPG
IMG_4143.JPG
IMG_4145.JPG
IMG_4146.JPG
IMG_4150.JPG
IMG_4154.JPG
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.

Attach Remaining Sides

IMG_4251.JPG
IMG_4253.JPG
IMG_4258.JPG
IMG_4259.JPG
IMG_4265.JPG
IMG_4272.JPG
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. 

Insert Brush

IMG_4274.JPG
IMG_4277.JPG
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.

Install

IMG_4287.JPG
IMG_4292.JPG
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.

Use!

IMG_4282.JPG
IMG_4292.JPG
IMG_4297.JPG
IMG_5147.JPG
I uploaded my code earlier when I tested the servo, so my monster is ready to go!