Introduction: Nightmare Room
Halloween is coming. Just realized that I have so many horror books. Yes, I love R.L. Stine so much. Being left by my wife and kids at weekend, I dream of these Nightmare Room series keep falling from the shelf. Are these books really haunted? Or is it the room?
Well, it is time to start a new project. I enjoy making the video using this simple Arduino setup.
Step 1: Materials
- Arduino Uno or compatible.
- 7.4 lipo battery.
- Two 9g Servos.
- HC-SR04 Ultrasonic Sensor.
- Mini breadboard.
- Some jumper wires.
- Adhesive tape/glue gun.
- A piece of plywood (optional).
- Two pieces of #105 binder clips (15 mm wide, optional).
Don't forget to order take away Chinese noodles before you start this project. Well, we need about 4" of a chopstick ^_^
Step 2: Wiring Ultrasonic Sensor
Step 3: Servos
This is how I setup the servos. I call it the lower servo and the upper servo.
- Follow the position of image #1 to #6.
- Pick appropriate servos' horns.
- You can stick the lower servo's horn to upper servo's body by using adhesive tape or hot glue.
- Picture #1, #2 and #3 are about positioning the lower servo.
- Picture #4, #5 and #6 are about positioning the upper servo.
- Use binder clips or hot glue to clip the chopstick on upper servo's horn as in picture #7 and #8 below.
Step 4: Wiring the Servos
Refer to image and jumper wires' colors. Read these table per row.
Lower Servo | Upper Servo | Arduino | Power + | Power - | Color |
---|---|---|---|---|---|
Brown(Gnd) | Breadboard - | Grey | |||
Red(Vcc) | Breadboard + | Blue | |||
Orange(Signal) | D5 | Yellow | |||
Brown(Gnd) | Breadboard - | Purple | |||
Red(Vcc) | Breadboard + | Green | |||
Orange(Signal) | D6 | Orange | |||
Vin | Breadboard + | Red | |||
Gnd | Breadboard - | Black |
Last thing to do is connect Breadboard + to Battery + and connect Breadboard - to Battery -
Step 5: Servos Stand
Mark the lower servo's base on a piece of plywood and cut a hole for the servo to sit in. Before doing this, measure where you want the servos sit on your shelf. You can simply stick the servos to the shelf with hot glue without using plywood. This project is temporary and hot glue is easily removed.
Step 6: Code
Upload this sketch to your Arduino :
/* * Chienline @2017 * Halloween Book Dropper * When an object is detected at certain distance, Servos drop a book. */ #include <Servo.h> Servo lServo5; // Lower Servo Servo uServo6; // Upper Servo //defines pins numbers const int trigPin = 9; const int echoPin = 10; const int ultraVccPin = 11; const int ultraGndPin = 12; // defines variables long duration; int distance; int readyForAction; void setup() { pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output pinMode(echoPin, INPUT); // Sets the echoPin as an Input pinMode(ultraVccPin, OUTPUT); pinMode(ultraGndPin, OUTPUT); digitalWrite(ultraVccPin, HIGH); // Sets 5V pin to power HC-SR04 digitalWrite(ultraGndPin, LOW); // Sets GND pin to power HC-SR04 lServo5.attach(5); uServo6.attach(6); standbyPosition(); int readyForAction = 1; //Serial.begin(9600); // Starts the serial communication } void loop() { // Clears the trigPin digitalWrite(trigPin, LOW); delayMicroseconds(2); // Sets the trigPin on HIGH state for 10 micro seconds digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); // Reads the echoPin, returns the sound wave travel time in microseconds duration = pulseIn(echoPin, HIGH); // Calculating the distance into centimeter distance= duration*0.034/2; //if distance <= 300 cm then drop the book; if (distance <= 300){ //Serial.println("Object Detected!"); dropTheBook(); delay(400); //delay 0.4 second before get back to standbyPosition; standbyPosition(); delay(300000); //delay 5 minutes before next ultrasonic detecting; readyForAction = 1; } // Prints the distance on the Serial Monitor //Serial.print("Distance: "); //Serial.println(distance); //delay(500); } void dropTheBook(){ lServo5.write(179); delay(100); uServo6.write(15); readyForAction = 0; } void standbyPosition(){ uServo6.write(90); lServo5.write(90); }
Step 7: Set Up the Shelf
- Give room to your gadget by moving the books forward, next to the edge of the shelf. This is crucial not only giving room to your gadget but also to make sure the book fall down and not only moved out from the line.
- Place your gadget behind the book. Make sure the base sit well. Put something heavy on the plywood. Then test the servos's horns on their pushing position.
- Put your books back on the shelf and pick one to be dropped. Of course you need to pick a light one ;)
Why we need two servos when we can do it with only one? Well, yes you are right. The upper servo with chopstick can do the drop. My idea using the lower servo is to hide the upper servo. When the book is dropped at the first time, the target will pick it up and put it back on the shelf without any suspicios. The upper servo will be hidden to the side and will not be seen. After 5 minutes delay, the ultrasonic sensor will start working again. This second drop will do the trick. It is terrifying. Target has put the book back and make sure it sits well on the shelf, then how can it fall again?
Step 8: Finishing

Participated in the
Halloween Contest 2017
8 Comments
6 years ago
That is awesome. This kind of prop would be perfect for an escape room.
Reply 6 years ago
In edit mode everything looks good. In live mode image sets are shifted to the next steps -.-"
Maybe due to add/remove step on composing. Still working on it and wait for instructables pages to update.
Does gif plays on full preview or editing live preview? Mine is resized to 600x400 still not working.
Reply 6 years ago
That is weird. If it keeps messing up, you should contact service. service@instructables.com
Reply 6 years ago
I used to upload all images and arrange them into steps at writing an instructable. I remember I had created, moved and deleted a step. In all-steps view mode everything was good, but in writing mode I didn't notice if the photo colleges were at the wrong steps they should be.
The faster workout for me is moving all the photos into the pages (steps) by writing their links directly into the code rather than rewrite the whole steps :D
Reply 6 years ago
I usually just add images to the individual steps as I write them. But do whatever works for you.
Reply 6 years ago
Yes. Picking the right book will double the fear.
I added a gif in step 3 but it is not working. Maybe the size is too large. And also the images on step 3 and step 4 are switched. I will fix it soon.
6 years ago
wow!!! its epic :D
Reply 6 years ago
Thank you ^^