Introduction: Mexican Skull
The aim of this project is design and implement a system using a combination of arduino components with a halloween thematic. In this case, our project bases on a mexican skull, based on the day of the dead.
This decoration mask have two functions: the first one is that when you turn off the lights the LEDs located at the eyes turn on. The second function is that when you bring your hand to the mouth of the skull, a spider appears.
Step 1: Get the Components
ELECTRONIC COMPONENTS:
·Arduino - Open-source electronic prototyping platform enabling users to create interactive electronic objects.
·Breadboard - Construction base for prototyping of electronics. It has been used to connect all the electronic components of the project.
·Servo Motor (SG90) - Servomechanism that has the ability to position itself in any position within its range of operation (180 degrees), and stay stable in this position. It has been used to make appear the spider from de mouth of the skull.
·Two Red LEDs - Semiconductor light source that emits light when current flows through it. In this project the LEDs have simulated the eyes of the skull.
·Ultrasonic Sensor - Sensor that measure distance by using ultrasonic waves. It emits an ultrasonic wave and receives the wave reflected back from the target. Measuring the time between the emission and reception it knows the distance to the target. In this case it has been used to detect if something was getting closer to the mouth of the skull.
·Photoresistor (photocell) - Light-controlled variable resistor. The resistance of a photoresistor decreases with increasing incident light intensity. In this project the photoresistor detects when the light goes out and send a signal to turn on the LEDs.
·Jumpers - Electrical wire, or group of them in a cable, with a connector or pin at each end, which is normally used to interconnect the components of a breadboard without soldering.
·Resistors 220Ω - Passive two-terminal electrical component that implements electrical resistance as a circuit element. Used in this projects with de photoresistor and the LEDs.
MATERIALS:
·Conglomerate wooden board (800x300x4) - To make the box with the drawing of the mexican skull. Nails - Used to create a box from wooden boards.
·Silicone - To paste the spider with the Servo Motor.
·Toy spider - To scare the people when it appears from the mouth of the skull.
·Fake spiderweb - To decorate the box and to give a more halloween look.
Step 2: Mounting the Prototype and the Circuit
1. Choose a mexican skull drawing on the internet and trace it in Autocad or Illustrator (we attach you the .dwg drawing).
2. In the same drawing you can also put the different templates to cut the 6 pieces of wood that will form the box.
3. Take it to a laser cutting machine (it will takes you about 20 minutes).
4. Once you have all the pieces of wood, put together only four faces (the base, the two sides and the face where the skull is). This will allow you to easily place the arduino board and the entire circuit. You can attach the faces with small nails.
5. To assemble the circuit use the arduino protoboard as a base, in this case we have not welded the different components.
6. Firstly, start with the circuit of the two LEDs and the photoresistor. You need a resistance for each LED and another for the photoresistor. Each component connected to a pin (the photoresistor is connected to an analog pin).
7. Secondly, start by assembling the servo motor circuit, this will move the spider. First of all, attach the spider on the servo motor blades with the help of a small platform. Then connect the three motor cables to the corresponding pins (GND, 5V and pin). Once the servo is connected, connect the Ultrasonic Sensor to its four pins.
8. Once you have the circuit assembled, put the LEDs and the Ultrasonic Sensor in the corresponding holes made in the Mexican skull (eyes and chin). The components will not be attach with silicone, they will be placed under pressure in the holes (these holes will be done in autocad / illustrator).
9. Reconnect the external elements to the protoboard by extending the connections with the longest jumpers
10. When you have the arduino elements inside the box, make the holes where the USB cable for the current and the photoresistor will come out. These holes are located on the back side.
11. To finish the prototype, nail the remaining faces, leaving the upper face that serves as a cover.
12. Finally, use our code with the Arduino software and uploaded to the Arduino board.
Attachments
Step 3: Schematic of the Circuit
Step 4: Programming
In order to get the Mexican Skull to be interactive, we must write a code with the Arduino program, and later on it must be uploaded to our Arduino One.
Here is our code for this project:
<p>int ullesq = 9; // the pins the LEDs are attached to (one LED for each eye)<br>int ulldret = 10; int foto = A1; // the pin the photoresistor is attached to const int trigPin = 4; // the pins the Ultrasonic Sensor is attached to const int echoPin = 3; // defines servo motor #include ; // library declaration for the servo motor. Servo myservo; // variable declaration. long duration; //defines variables for the Ultrasonic Sensor int distance; // the setup routine runs once when you press reset: void setup() { pinMode(ullesq, OUTPUT); // Sets the LEDs lights as an output pinMode(ulldret, OUTPUT); pinMode(foto, INPUT); // Sets the photoresistor as an input pinMode(trigPin, OUTPUT); // Sets the trigPin as an output pinMode(echoPin, INPUT); // Sets the echoPin as an Input myservo.attach (7); // hardware definition inside setup with the correct pin. Serial.begin (9600); //starts the serial communication. } // the loop routine runs over and over again forever: void loop() { // set the brightness of pin 9 && 10: int llum; llum = analogRead (A1); Serial.println (llum); if (llum < 10) { // Here the brightness level is indicated. digitalWrite (ullesq, HIGH); // the LEDs of the eyes turn on digitalWrite (ulldret, HIGH); } else { digitalWrite (ullesq, LOW); // the LEDs of the eyes turn off digitalWrite (ulldret, LOW); } //clears the trigPin digitalWrite (trigPin, LOW); delayMicroseconds (10); //sets the trigPin on HIGH state for 10 microseconds digitalWrite (trigPin, HIGH); delayMicroseconds (10); digitalWrite (trigPin, LOW); //Reads the echoPin, returns the sound wave travel time in microseconds. duration = pulseIn (echoPin, HIGH); //Calculating distance (the formula is always the same). distance = duration * 0.034 / 2; // Prints the distance on the Serial Monitor Serial.print("Distance: "); Serial.println(distance); // Here the grades if (distance <= 10) { myservo.write (20); //Servo turns 20º (when it is inside the skull) delay (200); } else{ myservo.write (120); //Servo turns 120º (when it is outside the skull) delay (200); } }</p>
Step 5: Video
Step 6: Final Conclusion
This project has allowed us to design an electronic system by combining electronic components that we had worked in class and with new ones, to be able to experiment with them and learn how it works and how to program them on our own.
Apart from designing a correct circuit with all the connections made in the breadboard, it was necessary to program a code in the arduino to be able to achieve a correct operation from combining all the components The motivation of the project is that the thematic was Halloween. We were able to design a decorative and interactive element, and it was fun being a mexican skull. With this project we realize that in the future we can make fast prototypes with the arduino board.