I watched on YouTube how to make a 16 channel light controller for Christmas. I have built a 24 channel controller with the same criteria. I also downloaded a program called vixen which supposed to work with my setup (according to the gentleman who did the video)
. My arduino seems to operate correctly but I can't get the relays to open and close to turn on and off the lights. Does anyone have suggestions? (By the way I am new at this.)
Forgot to mention it is a mega2560 rev 3
No one can comment unless you give us information on the schematic and code.
Jason_McDonough:
I watched on YouTube how to make a 16 channel light controller for Christmas. I have built a 24 channel controller with the same criteria. I also downloaded a program called vixen which supposed to work with my setup (according to the gentleman who did the video)
. My arduino seems to operate correctly but I can't get the relays to open and close to turn on and off the lights. Does anyone have suggestions? (By the way I am new at this.)
here is the program I used
#define MEGA_VIXEN
//#define UNO_VIXEN
#ifdef MEGA_VIXEN
#define MAX_CHANNELS 24
int channels[MAX_CHANNELS] = {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,46,47,48,49,50,51,52,53};
#endif
#ifdef UNO_VIXEN
#define MAX_CHANNELS 18
int channels[MAX_CHANNELS] = {2,3,4,5,6,7,8,9,10,11,12,13,A0,A1,A2,A3,A4,A5};
#endif
int incomingByte[MAX_CHANNELS];
void setup()
{
int i;
Serial.begin(9600); // set up Serial at 9600 bps
for ( i = 0; i < MAX_CHANNELS; i ++ ) pinMode(channels*, OUTPUT);*
}
void loop()
{
int i;
if (Serial.available() >= MAX_CHANNELS)
{
for (i=0; i < MAX_CHANNELS; i ++) incomingByte = Serial.read();
}
for (i = 0; i < MAX_CHANNELS; i ++ ) analogWrite(channels_, incomingByte*);
}*_
here is the schematic (kind of)
Are you trying to switch relays with PWM?
Relays do not turn ON and OFF at such rates. Every time they do switch, heat is generated to where too fast for too long will kill the relay but at ON and OFF every 2 milliseconds (PWM speed) the relay should just about buzz.
With DC power you can fast-switch using power MOSFETs.
What kind of lights are these?
I am using standard christmas lights. I have a 5 amp power transmitter daisy chained to the relays.
Okay, you should turn the relays ON/OFF with digital pin digitalWrite() and not PWM analogWrite().
PWM is pulse width modification. It is not a true analog signal, it is full-ON and full-OFF 500 times a second with the ratio of time ON to OFF varying 0 to 255 out of 255.
Your code should ensure that the relay does not cycle ON-OFF more than a few times a second.
If the lights are primitive enough you can run them on DC power that you can switch ON/OFF with a power transistor (MOSFET, the logic level type for Arduino use, get help shopping and they will be cheaper than relays) as fast as you want (PWM fast, can act as a dimmer). I spent $10 one day and got 60 IRLZ44N's capable of switching 14A up to 60VDC. That was on ebay after a LOT of making sure I could use them. I think that to buy just 1 was 80 cents and 3-4 weeks waiting so for $10 I won't run out of these any time soon and yes, shipping was free either way.
Oh just FYI, there are cheap led strips that run on 12V and have a red led, a green led, a blue led, repeat 20 times for 60 leds. They have 1 ground wire and 1 wire each for all the reds, all the greens, all the blues and need 2 or 3 amps of 12V when all the leds are on. Those are what I bought the MOSFETs for and a nice little 30W 12V supply. Those strips are like 4M long, the leds are not so close together.
I used 3 FETs to make it work and then I found twice as expensive 1 meter long WS2812 addressable led strips that just put what I had to shame. Of course they take ground, 5V power and 5V signal so don't need the FETs!
Those old Christmas lights... haven't used them since we had to get up to change the TV channel.
GoForSmoke:
Those old Christmas lights... haven't used them since we had to get up to change the TV channel.
Perhaps of more importance is the mute button!
You mean turn the set off or turn the volume all the way down but not click it off? Had to be done with dials on the set.
There was no mute button until TV remotes appeared.
My family didn't get color TV until 1968.
Ah yes, volume controls with an ON/ OFF switch ...
Electronics were not cheap in those days, to put it mildly.
In 1987 I remember being told about team efforts, "the man with the money in the FETs, sweats" over the price and static vulnerbility of MOSFETs then.
There are several places in your code where you do not handle the arrays properly. When using an array, in almost all instances you need to specify the element of the array that you are working with. As an example, in setup() the following line will not work as intended:
for ( i = 0; i < MAX_CHANNELS; i ++ ) pinMode(channels, OUTPUT);
It should be written as follows, using the variable i as the index of the array:
for ( i = 0; i < MAX_CHANNELS; i ++ ) pinMode(channels[i], OUTPUT);