Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
syn
Published © GPL3+

Halloween PIR Proximity Scare Speaker with Lighting Effects

A small compact outdoor motion-activated Halloween scare box with sound and optional light.

BeginnerFull instructions provided5 hours11,104
Halloween PIR Proximity Scare Speaker with Lighting Effects

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
MP3 module
×1
Relay module 4 Channels
×1
PIR Motion Sensor Module Detector HC-SR501
×1
3XAA Battery Snap Holder (optional)
×1
2 Pin Waterproof Electrical Aviation Plug Socket Connector
×3
Water tight Food Container Box (190mm x 60mm x 120mm)
×1
Black Spray paint
×1
32mm Wood Drill Bit
×1
16mm Wood Drill Bit
×1
USB drive (FAT32 formatted)
×1

Story

Read more

Schematics

Wiring diagram

Please note that this variant only has one battery pack, I later added a second independent supply for the audio as it was drawing to much current and shutting down the Arduino

inside (test version)

rear (test version)

speak and PIR (test version)

PIR glued in place and speaker bolted with plastic screws

Sound File - voices and scream

Laughing Ghost Variant (audio and code)

this one is just a voice box with no lighting effects. 6 different laughs played when people pass by

Final build - 1

Sound File - Graveyard Audio

Code

Halloween PIR proximity activated speak and light

Arduino
//Assign pins
int pirSENSOR = 2;      //SENSOR to detect motion, set to maximum sensitivity and range
int previousBUTTON = 3; //button on MP3 module
int playBUTTON = 4;     //button on MP3 module
int whiteLED = 5;       //Whiteflashing light
int redLED = 6;         //Blood sequnce light during screem
int statusLED = 10;


void setup() {
 pinMode(pirSENSOR,INPUT);
 pinMode(previousBUTTON,OUTPUT);
 pinMode(playBUTTON,OUTPUT);
 pinMode(whiteLED,OUTPUT);
 pinMode(redLED,OUTPUT);
 pinMode(statusLED,OUTPUT);
 digitalWrite(previousBUTTON,HIGH); //set initial state, in my case Relay HIGH is OFF/OPEN
 digitalWrite(playBUTTON,HIGH);     //set initial state, in my case Relay HIGH is OFF/OPEN
 digitalWrite(whiteLED,HIGH);       //set initial state, in my case Relay HIGH is OFF/OPEN
 digitalWrite(redLED,HIGH);         //set initial state, in my case Relay HIGH is OFF/OPEN
}

void loop() {
//Play Sound
  if (digitalRead(pirSENSOR) == HIGH) {    //HIGH on my PIR sensor mean positive detection of movement
    digitalWrite(previousBUTTON,LOW);      //PRESS previous button which plays sound from begining
    delay(100);
    digitalWrite(previousBUTTON,HIGH);     //release previous button
    delay(100);

//LED Flash sequence
    //grab attention
    digitalWrite(whiteLED,LOW);
    delay(1000);
    digitalWrite(whiteLED,HIGH);
    delay(500);
    digitalWrite(whiteLED,LOW);
    delay(500);
    digitalWrite(whiteLED,HIGH);
    delay(9000);

    //I See you
    digitalWrite(whiteLED,LOW);
    delay(500);
    digitalWrite(whiteLED,HIGH);
    delay(100);
    digitalWrite(whiteLED,LOW);
    delay(500);
    digitalWrite(whiteLED,HIGH);
    delay(300);
    digitalWrite(whiteLED,LOW);
    delay(500);
    digitalWrite(whiteLED,HIGH);
    delay(300);
    digitalWrite(whiteLED,LOW);
    delay(300);
    digitalWrite(whiteLED,HIGH);
    delay(300);
    digitalWrite(whiteLED,LOW);
    delay(300);
    digitalWrite(whiteLED,HIGH);
    delay(300);
    digitalWrite(whiteLED,LOW);
    delay(300);
    digitalWrite(whiteLED,HIGH);
    delay(300);
    digitalWrite(whiteLED,LOW);
    delay(300);
    digitalWrite(whiteLED,HIGH);
    delay(6000);

 //children sounds
    digitalWrite(whiteLED,LOW);
    delay(300);
    digitalWrite(whiteLED,HIGH);
    delay(1000);
    digitalWrite(whiteLED,LOW);
    delay(100);
    digitalWrite(whiteLED,HIGH);
    delay(300);
    digitalWrite(whiteLED,LOW);
    delay(100);
    digitalWrite(whiteLED,HIGH);
    delay(300);
    digitalWrite(whiteLED,LOW);
    delay(100);
    digitalWrite(whiteLED,HIGH);
    delay(300);
    digitalWrite(whiteLED,LOW);
    delay(100);
    digitalWrite(whiteLED,HIGH);
    delay(1000); 
    digitalWrite(whiteLED,LOW);
    delay(600);
    digitalWrite(whiteLED,HIGH);
    delay(1400);
    digitalWrite(whiteLED,LOW);
    delay(100);
    digitalWrite(whiteLED,HIGH);
    delay(7000);

 //scream/blood sequence
    digitalWrite(redLED,LOW);
    delay(3000);
    digitalWrite(redLED,HIGH);
    delay(100);  
    
 //Stop Sound   
    digitalWrite(playBUTTON,LOW);          //pause/stop the sound playback
    delay(100);
    digitalWrite(playBUTTON,HIGH);         //release play button
    delay(60000);                          //wait 1minute before allowing to reactive
  }
  
  else {
    digitalWrite(statusLED,HIGH);          //If PIR detects nothing, maintain status light on to draw small amount of power as some USB batteries will deactivate
  }

}

Credits

syn

syn

1 project • 4 followers

Comments