PDA

View Full Version : Need a controller that is not expensive



Sparkey
08-13-2011, 08:50 PM
Help.
I've been looking at logic controls for Halloween as I'm in a pinch, and are they expensive. Can anyone help me build something that won't cost an arm and a leg?

I need a control board of simple design that I could build.
The board needs to control 4 different events via a NO/NC type relay.
#1 - a trigger event, happens as soon as you push a button or activate a trip/sensor switch.
and will remain on for a variable amount of time (something like 5sec to 5min).
#2 - happens for X amount of time after 1 is complete, where X is variable (something like 5sec to 5min).
#3 - happens for Y amount of time after 2 is complete, where Y is variable (something like 5sec to 5min).
#4 - happens for Z amount of time after 3 is complete, where Z is variable (something like 5sec to 5min).
and finally the unit must not start itself untill after event #4 has completed.

{--------------------------------total lenghth of operation-----------------------}
{+++----------------------------start event------------------------------------} - = off + = on
{----++++++++++++++++#2 on ------------------------------------------------}
{--------------------------++++++++++++++++#3 on --------------------------}
{------------------------------------------------+++++++++++++#4 on -------T}unit can now re-trigger

I'm thinking the relay coil voltage should be somewhere between 3-12VDC.
And the controlled side should be able to handle up to 1amp.

Thanks in advance for looking,
Sparkey

n1ist
08-14-2011, 05:50 PM
That shouldn't be hard to do, either with some 555 timers or a micro. I'd guess it will cost $15 to $20 depending on how fancy you want to go.

Here's a quick schematic for one based on an Atmel micro.
/mike

bnradams
08-14-2011, 06:11 PM
Try an Arduino or other development board, they can be had on eBay for about $20. I know the Arduino is an easy one to start with (learning curve wise) and can drive a small relay directly off an output pin.

oldcqr
08-14-2011, 07:19 PM
I'm no Micro Controller expert, but I wonder if the TI one I posted about (http://doityourselfchristmas.com/forums/showthread.php?15604-TI-MSP430-Launchpad-USB-Micro-controller-Development-Kit-4.30) could work...

Sparkey
08-16-2011, 10:03 PM
Thanks for the input everyone. As I'm in a very big hurry I've decided to try the Arduino Duemilanove Micro controller for several reasons: 1. it's cheap, 2. it's powerful, 3. it's very flexible (you program it just about like BASIC and I'll be able to use it for other controls) 4. I've found a ton of support sites (Like this: http://arduino-info.wikispaces.com/ArduinoPower) and 5. there are a lot of ready made interfaces if you don't want to make your own. (IE http://yourduino.com/). For less than $45 I got a complete kit (14 DIGITAL I/O 6 are PWM capable, and 6 ANALOG I/O) and an 8 relay control center. So wish me luck and I'll post back when I get parts and run some tests.
Thanks again.
Sparkey

dmcole
08-17-2011, 05:25 PM
... you program it just about like BASIC ...

Not to be a downer, but I've programmed in BASIC and I written code for the Arduino, and they are entirely different.

The language is simple, but is based on C, not BASIC.

Where I found solace is that the implementation of C in the Arduino IDE is remarkably similar to how PHP is implemented ... and I've written more PHP code than I care to think about.

YMMV.

\dmc

chilloutdocdoc
08-18-2011, 01:50 PM
Arduino actually closer resembles C++ and it's Object Orientated nature than C. My robotics team IEEE bot was based on Arduino. It is an amazingly powerful Microcontroller when you put it through the the paces. There are a TON of code examples out there, and you can definitely post if you need help with code, many people here are well versed in coding for Microcontrollers.

Josh

dmcole
08-18-2011, 06:27 PM
Arduino actually closer resembles C++ and it's Object Orientated nature than C.

My confusion stems from my thorough lack of knowledge of the differences between C and C++ ...

My remark about it not being like BASIC remains.

\dmc

rb1980
09-30-2011, 08:06 PM
@Sparkey: Hi, i'm looking to do something very similar to what you originally posted (using OTS hardware).
Did you ever complete the project? If so can you share some details including sketches?

Sparkey
10-12-2011, 08:05 AM
I have completed a working prototype. Look for details and pictures in the next week or so. Just like you I'm a bit rushed getting ready at the moment.

Sparkey
10-24-2011, 11:07 PM
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}
11976..11977..11978
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/halloween-props/77243-ghostly-footprints.html
10. 2 Pneumatic solenoid valves - http://www.frightprops.com/pneumatics/solenoid-valves/3-way-solenoid-valves/3-way-valve-with-1-4-inch-orifices-open-exhaust-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);
}
}

*/

dirknerkle
10-24-2011, 11:40 PM
Fantastic work! And an incredible gem of a posting, too. Wonderfully creative and fun. Well done!!!

Greg in Canby
10-25-2011, 02:18 AM
Nice job for sure!

I hacked a similar kit (IR barrier) last year to trigger VIXEN - it worked every time, not a single detection failure.

TerryKing
10-26-2011, 03:26 AM
Sparkey, Fantastic work on so many different parts. And I loved the video. Can't wait for the Final Outdoor Cut!

Maybe you can have a little card handout "How Does this Work??" for kids and adults, that points to the video and your post, etc.. This is the kind of thing that makes kids believe that electronics and microcomputers and software are really worth learning about.

When I went from my own Parts Scrounging desires to starting YourDuino.com to do something like Parts Scrounging For All, this is the kind of thing I hoped would happen, where one person's work would encourage others and involve young people.

I'll feature this and a couple of other amazing projects in this month's newsletter. Anyone who'd like to get the newsletter can sign up at https://arduino-direct.com/sunshop/index.php?l=account (You don't have to be a customer or buy anything!) Or just email terry@yourduino.com to get on the list.

The Arduino Mega with 48 Digital I/Os (16 can be PWM for dimming) would be great for more-complex displays.

This is a great site and I will be reading and learning a lot!

Sparkey
12-18-2011, 11:25 AM
Greetings all.
Now that I have all of my Christmas lights up and running (in sync to music with my own radio station) I've had time to post more videos, from Halloween, on my YOUTUBE site (today 12.18.11) should you want to see the system in action.
Merry CHRISTmas to all.


Here is the 1st video test
http://www.youtube.com/watch?v=qTW4ZioAaO8
Halloween - day shot
http://www.youtube.com/watch?v=zbrY7IYXiiw
Halloween - night shot
http://www.youtube.com/watch?v=yiHiXCORJlM

corytcline
12-18-2011, 02:02 PM
.............. Halloween - 4 Singing 3-Axis Skulls http://www.youtube.com/watch?v=-8Lj1bvH-Zc

This site never stops amazing me could you send me a pm about this skull setup I am amazed and have to give this a go for my halloween setup.