ScaryBox
Halloween scare for kids!
If any child is able to get under 30 cm from this frightening display...They will be instantaneously scared by a creepy and hairy spider that falls down.
The system is based on an Arduino board. This mechanism works thanks to a stepper motor that allows us to pick up the spider after the falling and on the other hand, a servo motor that helps us to control the hatch through which the spider will fall and then climb back up. In order to ensure that the whole system works correctly, it is essential to program it to determine exactly what and when each component must do its actions and how.
Thanks to these and other components we achieve: Buh!!!!!!!! a huge scare for the youngest of our homes, (and for the not so young :)
Components
This is the list of the parts and tools that are needed in order to carry out this project.
Electronical parts:
Arduino uno
Distance Sensor
Servo motor
Stepper (motor)
Wires
Power bank
Construction parts:
Wooden box
Wooden shelf
Foam board
Nylon hilum
Spider Black
Spray paint
Spider web
White glue
Featherboard
Needles
Tools:
Jigsaw
Sander
Drill
Silicone glue
Scissors
Tape
Flow Diagram
The flow diagram is a tool that has helped us to organize the steps that our system and therefore our code must follow. It clearly shows how our box works. The first factor we come across is the distance sensor. If the answer is YES (there is a person), the hatch opens and the spider falls, whereas if the answer is NO, (there is no person), nothing happens. In the case of the first option, the spider must be collected, the hatch closed, the rope released and then, the program would return to the beginning.
Code
The code we are using to program our halloween system is very simple and easy to understand. First of all we need to download the libraries that will control our components: presence sensor, servo and stepper and add them to the program using the #include command. Then, before setting the setup, we will declare and initialize some variables and functions to make the different components work in the right way. We will extract them from the examples that are given. As we enter on the setup phase we set the stepper speed, the servo port and a tester for the distance sensor.
Inside the loop, we will declare a function that will allow the sensor to measure distances in front of it. Finally we will write an “if” giving an interval of distances on which the program will enter to, in our case, from 0 to 30cm. Once an external object is between that interval, the program will start a sequential chain of actions that will begin with the hatch opening and the fall of the spider in consequence. That operation will be followed by the delay of 5 seconds, the roll up of the cord, the closing of the hatch by activating the servo in the other way and finally, to allow the spider fall again on the next cycle, activate the stepper in the opposite way.
Wiring + Arduino; Tinkercad
Since we know all the components we need to carry out the project, we must find the right way to join all these electrical components in the Arduino. To do so, we have used a system simulation application called Tinkercad, a very useful tool for visualizing the connections between the components and the Arduino board.
In the attached picture it is very clearly seen which are the connections in our Arduino. By parts:
1. The HC-SR04 sensor has 4 connections. One of them is connected to 5V, to the positive input of the protoboard and another one to the ground, the negative input of the protoboard. The other 2 connections are connected to the digital inputs and outputs.
2. The servomotor has 3 connections, the dark brown wire is connected to the negative (ground), the red one to the positive (5V), and the orange one to the number 7, so as to control the servo.
3. The stepper is the component with more connections, and it is composed by two parts; on one hand, the motor itself, and on the other hand a connection board that allows us to connect it with the Arduino. This panel has a 5V output, another ground connection and 4 cables that will go to the stepper control.
Physical Construction: Stepper Mechanism
As you may know, stepper has a little axis on which you can adapt objects with its form to rotate it. The function of our stepper is to bring up the spider with a nylon cable attached to it.
We need a mechanism that can perform the function and we have thought about the headstand, a system commonly used on 4x4 cars to help them advance in difficult situations. To achieve it we are going to cut some wood panels in a circular shape, to help the wire roll up, and glueing them all together to create a pulley-like shape. Then we will make a hole into one of the surfaces to attach the stepper at it.
This mechanism allows the servo to fulfill the objective of lifting the spider to the top so that the Scarybox works perfectly.
Physical Construction: Servo Mechanism
On this project, the servo will perform the function of opening and closing the hatch where the spider will fall through. We will use foam board to attach to the servo instead of the wood panel because of the elevated weight of it. We will connect a metallic wire from the servo’s plastic support to the foam board. Then, the servo motor itself will do the work!
Physical Construction: Box Building
The box will be the base and support of our project. It is the place where we will place all our components. It will help us to have a place to keep the spider and when a person approaches it, it will fall down and scare him. In addition, we can place all the wiring and mounting at the top.
Final Product
Here are the pictures of the Scarybox finished!
Conclusion
Carrying out this project has been fun and rewarding, as we have learned a very useful and powerful tool for our future as industrial design engineers.The Arduino program allows us to prototype and create a large amount of projects in which mechanics and electronics come together to improve and facilitate people's lives.
We hope you enjoy this project as much as we did and that it will be useful for your present and future. If you have any doubt, do not hesitate to contact us, we will be really happy to answer your questions.
Thank you very much from our hearts!
Tierramisu :)