Halloween Project

by rogersauquet in Circuits > Arduino

107 Views, 1 Favorites, 0 Comments

Halloween Project

FKLYKIOKVGOE7GH.jpeg
IMG-1160.jpg

Our Halloween Project is based in an horror theme grave. The candles have some fade effect, and the eyes of the skull are brighter as near as you are frome the grave.

Supplies

IMG-1144.jpg
IMG-1151.jpg
IMG-1152.jpg
IMG-1153.jpg
IMG-1147.jpg
IMG-1148.jpg
IMG-1149.jpg
IMG-1150.jpg
IMG-1143.jpg

List of the supplies needed:

  • Led's (x6)
  • Resistors (x6)
  • Distance sensor
  • Arduino uno
  • Cables
  • DM wood
  • Candles (x4)
  • Plastic Skull
  • Welder
  • Glue


Make Holes in the Candles and the Skull

IMG-1155.jpg
IMG-1154.jpg

With a 6mm diameter make some holes through the candles and the eyes of the skull.

Cut a DM Wood With the Grave .dwg File

IMG-1125.jpg
CAD_Halloween.PNG

For this step we would need the assist of a Laser cutting machine.

Make Some Holes in the Upper Side of the Grave

IMG-1156.jpg

Hole the upper side of the grave with the same diameter, the cables will go from the candles to the inside of it.

Glue the Down and the Lateral Sides of the Grave Box

The upper side won't be glued, then we can modify or visualize the inside.

Arduino Code and Protoboard Preparing

IMG-1121.jpg
KICAD_Halloween.PNG

//ArduinoSkullProject                                   02/11/21


//by   Roger Sauquet/ Gerard Cabezas/ Javier Fernandez

// Tutored by Carles Flotats


//Materias:

// - 4 LEDS

// - Arduino one

// - Electric cables

// - 3 Resistors

// - Protoboard

// - HCSR04 sensor

// - Perforated plate for welding

// - Skull (plastic)

// - 4 Candles

// - If you want to create a support you will need wood or cardboard pieces


// HOW TO ASSEMBLE IT?


// As we can see in the code we use specific inputs for each cable that will make the led work, so if we do not connect the cables correctly to the ports, the led will not perform the programmed function.

// The LEDs that we will use for eyes should be connected to ports 9 and 10. On the other hand, those of the candles will be connected to 11, 6 and 3.

// WARNING: You have to be careful and put the resistors correctly, otherwise the LEDs may stop working.

// Once the cables are correctly connected to the ports and the resistors are installed, it is time to place them in the desired place; load the program and start it.


// WHAT DOES THE PROGRAM DO ??


// This program made for Halloween, performs three simultaneous fades in the candles that work constantly, however the three fades are different (only two candles have it the same)

// In turn, the proximity sensor that is programmed to start detecting from 50 cm, when noticing something in its range, starts its cycle that and the closer we get to the tombstone, the brighter it will shine.


//CODE:

 

#include <HCSR04.h>


byte triggerPin = 5;

byte echoPin = A0;

int ojo1 = 9; // the PWM pin the LED is attached to, right eye

int ojo2 = 10; // the PWM pin the LED is attached to, left eye

int brightness = 0;  // how bright the LED is when the eyes start

int brightness2 = 100; // how bright the LED is in two candles when start

int brightness3 = 120; // how bright the LED is in two candles when start

int brightness4 = 80; // how bright the LED is in two candles when start

int fadeAmount1 = 10;

int fadeAmount2 = 7;

int fadeAmount3 = 4;

int vela1 = 3; // the PWM pin the LED is attached to for two candles

int vela2 = 6; // the PWM pin the LED is attached to for two candles

int vela3 = 11; // the PWM pin the LED is attached to for two candles



void setup () { // the setup routine runs once when you press reset:


 Serial.begin(9600);  // initialize serial communication at 9600 bits per second:


 HCSR04.begin(triggerPin, echoPin);

  pinMode(9, OUTPUT);  // initialize digital pin LED_BUILTIN as an output fir the right eye


 pinMode(10, OUTPUT); // initialize digital pin LED_BUILTIN as an output for the leftt eye


  pinMode(11, OUTPUT); // initialize digital pin LED_BUILTIN as an output for two candles


 pinMode(6, OUTPUT); // initialize digital pin LED_BUILTIN as an output for two candles


 pinMode(3, OUTPUT); // initialize digital pin LED_BUILTIN as an output for two candles


}


void loop () { // the loop routine runs over and over again forever:


  analogWrite(vela1, brightness2);  // set initial the brightness of the first pair of candles


 analogWrite(vela2, brightness3);  // set the initial brightness of the second pair of candles


 analogWrite(vela3, brightness4);  // set the initial brightness of the third pair of candles



  brightness2 = brightness2 + fadeAmount1;  // change the brightness of the first pair of candles for next time through the loop:


  brightness3 = brightness3 - fadeAmount2;  // change the brightness of the second pair of candles for next time through the loop:


  brightness4 = brightness4 - fadeAmount3;  // change the brightness of the third pair of candles for next time through the loop:



 // reverse the direction of the fading at the ends of the fade for first pair of candles

 if (brightness2 <= 0 || brightness2 >= 255) {

  fadeAmount1 = -fadeAmount1;

  

 }

  // reverse the direction of the fading at the ends of the fade for second pair of candles

  if (brightness3 <= 0 || brightness3 >= 255) {

  fadeAmount2 = + fadeAmount2;

   

  }

   // reverse the direction of the fading at the ends of the fade for third pair of candles

  if (brightness4 <= 0 || brightness4 >= 255) {

  fadeAmount3 = + fadeAmount3;

   

  }

 // wait for 30 milliseconds to see the dimming effect

 delay(30);

  

  

  

  

  

  

  

  

 double* distances = HCSR04.measureDistanceCm();

  

 Serial.print("1: ");  // print out the value you read:


 Serial.print(distances[0]); // print out the value you read:


 Serial.println(" cm"); // print out the value you read in cm. Used to make a dimension on our leds turning on


  

 Serial.println("---"); // print out the value you read:


 delay(10);   // delay in between reads for stability



 if (distances[0] >= 2 && distances[0] <= 50) {

   

 int brightnessOjo = map(distances[0], 50, 0, 0, 150);

 analogWrite(9, brightnessOjo);  // set the brightness of pin 9:


 analogWrite(10, brightnessOjo);  // set the brightness of pin 10:


 } else {

   digitalWrite(9,LOW);  //turn the LED 9 off

      digitalWrite(10,LOW); //turn the LED 10 off


   }


}

Weld the Cables and the Components

IMG-1158.jpg

Recreate the scheme with welded cables, to apply the circuit into the prototype.

Insert the Circuit Inside the Box

IMG-1159.jpg

The led's cables must go through the candles, also in the inside of the skull, then they pass through the upper side of the grave holes.

The End

IMG-1162.jpg

There you go! The halloween project is completed!