Introduction: HAUNTED HOUSE With Arduino
Would you dare to enter a haunted house as horrible and mysterious as this one?
In this project we have designed an enchanted house with the Arduino UNO that interacts with users. Depending on the movements that the user does the house will perform one action or another.
- Turn on the lights of the house when turning the sign.
- Open and close the door when ringing the bell of the house and turning the hall’s light on.
- Wake up the lord of the house when touching his tomb and make the curtains move. If the actions take up during night terrorific lights will be opened.
Step 1: Materials Used in This Project
Arduino UNO (x1)
Resistors 220 Ω (x9)
Resistors 10 kΩ (x4)
LED RGB (x1)
Micro Servomotor (x1)
Motor CC (x1)
Transistor NPN (BJT) (x1)
Push Button (x2)
Micro SDcard Wires
Components of the house:
Cardboard to build the main structure of the house and other detail such as the door
Moss paper to recreate the ground
Scrapbook paper to simulate wood
Fan blade to move the curtain
Halloween details such as spiders, cobweb, and so on
Fabric to make the curtains and ghosts
Wooden depressors to make the fence
Stapler for fixing some cables
Soldering iron Ruler
Insulating tape for covering the cables once they are soldered so that there is no contact between them
Step 2: Schematic of Electrical Connections
Action 1: Turn on the lights of the house when turning the sign.
To perform the action used three LEDs, which represent the lights of the house, and a potentiometer to turn them on gradually. To make sure the potentiometer is coherent with the house and the context of Halloween we simulated the house entry sign.
Action 2: Open and close the door when ringing the bell of the house and turning the hall’s light on.
In that case, the idea is that when somebody rings the entry bell this one sounds while opening and closing the door of the house. This movement simulates ghosts and enchantments. At the same time. the same button, turns on the hall light of the house. The ring consists of a Push Button connected to the pin 2 of the Arduino board making the DFPlayer sound, the light of the hall a white LED and the door opens due to a Servo Motor.
Action 3: Wake up the lord of the house when touching his tomb and make the curtains move.
If the actions take up during night terrorific lights will be opened. Finally if you touch the tomb located on the garden, that in reality is a Push Button, will activate a motor CC connected to a fan, making the curtains of the house move and fly while playing a terrorific laugh played by the DFPlayer. When this happens, if the house is located in a dark room, will make a LED RGB blink with an orange hue. To achieve that we used a photosensor.
Step 3: Flow Diagram
Step 4: Guide: ACTION 1
- Place the three white LEDs to the protoboard.
- Connect them to the pins 3, 4, 5. (Remember that the LED lights have a positive and negative leg. To make sure they work connect the positive and longest legs to the pins).
- Connect the negative and short legs of the LEDs to the ground.
- Remember to put resistances of 220Ω so the LEDs do not burn.
- Declare the necessary variables with the int function, to name the pins that will be used in the code.
- In the setup() we indicate the pins chosen to send information or outputs.
- In the loop() we declare a variable (“lecturaPotenciometer”) to read the potentiometer. Afterwards we declare a new variable (“brillo”) to transform all the collected data of the potentiometer to values so the LED lights can turn on. Finally with this same variable, (“brillo”), we can open the LEDs depending on the potentiometer.
Step 5: Guide: ACTION 2
- We place the ServoMotor and connect it to pin 13, 5V and the ground.
- On the other hand place one PushButton in pull-down connected to pin 2.
- Also place one white LED connected to the ground and pin A2.
- Remember to put one resistance of 220Ω connected to the ground and the LED
- Declare the variables needed for the LED, the PushButton and for the ServoMotor.
- It is very important to remember that for use of the ServoMotor we have to add the library (#include ).
- In the setup() we connect the ServoMotor to pin 13, indicating that the pin used for the LED sends information (OUTPUT) while the pin connected with the Push Button receives information (INPUT).
- In the loop() we read the state of the PushButton. If this one has a HIGH state, when is pressed, the board will read and execute the code inside the if. So, because we want to turn on the LED and the motor to work, we write inside the key that the LED has a HIGH state and the motor turns 180º three times with three for. If the Push Button is not pressed, else, the ServoMotor and the LED will not be on (servo_13.write(0) and digitalWrite(ledPinA2,LOW)).
- In the case of the DFPlayer first we have to include two libraries; “SoftwareSerial.h” and “DFRobotDFPlayerMini.h”. Then, we use pins 7 and 12 (TX and RX ) of the arduino to communicate with DFPlayer. Inside the setup(), we have to initialize the serial ports for debugging and DFPlayer, and specify the amount of volume we want (0-30).Finally, in the loop() with the function player.platMp3Folder(1) we put the MP3 sound that we want, in this case the door sound that it is in the first place. It is important to mention that inside the SDcard it is created a folder named Mp3 and inside it we rename the files such as 0001.mp3, 0002.mp3. Order is important!
Step 6: Guide: ACTION 3
- We connect the LED RGB to the pins 9, 10, 11 and to the ground. We recommend that the color of the wires used correspond to the colors of every leg of the RGB LED to avoid confusions.
- Afterwards we connect the photoresistor to the A0 pin and to the ground.
- Connect the motorCC to the 6 pin using one diode and one transistor NPN.
- Finally we put the Push Button pull-down connected to the pin 8.
- As mentioned before, it is important to remember to put resistances. In that case we use 220Ω and 10kΩ.
- Declare the variables needed for the RGB LED, for the photosensor, for the Push Button and for the MotorCC.
- In the setup() we indicate that the pins used for the LED and the motor send information (OUTPUT) while the pin connected to the Push Button receives information (INPUT).
- In the loop() we read the state of the Push Button. If it has a HIGH state when pressed, the board will read and execute the code inside of the if. So if we want the motor to turn when pressing the button, we have to write with two fors to achieve the movement that we want. Inside the first for we add to the Arduino to read the fotosensor, so incase of a lot of light, the LED RGB will not open (if) and if not it will open with the colors declared with the three analogWrite() (else).
- To include the scary laugh sound first we have to include two libraries; “SoftwareSerial.h” and “DFRobotDFPlayerMini.h”. Then, we use pins 7 and 12 (TX and RX ) of the arduino to communicate with DFPlayer. Inside the setup(), we have to initialize the serial ports for debugging and DFPlayer, and specify the amount of volume we want (0-30).Finally, in the loop() with the function player.platMp3Folder(2) we put the MP3 sound that we want, in this case the is the one that is in the order 2. It is important to mention that inside the SDcard it is created a folder named Mp3 and inside it we rename the files such as 0001.mp3, 0002.mp3. Order is important!
Step 7: Guide: FINAL
When we have all the assemblies and codes ready it is time to join them in the same Arduino board and code. Make sure you have not repeated any pin.
Step 8: Guide: CONSTRUCTION OF THE HOUSE
- Cut all the cardboard with the needed measurements to create the main structure of the three houses. We recommend cutting out some windows, so that the light of the LEDs can be seen.
- Stick all parts with glue and wait until everything is dry to continue. Make sure the unions are resistant enough to be able to work with the structure.
- With paint, scrapbook decorative papers and cardboards decorate the houses. In our case, we used different methods for every house.
- Afterwards add all the details. For instance, the door, the ghosts, some spiders, the grass or the curtains.
- When the main structure is finished we can start adding the electronic part.
- We install all the LED lighting and the MotorCC with the fan behind the respective windows.
- Find the best position for the photosensor to receive the ambient light and add it there.
- The PushButtons, the DFPlayer and the potentiometer are hidden with the decorations of the house, to make sure the mock-up looks more realistic.
- Finally weld all the connections to avoid them from separating.
Step 9: FINAL ASSEMBLY, CODE AND HOUSE
Step 10: Conclusion
As it is shown in the project we have been able to apply all the knowledge learned about Arduino and coding. All this theoretical knowledge has become a physical mock-up, we have been able to touch and experiment with electrical components such as LEDs, resistances, photoresistors, potentiometers or motors.
This fact makes us realize that only working with simulating Arduino websites, like Tinkercad, is not enough, because what you can create with a computer can be easier than reality. For instance, when we create an assembly with Arduino and physical components, there are a lot of external factors that can make the code or the assembly done before with Tinkercad not work. So it is important to be aware of this, and make up your mind to change these errors.
From this experience we conclude that even if you do a lot of prototipes with tools like Tinkercad, or 3D modelling programs, at the end what will tell us what works or if the system is functional will be the physical mock-up. This one helps us to understand shapes, structures, assemblies, etc, and lets you interact with the project.
Finally we would like to add that programming is one of the most useful tools nowadays and it is present in our lives everyday. So at the engineering and design level it is fundamental to have basic knowledge to adapt to new situations, changes, problems or necessities.
READY TO LIVE THIS EXPERIENCE?
Made by: Muna, Cristina & Maria
Participated in the