OK, I said I would get back and here we go.
I plan on having a "haunted graveyard" this year.
What I want to do is this:
1. My grave yard is out with devices etc. with ambient sounds
2. as the kids walk down my sidewalk I have a beam sensor for them to trip
3. a loud scream happens and a zombie pops up for a few seconds then resets
4. GhoSteps walk from the zombie, with moans, to a gate and pause
5. the gate opens with a long creeeeek
6. GhoSteps walk through and the gate closes
Here is how I did it (just cut n paste to Arduino): {the ASCII art will show in the Arduino program}
PIC_0159.JPG..PIC_0124.JPG..PIC_0071.JPG
More pictures are comming soon.
http://www.youtube.com/watch?v=qTW4ZioAaO8
/*
2011 Project - By Sparkey
Control of a Halloween Graveyard Display through an Arduino with an Eight Relay card.
------------------------------------------------
------------------------------------------------
Parts List:
01. Arduino Duemilanove
02. Arduino Sensor Shield v4.0 - yourduino.com - p/n AS-010200
03. 8-Relay Board, optio-isolated - yourduino.com - p/n EA040402
04. Wires for pins on shield & relay card - yourduino.com - p/n CW-044020
05. Beam Sensor - Velleman Kit MK120 - http://store.qkits.com/moreinfo.cfm/MK120
06. Magnecraft W117SIP-6; 5 VDC SPST N.O. DIP REED RELAY - http://www.allelectronics.com - p/n CAT# RLY-541
07. LM7805CT; Standard Voltage Regulator 5 Volt - http://www.jameco.com - Part no. 786138
Note: the beam sensor activates a 9VDC buzzer, you will not use this. The reed relay and voltage regulator are inexpensive so
I used the voltage regulator to bring the 9V down to 5V, because that is what the reed relay is rated for, and used the relay
to act as a DRY CONTACT, aka switch thinking I could copy the DEBOUNCE sketch, for a binary input which will activate the Arduino.
08. 20k Ohm resistor
09. Ghostly Footprints - http://www.halloweenforum.com/hallow...ootprints.html
10. 2 Pneumatic solenoid valves - http://www.frightprops.com/pneumatic...0927-0001.html
11. 2 Pneumatic actuators - http://www.frightprops.com
12. 300 second USB recording module - http://www.electronics123.com/ - Product # USB5M
13. Air compressor - mine is an old 26 gallon unit
------------------------------------------------
Recommended software:
01. Audacity - Used to edit your sounds. - http://audacity.sourceforge.net/
Audacity® is free, open source software for recording and editing sounds.
02. CDEX - Used to change MP3 to WAV, and back, format for your sounds. - http://cdexos.sourceforge.net/
CDex - Open Source Digital Audio CD Extractor
------------------------------------------------
Notes on my setup............................................. .....
AUDIO FILES-1,2,3,4
300 second USB sound card has 4 push buttons to activate 4 individual sounds, so a CLOSED relay would = on
I soldered in lenghts of wire, keeping the buttons for testing, to go to the various relays for activation.
This card also has multiple programable functions like auto-repeat so I setup #1 to replay on its own.
1= AMBIENT NIGHT SOUNDS = KG-background-02.wav, I made with Audacity
2= Crypt_laugh.wav, from the www
3= CorpseMoan.wav, from the www
4= GATE OPENING/CLOSING = KG-Gate07.wav, I made with Audacity
---------------
AIR VLV-1,2
I am using two 24VAC solonoid valves which will activate two pneumatic props, so a CLOSED relay would
allow a POWER ON condition, solonoid activation, and air to flow which runs the two pneumatic actuators.
Prop-1 = zombie popper
Prop-2 = haunted gate
---------------
Prop-3 = GhoSteps, 9VDC series of lights, needs an on, so a CLOSED relay would = on
The Ghost Steps card runs 16 steps and has some timer/programming features, like delay, which I have used so
one must match the event timing to what you choose to program the card to do.
------------------------------------------------
NOTES ON SETTING UP THE HARDWARE.......................................... ...
Place the Arduino Sensor Shield on the Arduino Duemilanove.
Run wires from the RELAY CARD to the SHIELD CARD as follows, WIRE COLORS ARE WHAT I USED TO KEEP THINGS STRAIGHT.
RELAY WIRE SHIELD DIGITAL I/O
GND --> BLACK --> 0G
IN1 --> BROWN --> 1S
IN2 --> YELLOW --> 2S
IN3 --> ORANGE --> 3S
IN4 --> RED --> 4S
IN5 --> PURPLE --> 5S
IN6 --> GREY --> 6S
IN7 --> BLUE --> 7S
IN8 --> GREEN --> 8S
VCC --> WHITE --> 0S
SETTING UP THE REED RELAY...................................Diode protected, voltage/polarity matters..........
If you are asking why use relay when I can get power from LM7805, ANSWER = CIRCUIT ISOLATION.
RELAY HAS 4 PINS: NUMBERS (Left to Right looking at name/data) = 1, 3, 5, 7 .... 3 = +volts, 5 = GND, 1 & 7 = NO Switch
LM7805CT HAS 3 LEGS (Left to Rightfs) = 1, 2, 3 .... 1 = INPUT VOLTAGE, 2 = GND, 3 = OUTPUT VOLTAGE
IR BEAM SENSOR BUZZER VOLTAGE = 9VDC
route the IR-9V -to-> LM7805CT LEG-1 and the IR-GND -to-> LM7805CT LEG-2
route the LM7805CT LEG-2 -to-> RELAY PIN-5 and LM7805CT LEG-3 -to-> RELAY PIN-3
YES, LEG-2, The GND is shared between INPUT and OUTPUT
ASCII DIAGRAM ..........start diagram......................
+-------* \*----------+ NO (Normally Open)
| | Reed Relay has diode with
| +---diode--+ | coil for protection
| | | |
1 3(+) 5(-) 7
+----------------------------------+
| |
+---------+------------+ |
| D9 | |
| | |
| ARDUINO | +--[20k]------+----(TO RELAY P7)
| 5V G | |
+---------+---+--------+ |
| | |
| +----------------+
|
+---------------------------------------(TO RELAY P1)
+--------------+ LM7805 IN = 9VDC and G --FROM-- IR sensor buzzer
| LM7805 | LM7805 OUT = G and 5VDC --TO-- relay pins 3 & 5
| L1 L2 L3 |
+--------------+
| | |
| | |
9V G 5V
ASCII DIAGRAM ..........end diagram......................
Magnecraft REED RELAY pins 1 & 7 are Normally Open. Solder wires on these two pins, with a 20k resistor on pin 7, and run them as
you would for the BUTTON sketch.
RELAY PIN-1: IN gets controlled power from SHIELD 5V PIN.
RELAY PIN-3: IN gets relay operational power circuit from LM7805CT LEG-3
RELAY PIN-5: OUT gets GROUND for relay operational power circuit from LM7805CT LEG-2
RELAY PIN-7: OUT sends 5VDC to 10K RESISTOR and SHIELD PIN-8 (ON INPUT SIDE OF RESISTOR) then to SHIELD GND (on output side of resistor)
*/
//======================================= START __ SETUP ==========================================
// Relay outputs are "active LOW"
const int RELAY_ON = LOW;
const int RELAY_OFF = HIGH;
// Define numbers for the relays
const int AMBIENT_SOUND = 1; // RELAY-1 = Audio 1 = AMBIENT NIGHT SOUNDS = KG-background-02.wav
const int Crypt_Laugh = 2; // RELAY-2 = Audio 2 = Crypt_Laugh.wav
const int ZOMBIE = 3; // RELAY-3 = Air valve 1 for Prop-1 = zombie popper
const int CorpseMoan = 4; // RELAY-4 = Audio 3 = CorpseMoan.wav
const int GATE_SOUND = 5; // RELAY-5 = Audio 4 = GATE OPENING/CLOSING = KG-Gate07.wav
const int GhoSteps = 6; // RELAY-6 = GhoSteps
const int GATE_MOVES = 7; // RELAY-7 = Air valve 2 for Prop-2 = Haunted Gate
const int NOT_USED = 8; // RELAY-8 = NOT USED AS YET
int Beam_Sensor = 9; // The input pin (for beam sensor) YOUR INPUT ON PIN 9
int Beam_Sensor_val = 0; // Variable for reading the pin status VARIABLE HOLDS DATA
int ledPin = 13; // Turn the board LED ON to let me know if the sensor (ON) input gets to the Arduino
void setup()
{
pinMode(AMBIENT_SOUND, OUTPUT); // RELAY-1 = Audio 1 AMBIENT NIGHT SOUNDS = KG-background-02.wav
pinMode(Crypt_Laugh, OUTPUT); // RELAY-2 = Audio 2 Crypt_Laugh
pinMode(ZOMBIE, OUTPUT); // RELAY-3 = Zombie Popper Prop
pinMode(CorpseMoan, OUTPUT); // RELAY-4 = Audio 3 moan
pinMode(GATE_SOUND, OUTPUT); // RELAY-5 = Audio 4 gate sounds
pinMode(GhoSteps, OUTPUT); // RELAY-6 = GhoSteps Prop: times; 00-10sec, pause 10-15sec, 15-26sec (for Sparkey)
pinMode(GATE_MOVES, OUTPUT); // RELAY-7 = Haunted Gate Prop
pinMode(NOT_USED, OUTPUT); // RELAY-8 = NOT USED AS YET
// START UP- turn everything off but the background sounds
digitalWrite(AMBIENT_SOUND, RELAY_ON); // RELAY-1 = AMBIENT NIGHT SOUNDS = KG-background-02.wav
digitalWrite(Crypt_Laugh, RELAY_OFF); // RELAY-2 = Audio 2 Crypt_Laugh
digitalWrite(ZOMBIE, RELAY_OFF); // RELAY-3 = Zombie Popper Prop
digitalWrite(CorpseMoan, RELAY_OFF); // RELAY-4 = Audio 3 moan
digitalWrite(GATE_SOUND, RELAY_OFF); // RELAY-5 = Audio 4 gate sounds
digitalWrite(GhoSteps, RELAY_OFF); // RELAY-6 = GhoSteps Prop: times; 00-10sec, pause 10-15sec, 15-26sec
digitalWrite(GATE_MOVES, RELAY_OFF); // RELAY-7 = Haunted Gate Prop
digitalWrite(NOT_USED, RELAY_OFF); // RELAY-8 = NOT USED AS YET
delay(500); // insert delay for sound switch to recognise change of state for Relay-1
digitalWrite(AMBIENT_SOUND, RELAY_OFF); // RELAY-1 = AMBIENT NIGHT SOUNDS = KG-background-02.wav
pinMode(Beam_Sensor, INPUT); // declare beam sensor as input
pinMode(ledPin, OUTPUT); // declare LED Pin-13 as output to let me know if the sensor input gets to the Arduino
}
//======================================= START __ SEQUENCE ==========================================
void loop()
{
// is someone setting off the trap?
//if kids walking down my sidewalk go between mailbox and graveyard sign they will activate the beam sensor
Beam_Sensor_val = digitalRead(Beam_Sensor); // read input value 5VDC==ON==HIGH OVDC==OFF==LOW
if (Beam_Sensor_val == HIGH) // if the input is HIGH (IR BEAM TRIPPED == 5VDC ON PIN-9)
{
//ACT-1 ZOMBIE ATTACK AND SOUND
// The sensor has been activated.... MOO-HA-HA laughed the evil cow
digitalWrite(ledPin, HIGH); // turn LED ON to let me know if the sensor ON input gets to the Arduino
digitalWrite(Crypt_Laugh, RELAY_ON); // RELAY-2 give loud scream
digitalWrite(ZOMBIE, RELAY_ON); // RELAY-3 popup the zombie
delay(500); // delay for sound switch to recognise change of state for relay 2
digitalWrite(Crypt_Laugh, RELAY_OFF); // turn RELAY-2 off for next go-round
delay(5000); // keep the zombie up for 5 seconds
// by keeping relay on, voltage is maintaned to solonoid valve which maintains air to actuator
digitalWrite(ZOMBIE, RELAY_OFF); // turn off air valve to reset zombie for next go-round
// auto air bleed will let zombie slowly drop back down by its own weight
delay(5000); // spacer, pause for effect, 5 seconds allows me to figure out SOE .Sequence Of Events.
//ACT-2 GHOST MOANS, WALKS THROUGH GRAVEYARD AND SOUND OF GATE OPENING
digitalWrite(CorpseMoan, RELAY_ON); // RELAY-4 need loud moan to go with start of GHOST WALKING prop
delay(500); // delay for sound switch to recognise change of state for relays
digitalWrite(GhoSteps, RELAY_ON); // RELAY-6 ....steps 1-8 = ~ 10 seconds....
delay(500); // delay for ghost steps switch to recognise change of state for relays
digitalWrite(GhoSteps, RELAY_OFF); // turn RELAY-6 off for next go-round
delay(500); // delay for ghost steps switch to recognise change of state for relays
digitalWrite(CorpseMoan, RELAY_OFF); // turn RELAY-4 off for next go-round
delay(2000); // delay to allow CorpseMoan sound to finish
delay(8000); // spacer, pause for 10 seconds, time it takes for first 8 of 16 steps to happen
// Ghost has by now walked to the gate, GhoSteps PROP will pause for 5-6 seconds automatically (prop programable)
digitalWrite(GATE_SOUND, RELAY_ON); // RELAY-5 action=sound of gate opening
// It appears that the ghost is opening gate via sound above
delay(500); // delay for sound card to recognise change of state
digitalWrite(GATE_SOUND, RELAY_OFF); // RELAY-5
//ACT-3 GHOST WALKS THROUGH GATE AND SOUNDS OF GATE CLOSING
digitalWrite(GATE_MOVES, RELAY_ON); // RELAY-7 action=prop gate swings OPEN slowly
delay(6000); // keep prop-2 active for 6 seconds
// delay for 6 seconds = time it takes for GHOST STEPS PAUSE between steps 8/9 to complete
digitalWrite(GATE_MOVES, RELAY_OFF); // RELAY-7 action=prop gate swings CLOSED slowly
// auto air bleed will let gate slowly close by return spring action
// Ghost now automatically takes last steps, 9-16, which is another ~10 seconds
delay(2000); // pause for gate movement
digitalWrite(GATE_SOUND, RELAY_ON); // RELAY-5 action=sound of gate closing as GHOST walks through
delay(500); // pause for sound card to recognise change of state
digitalWrite(GATE_SOUND, RELAY_OFF); // turn RELAY-5 off for next go-round
delay(10000); // spacer, pause for 10 seconds, time it takes for last 8 of 16 steps to happen
// Give ghost time to finish last 8 steps
delay(5000); // spacer, pause for effect, 5 seconds allows me to figure out SOE .Sequence Of Events.
digitalWrite(AMBIENT_SOUND, RELAY_ON); // RELAY-1 = AMBIENT NIGHT SOUNDS = KG-background-02.wav
delay(500); // delay for sound switch to recognise change of state
digitalWrite(AMBIENT_SOUND, RELAY_OFF); // turn RELAY-1 off for next go-round
Beam_Sensor_val = LOW;
}
else
{
// PAUSE FOR EFFECT, don't allow system to activate too fast after last run, kids may be running around the area now.
delay(600); // PAUSE FOR EFFECT spacer, pause for 60000 = 60 seconds
digitalWrite(ledPin, LOW); // Turn the board LED OFF to let me know if the sensor (OFF) input gets to the Arduino
}
}
//*********( THE END )***********
/*
NOTE TO ME,
Want to add a constantly dimming set of eyes while the above program runs, need to learn PWM on pin 10?
try this later when the rest of the stuff is working
int fade_eye = 0;
int ledpin = 5;
void setup ()
{
}
void loop ()
{
for(fade_eye = 0; value <= 255; fade_eye+=5)
{
analogWrite(ledpin, fade_eye);
delay(60);
}
for(fade_eye = 255; value >=0; fade_eye-=5)
{
analogWrite(ledpin, fade_eye);
delay(60);
}
}
*/


Reply With Quote
Bookmarks