Halloween Forum banner
1 - 20 of 79 Posts

·
Registered
Joined
·
49 Posts
Discussion Starter · #1 ·
Hello, I'm a novice to this kind of thing, but willing to learn.
I have just completed building an 8 relay banger (Octo Banger) built using instructions from Button Banger.com web site. I have never used Electronics like this, it's opened my eyes and the potential from this 5v 8 relay module is limitless (almost) I have set the relays to High, therefore at rest the relays are NC, this will allow ambient lighting to be illuminated, then when the relay fires the light disconnects and the prop will be energised with a different coloured lamp, (this will give it more of a WOW factor) Anyway. The issue I have and can't get my head round is this..............
I have programmed the Arduino using Mike's Octo Banger programme, (Nice and simple to use)
At the moment my set up is running and doing this......................
Ambient music runs, relays trigger in sequence but only when the PIR is activated and the scare MP3 runs, when the scare MP3 runs the ambient sound stops, Once the scare and relays stop activating the Ambient starts at the beginning again. then the Arduino waits for the PIR to trigger the sequence again.
What I want to do. and need help with is..................
I would like to keep the Ambient music, but loose the Scare Mp3. (not an option in the set up)
Set the 8 Relays with a programmed sequence without a separate trigger, and have it all work on a loop.
Any ideas on achieving this?
I have no idea how to write code either using the Arduino write code programme. Its a foreign language to me.
I am driving my wife round the bend trying different set ups.
Please help'''''''''.......''''''''
 

·
Registered
Joined
·
303 Posts
If you want ambient music and a relay sequence that is not triggered, you probably don't need the octobanger except to time out the sequences (easier for a newbie since it has sliders you can move).

It would be a simple to write a program in a loop with the sequence you desire. The ambient sound could run separately on a mp3 player or cd player in a loop if it doesn't need to be run at a certain time.

I could write a code for you, but I won't be able to until I get back from vacation next week. If you have an idea of what you want to happen, send it to me in pseudo code, ie.

1) all relays off.
2) relay 1 on for 10 seconds.
3) relay 1 off.
4) relay 2 on for 3 seconds.
5) relay 2 off.
6) relay 3&4 on for 12 seconds.
etc....
 

·
Registered
Joined
·
49 Posts
Discussion Starter · #3 ·
Good Morning, Many thanks for your offer and reply, Sorry for the delay in replying, It's 07:00 here in the UK, Just peeled my eyes open, and the first thing I did was to check for any replies, that's how much this unit is doing my head in. Ha Ha.
I have been building Pneumatic Props since last years display, this year it will be in aid of Charity. I will have to check each prop and time them to make sure the relays operate for the correct length of time. (last thing I want is my Coffin to begin opening, and my skeleton to begin rising then just not get to the end of sequence) that's why I went for the Octo banger, the timing was adjustable. Trial and error principle. And if my wife changed her mind (like they do) in which prop would activate and in what order, I just moved the sliders on the programme accordingly. Ho Hum..................
Because the Arduino is using the A2 socket to operate the serial MP3 player (5v and ground) with it's integral SD Card could this be switched on as soon as the board is powered up? Then have the relays operate after a 15second boot time delay for instance?
So far I have the Arduino wired to the Serial MP3 player with built in SD Card then through a 50w amplifier then to a speaker.
Cheers Mark.
Cheers.Mark
 

·
Registered
Joined
·
49 Posts
Discussion Starter · #5 ·
These style of relays are how I first started, it meant I would need to turn on each prop in a timely manor. Then I found the Octo Banger which offered me everything. just Too much. All I wanted to do was loose they scare and keep everything on a loop. I even contacted some companies for Electronics/Computers here in the UK regarding this. They weren't interested. Just thought I was mad. Are we???????????? Why is Halloween a strange hobby? others celebrate Xmas. Boring.......everyone is doing that.
I got the Jawdunio functioning, from Banger.com, just need to install it into a Skull next. :)
 

·
Registered
Joined
·
303 Posts
Once i write the code i can tell you where to change the timing, it's easy. Then you can change and test, change and test until you get it the way you want.
I am not sure about the sound, will have to look into it when i get back home.
 

·
Registered
Joined
·
303 Posts
if you want to give it a go on your own, here is a place that gives you a background about the relays and some sample code.
http://arduino-info.wikispaces.com/ArduinoPower#4-8

The code for the 4 relay unit would be good as a starter, load it on your arduino and hook up the relay board. The leds on the relay board should turn on off in the programmed sequence. you will find that all you have to do is add the 4 other relays, then manipulate the delay to what you need.
 

·
Registered
Joined
·
49 Posts
Discussion Starter · #8 ·
Many Thanks for all your help.
Its lovely to have someone taking the time out of there busy life for others.
I will give it a go, just not sure when. I'm pulling 12Hr shifts at work at the moment, It's a long day in a hot commercial workshop. I have ordered the 4 relay shield that fits directly on top of the Uno (well looks like it does on the picture anyway) so hopefully that will save time in construction. Ha Ha,
I must remember to load the firmware first before assembly, :-[
Watch this space.....................It maybe empty for a long time.........................or Nicki (the wife) will be posting my last will & testament fingers crossed all goes well. Have a lovely Holiday / Vacation.
 

·
Registered
Joined
·
49 Posts
Discussion Starter · #9 ·
Many Thanks for all your help.
Its lovely to have someone taking the time out of there busy life for others.
I will give it a go, just not sure when. I'm pulling 12Hr shifts at work at the moment, It's a long day in a hot commercial workshop. I have ordered the 4 relay shield that fits directly on top of the Uno (well looks like it does on the picture anyway) so hopefully that will save time in construction. Ha Ha,
I must remember to load the firmware first before assembly, :-[
Watch this space.....................It maybe empty for a long time.........................or Nicki (the wife) will be posting my last will & testament fingers crossed all goes well. Have a lovely Holiday / Vacation.
 

·
Registered
Joined
·
49 Posts
Discussion Starter · #10 ·
Oh dear, you have done it now.......the link you supplied is a good one,
some of the links on the page don't work but I motor reverse relay set up they discus would be good for my riser which has a my take on a linear motor set up. Basically a 1m 10mm threaded bar rotated by a 24v DC Motor. The wife's witch is attached to the threaded bar. The bar turns, the witch goes up or down depending on the rotation. The Arduino would make switching rotation of the DC motor more user friendly especially with a PIR for switching.
The mind boggles....
Now I'm getting ahead of myself, time to draw back and get the basics under control.
 

·
Registered
Joined
·
49 Posts
Discussion Starter · #11 ·
tried some code. FAILED. just keep getting: for example.
exit status 1
'Relay_1' was not declared in this scope
Gonna go and read a French Novel, I may understand it better. Ha Ha.
 

·
Somewhat Eccentric
Joined
·
2,394 Posts
I've downloaded the octobanger files but I'm still trying to wrap my head around the fourbanger project. In the fourbanger files there is a file named Sounds and within that file are 3 mp3 files, one which is silence. I don't see that folder in the octobanger files though. You could download the fourbanger files, get the silence mp3 and set it as your scare track. You could keep the ambient file that way. As far as looping it, that's way out of my league. :eek:

Also do you have a link to the 5v 8-relay module you used? I'm thinking of going ahead and getting the parts for an octobanger while I have a little extra cash.
 

·
Registered
Joined
·
303 Posts
Did you copy/paste it from the website I linked? I just did and it compiled with no errors.
Make sure it was copied correctly. If Relay_1 was not declared, most likely the #define Relay_1 was not copied correctly. Did the '#' symbol copy correctly?
Everything should look like this:

/* YourDuino Example: Relay Control 1.10
Handles "Relay is active-low" to assure
no relay activation from reset until
application is ready.
[email protected] */

/*-----( Import needed libraries )-----*/
/*-----( Declare Constants )-----*/
#define RELAY_ON 0
#define RELAY_OFF 1
/*-----( Declare objects )-----*/
/*-----( Declare Variables )-----*/
#define Relay_1 2 // Arduino Digital I/O pin number
#define Relay_2 3
#define Relay_3 4
#define Relay_4 5

void setup() /****** SETUP: RUNS ONCE ******/
{
//-------( Initialize Pins so relays are inactive at reset)----
digitalWrite(Relay_1, RELAY_OFF);
digitalWrite(Relay_2, RELAY_OFF);
digitalWrite(Relay_3, RELAY_OFF);
digitalWrite(Relay_4, RELAY_OFF);

//---( THEN set pins as outputs )----
pinMode(Relay_1, OUTPUT);
pinMode(Relay_2, OUTPUT);
pinMode(Relay_3, OUTPUT);
pinMode(Relay_4, OUTPUT);
delay(4000); //Check that all relays are inactive at Reset

}//--(end setup )---


void loop() /****** LOOP: RUNS CONSTANTLY ******/
{
//---( Turn all 4 relays ON in sequence)---
digitalWrite(Relay_1, RELAY_ON);// set the Relay ON
delay(1000); // wait for a second
digitalWrite(Relay_2, RELAY_ON);// set the Relay ON
delay(1000); // wait for a second
digitalWrite(Relay_3, RELAY_ON);// set the Relay ON
delay(1000); // wait for a second
digitalWrite(Relay_4, RELAY_ON);// set the Relay ON
delay(4000); // wait see all relays ON

//---( Turn all 4 relays OFF in sequence)---
digitalWrite(Relay_1, RELAY_OFF);// set the Relay OFF
delay(1000); // wait for a second
digitalWrite(Relay_2, RELAY_OFF);// set the Relay OFF
delay(1000); // wait for a second
digitalWrite(Relay_3, RELAY_OFF);// set the Relay OFF
delay(1000); // wait for a second
digitalWrite(Relay_4, RELAY_OFF);// set the Relay OFF
delay(4000); // wait see all relays OFF


}//--(end main loop )---

//*********( THE END )***********
 

·
Registered
Joined
·
49 Posts
Discussion Starter · #14 ·
Here is the link I used for the 8 relay shield. I bought two of them. 1 to break and 1 to use. I did the same with the Arduino Uno boards. Bought more than one at a cheap price. fried one and learn't the hard way. then used the others. I found it cheaper and a learning curve doing it this way, rather than buying an expensive prop controller.

http://www.ebay.co.uk/itm/8-Channel...e=STRK:MEBIDX:IT&_trksid=p2057872.m2749.l2649
 

·
Registered
Joined
·
49 Posts
Discussion Starter · #15 ·
I have even copied you pasted copy, pasted it into the Arduino sketch software/programme clicked on the Verify Button at the top left screen and received this:

Arduino: 1.8.3 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Users\Mark\Documents\Arduino\sketch_jul26a\sketch_jul26a.ino: In function 'void setup()':

sketch_jul26a:60: error: redefinition of 'void setup()'

void setup() {

^

C:\Users\Mark\Documents\Arduino\sketch_jul26a\sketch_jul26a.ino:18:7: note: 'void setup()' previously defined here

void setup()/****** SETUP: RUNS ONCE ******/

^

C:\Users\Mark\Documents\Arduino\sketch_jul26a\sketch_jul26a.ino: In function 'void loop()':

sketch_jul26a:65: error: redefinition of 'void loop()'

void loop() {

^

C:\Users\Mark\Documents\Arduino\sketch_jul26a\sketch_jul26a.ino:36:7: note: 'void loop()' previously defined here

void loop()/****** LOOP: RUNS CONSTANTLY ******/

^

exit status 1
redefinition of 'void setup()'

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I said reading a French Novel would make more sense. Doh!!!: mad:
 

·
Registered
Joined
·
49 Posts
Discussion Starter · #16 ·
I CAN READ FRENCH !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
having persevered..............I copied the code and it was accepted. up loaded it to my board. WORKING!!
Then I copied and pasted each line and changed the relay numbers up all the way to 8
Found the first 4 Relays quicker than the 4-8 relays, then noticed 1-4 were 1000 and 4-8 were 4000, changed all to 1000, now they all work the same.
I'm chuffed about that bit.
must save the file then start playing around. how would I add a command to start up a MP3 card to run continuously?
 

·
Somewhat Eccentric
Joined
·
2,394 Posts
Here is the link I used for the 8 relay shield. I bought two of them. 1 to break and 1 to use. I did the same with the Arduino Uno boards. Bought more than one at a cheap price. fried one and learn't the hard way. then used the others. I found it cheaper and a learning curve doing it this way, rather than buying an expensive prop controller.

http://www.ebay.co.uk/itm/8-Channel...e=STRK:MEBIDX:IT&_trksid=p2057872.m2749.l2649
Thanks! I bought a few of the unos last year and so far haven't fried one yet. Glad you got your controller working the way you wanted. :D
 

·
Registered
Joined
·
303 Posts
I CAN READ FRENCH !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
having persevered..............I copied the code and it was accepted. up loaded it to my board. WORKING!!
Then I copied and pasted each line and changed the relay numbers up all the way to 8
Found the first 4 Relays quicker than the 4-8 relays, then noticed 1-4 were 1000 and 4-8 were 4000, changed all to 1000, now they all work the same.
So now you know how to change the timing, it is in milliseconds, meaning 1000ms = 1 second. When you want to change the timing, this is what you would change.

I am sure you can figure out how to turn the relays on and off as needed.

I will work on the mp3 player part.
There is an example online from github for the YX5300 player, i'll just need to modify the code so it will just play the one song in a loop. The problem is, you can start the mp3 playing, then do all the relay switching, but when the sequence is over, it will start from the beginning, and the mp3 will start from the beginning also. It would be easier if you made the relay sequence the same length as the music you are using.
 

·
Registered
Joined
·
303 Posts
Oh dear, you have done it now.......the link you supplied is a good one,
some of the links on the page don't work but I motor reverse relay set up they discus would be good for my riser which has a my take on a linear motor set up. Basically a 1m 10mm threaded bar rotated by a 24v DC Motor. The wife's witch is attached to the threaded bar. The bar turns, the witch goes up or down depending on the rotation. The Arduino would make switching rotation of the DC motor more user friendly especially with a PIR for switching.
For the clockwise/counterclockwise rotation, you would be using the relays, not the PIR. I thought you said you didn't want the PIR.

If you wire the relay 1 and relay 2 as shown, then it is a matter of turning on relay 1 for CW:

digitalWrite(Relay_1, RELAY_ON);

run for a certain amount of time:

delay(2000);

then turning it off:

digitalWrite(Relay_1, RELAY_OFF);

Then turn on relay 2 for CCW:

digitalWrite(Relay_2, RELAY_ON);

run for a certain amount of time:

delay(4000);

then turning it off:

digitalWrite(Relay_2, RELAY_OFF);
 

·
Registered
Joined
·
49 Posts
Discussion Starter · #20 ·
Ah missing abit here. I have more than one prop build on the go. The reverse polarity is for my riser,The PIR would operate the function of my riser. the 8 Banger is to operate all of the props. Would I be right thinking, 600,000 would be a minute?
 
1 - 20 of 79 Posts
Top