PDA

View Full Version : Mega 2560 and Vixen 2.1 SSR relays flicker when vixen runs



thecanadiandaily
10-25-2017, 06:11 PM
ok, so with my Mega 2560 and Vixen 2.1 on the computer the SSR relays flicker when vixen runs, they are all on if vixen is off, and when started they work as they should however they all flicker like a strobe constantly until vixen shuts off, then they go back to full on again. what could be my issue.?

I think this is the code im using, its the only one i can find so it must be:

/*
Allow Vixen to control Arduino MEGA outputs.
To control 16 relay channels. RELAY1, RELAY2, etc are the relay control pins.
This version was tested with Vixen 3.
Also eliminated the footer feature. This version only uses a header "~!"
in Vixen 3. In Vixen don't use the quotes, just the two characters.

While Vixen 3 is sending data, the Arduino RX light is ON.
*/

// pinouts used.
#define RELAY1 2
#define RELAY2 3
#define RELAY3 4
#define RELAY4 5
#define RELAY5 6
#define RELAY6 7
#define RELAY7 8
#define RELAY8 9
#define RELAY9 10
#define RELAY10 11
#define RELAY11 12
#define RELAY12 13
#define RELAY13 14 /44
#define RELAY14 15 //45
#define RELAY15 16 //46
#define RELAY16 17 //47

// Configure outputs
int chanDigital[] = {RELAY1, RELAY2, RELAY3, RELAY4, RELAY5, RELAY6, RELAY7, RELAY8, RELAY9, RELAY10, RELAY11, RELAY12, RELAY13, RELAY14, RELAY15, RELAY16};
int vixByte[16]; // size of the channel array
int chanDigitalCount = 16; // Total number of ON/OFF channels.
int i = 0; // Loop counter

//setup the pins/ inputs & outputs
void setup(){
// initalize digital Channel Pins as outputs.
for (i=0; i < chanDigitalCount; i++){
pinMode(chanDigital[i], OUTPUT);
vixByte[i] = 0; //set array at 255 not 0 for relay OFF by inverting. only if mech relays used. but im using ssr so leave at 0
analogWrite(chanDigital[i], vixByte[i]); //use either analog or digitalwrite
}

//setup Vixen USB serial port.
Serial.begin(9600);
}

void loop()
{
if (Serial.available() >= chanDigitalCount+1) {
// changed +2 to +1 in above line to have correct channels on relay board
//int uno = Serial.read();
//if (uno == 126){
//int dos = Serial.read();
//if (dos == 33){
// We are now past the header so read and send the 16 channel data.
for (int i=0; i<16; i++) {
// read each byte
vixByte[i] = Serial.read();
analogWrite(chanDigital[i], 0 + vixByte[i]); //Send to relay pin. use either analog or digitalwrite
}
}
}
//}
//} //end of loop

LightUp
10-25-2017, 09:10 PM
Hard to say. It sounds like you have no synchronization between Vixen and your Arduino.
Did you use the header ~! in your Generic Serial setup?
Is your baudrate 9600 in Vixen?
You should use digitalWrite for zero-cross SSRs.

Edit:
Also, some SSR relays use inverted logic so you may want to verify what your relays need.

kev
10-25-2017, 09:58 PM
ok, so with my Mega 2560 and Vixen 2.1 on the computer the SSR relays flicker when vixen runs, they are all on if vixen is off, and when started they work as they should however they all flicker like a strobe constantly until vixen shuts off, then they go back to full on again. what could be my issue.?

I think this is the code im using, its the only one i can find so it must be:

/*
Allow Vixen to control Arduino MEGA outputs.
To control 16 relay channels. RELAY1, RELAY2, etc are the relay control pins.
This version was tested with Vixen 3.
Also eliminated the footer feature. This version only uses a header "~!"
in Vixen 3. In Vixen don't use the quotes, just the two characters.

While Vixen 3 is sending data, the Arduino RX light is ON.
*/

// pinouts used.
#define RELAY1 2
#define RELAY2 3
#define RELAY3 4
#define RELAY4 5
#define RELAY5 6
#define RELAY6 7
#define RELAY7 8
#define RELAY8 9
#define RELAY9 10
#define RELAY10 11
#define RELAY11 12
#define RELAY12 13
#define RELAY13 14 /44
#define RELAY14 15 //45
#define RELAY15 16 //46
#define RELAY16 17 //47

// Configure outputs
int chanDigital[] = {RELAY1, RELAY2, RELAY3, RELAY4, RELAY5, RELAY6, RELAY7, RELAY8, RELAY9, RELAY10, RELAY11, RELAY12, RELAY13, RELAY14, RELAY15, RELAY16};
int vixByte[16]; // size of the channel array
int chanDigitalCount = 16; // Total number of ON/OFF channels.
int i = 0; // Loop counter

//setup the pins/ inputs & outputs
void setup(){
// initalize digital Channel Pins as outputs.
for (i=0; i < chanDigitalCount; i++){
pinMode(chanDigital, OUTPUT);
vixByte[i] = 0; //set array at 255 not 0 for relay OFF by inverting. only if mech relays used. but im using ssr so leave at 0
analogWrite(chanDigital[i], vixByte[i]); //use either analog or digitalwrite
}

//setup Vixen USB serial port.
Serial.begin(9600);
}

void loop()
{
if (Serial.available() >= chanDigitalCount+1) {
[I]// changed +2 to +1 in above line to have correct channels on relay board
//int uno = Serial.read();
//if (uno == 126){
//int dos = Serial.read();
//if (dos == 33){
// We are now past the header so read and send the 16 channel data.
for (int i=0; i<16; i++) {
// read each byte
vixByte[i] = Serial.read();
analogWrite(chanDigital[i], 0 + vixByte[i]); //Send to relay pin. use either analog or digitalwrite
}
}
}
//}
//} //end of loop

This code was designed to use a header of two characters. That is probably why it checks for serial available +2. You have the header test commented out, so it is not testing for those two characters but the serial available is still lookig for the channel count +1. So the data stream does not look like it is syncing up.
You should un-comment the lines in blue above and change the serial available test back to +2 and make sure you have the header setup in Vixen controller.. Or you could try the code by Victor_PV found here - http://doityourselfchristmas.com/forums/showthread.php?35505-Simple-code-for-Arduino-Uno-Mega-Up-to-48-realy-SSR-channels-with-Random-mode

bkcoughlin
10-26-2017, 08:34 PM
Also, missing one of the slashes in the comment of this line:
#define RELAY13 14 /44

Although, I'm not sure that would cause the problems you're describing, it may cause problems assigning that pin.

thecanadiandaily
11-07-2017, 06:40 PM
yeah i fixed that, makes no difference

thecanadiandaily
11-07-2017, 06:41 PM
no idea what you mean about the headers ! and iam using vixen 3.2 i thought iwas using 2.1 but no.

thecanadiandaily
11-07-2017, 06:45 PM
update to my issues here: i am using vixen 3.2, i tried also a windows 7 computer its still the same, my board is a 2560 mega sainsmart, and the relays are also sainsmart SSR's .
Kevin above talks about headers ?? no idea what that is.

I made changes as per above but now nothing works, no relay movement, here is the code so far:
/*
Allow Vixen to control Arduino MEGA outputs.
To control 16 relay channels. RELAY1, RELAY2, etc are the relay control pins.
This version was tested with Vixen 3.
Also eliminated the footer feature. This version only uses a header "~!"
in Vixen 3. In Vixen don't use the quotes, just the two characters.

While Vixen 3 is sending data, the Arduino RX light is ON.
*/

// pinouts used.
#define RELAY1 2
#define RELAY2 3
#define RELAY3 4
#define RELAY4 5
#define RELAY5 6
#define RELAY6 7
#define RELAY7 8
#define RELAY8 9
#define RELAY9 10
#define RELAY10 11
#define RELAY11 12
#define RELAY12 13
#define RELAY13 14 //44
#define RELAY14 15 //45
#define RELAY15 16 //46
#define RELAY16 17 //47

// Configure outputs
int chanDigital[] = {RELAY1, RELAY2, RELAY3, RELAY4, RELAY5, RELAY6, RELAY7, RELAY8, RELAY9, RELAY10, RELAY11, RELAY12, RELAY13, RELAY14, RELAY15, RELAY16};
int vixByte[16]; // size of the channel array
int chanDigitalCount = 16; // Total number of ON/OFF channels.
int i = 0; // Loop counter

//setup the pins/ inputs & outputs
void setup(){
// initalize digital Channel Pins as outputs.
for (i=0; i < chanDigitalCount; i++){
pinMode(chanDigital[i], OUTPUT);
vixByte[i] = 0; //set array at 255 not 0 for relay OFF by inverting. only if mech relays used. but im using ssr so leave at 0
digitalWrite(chanDigital[i], vixByte[i]); //use either analog or digitalwrite
}

//setup Vixen USB serial port.
Serial.begin(9600);
}

void loop()
{
if (Serial.available() >= chanDigitalCount+1) {
// changed +2 to +1 in above line to have correct channels on relay board
int uno = Serial.read();
if (uno == 126){
int dos = Serial.read();
if (dos == 33){
// We are now past the header so read and send the 16 channel data.
for (int i=0; i<16; i++) {
// read each byte
vixByte[i] = Serial.read();
digitalWrite(chanDigital[i], 0 + vixByte[i]); //Send to relay pin. use either analog or digitalwrite
}
}
}
}
}
//end of loop

LightUp
11-07-2017, 06:53 PM
update to my issues here: i am using vixen 3.2, i tried also a windows 7 computer its still the same, my board is a 2560 mega sainsmart, and the relays are also sainsmart SSR's .
Kevin above talks about headers ?? no idea what that is.
You add the headers in Vixen in the Generic Serial setup where it has a place for HEADERs and FOOTERs.

thecanadiandaily
11-07-2017, 06:55 PM
sorry man i still have no idea what to add there. whats a header? im too new to this.

thecanadiandaily
11-07-2017, 07:02 PM
this code here you directed me to by Victor_PV does not work at all, it random flashes and vixen does not even do anything with it.

LightUp
11-07-2017, 07:17 PM
sorry man i still have no idea what to add there. whats a header? im too new to this.
Look in your Generic Serial setup where you add the tilde and exclamation mark as the header.
38080

LightUp
11-07-2017, 07:20 PM
this code here you directed me to by Victor_PV does not work at all, it random flashes and vixen does not even do anything with it.
Most likely an issue with your implementation. The sketch works for many, many users, without bugs over the past years.

bkcoughlin
11-08-2017, 03:14 PM
...

darko886
11-30-2017, 12:31 PM
I'm having a flickering issue and I'm not sure if it's related to this but figured I'd post. I'm brand new to this stuff, and don't know much about electricity haha. So I followed a tutorial and built my first setup with a Mega 2560 and two SainSmart 5V 8 Channel SSRs. I'm using the newest version of Vixen (~3.4).

I haven't had the chance to mess with it much as I have just finished, but when I tested it out yesterday each time a light was supposed to come on, it did but flickered very very quickly. It was almost like a very fast strobe instead of being solid. Same went with the lights on the SSR itself, when the specific channel was supposed to come on, the status light on that channel flickered very quickly.

Anyone know what the issue might be? I have the Arduino powered by plugging in the USB cable into my laptop, and the SSRs are powered by one 5V DC adapter (https://www.amazon.com/gp/product/B0719GY29M/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1)

Thank you all in advance!

bkcoughlin
11-30-2017, 12:43 PM
I'm having a flickering issue and I'm not sure if it's related to this but figured I'd post. I'm brand new to this stuff, and don't know much about electricity haha. So I followed a tutorial and built my first setup with a Mega 2560 and two SainSmart 5V 8 Channel SSRs. I'm using the newest version of Vixen (~3.4).

I haven't had the chance to mess with it much as I have just finished, but when I tested it out yesterday each time a light was supposed to come on, it did but flickered very very quickly. It was almost like a very fast strobe instead of being solid. Same went with the lights on the SSR itself, when the specific channel was supposed to come on, the status light on that channel flickered very quickly.

Anyone know what the issue might be? I have the Arduino powered by plugging in the USB cable into my laptop, and the SSRs are powered by one 5V DC adapter (https://www.amazon.com/gp/product/B0719GY29M/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1)

Thank you all in advance!

What code are you using on your Arduino? What baud? As others have pointed out, did you ensure you have necessary headers?

kev
11-30-2017, 12:44 PM
I'm having a flickering issue and I'm not sure if it's related to this but figured I'd post. I'm brand new to this stuff, and don't know much about electricity haha. So I followed a tutorial and built my first setup with a Mega 2560 and two SainSmart 5V 8 Channel SSRs. I'm using the newest version of Vixen (~3.4).

I haven't had the chance to mess with it much as I have just finished, but when I tested it out yesterday each time a light was supposed to come on, it did but flickered very very quickly. It was almost like a very fast strobe instead of being solid. Same went with the lights on the SSR itself, when the specific channel was supposed to come on, the status light on that channel flickered very quickly.

Anyone know what the issue might be? I have the Arduino powered by plugging in the USB cable into my laptop, and the SSRs are powered by one 5V DC adapter (https://www.amazon.com/gp/product/B0719GY29M/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1)

Thank you all in advance!

Do you have the -DC on the SSR boards connected to the GND pin on the MEGA?

A couple of pictures of your hardware setup will help. Also what sketch you are using.

LightUp
11-30-2017, 12:48 PM
Does your sketch have a "power-on" test? If so, does it flicker also?
Does your Vixen sequence use rapid changes?
I'm trying to discern whether the source of your flicker is from Vixen, or your Arduino - SSR setup.

darko886
11-30-2017, 02:24 PM
#define MEGA_VIXEN
//#define UNO_VIXEN

#ifdef MEGA_VIXEN
#define MAX_CHANNELS 52
int channels[MAX_CHANNELS] = {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, 21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37 ,38,39,40,41,42,43,44,45,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[i], OUTPUT);
}

void loop()
{
int i;

if (Serial.available() >= MAX_CHANNELS)
{
for (i=0; i < MAX_CHANNELS; i ++) incomingByte[i] = Serial.read();
}

for (i = 0; i < MAX_CHANNELS; i ++ ) analogWrite(channels[i], incomingByte[i]);
}

That is the code I'm using. If I remember correctly, the baud is 9600. I did plug the -DC into the GND.

I'm also trying to figure out if it's Vixen or the Arduino & SSR that are causing the issue. Is there a way to test the Arduino & SSR without Vixen?

LightUp
11-30-2017, 02:54 PM
You could try bumping up your baud rate, say to 57600 and try again.
9600 baud is 960 bytes per second. Since you have 52 channels, your update is about 18 times a second. Could this be your flicker rate?

darko886
11-30-2017, 02:57 PM
You could try bumping up your baud rate, say to 57600 and try again.
9600 baud is 960 bytes per second. Since you have 52 channels, your update is about 18 times a second. Could this be your flicker rate?

I actually only have 16 channels, I accidentally posted to original code prior to me changing it to 16. Should I still adjust the baud rate?

LightUp
11-30-2017, 03:08 PM
I actually only have 16 channels, I accidentally posted to original code prior to me changing it to 16. Should I still adjust the baud rate?
That number of channels give 60HZ, which wouldn't be a rapid flicker. But you may try it.

The testing of the Arduino & SSR can be done by using a "power-on" test that cycles through each channel for say 1/2 a second before it gets to start the Vixen reading stuff. The sketch (i.e. http://doityourselfchristmas.com/forums/showthread.php?35505-Simple-code-for-Arduino-Uno-Mega-Up-to-48-realy-SSR-channels-with-Random-mode/page23 ) in post #1 uses a "test sequence" for this purpose.
If it still flickers then it is puzzling. I haven't experienced this phenomenon.

Are you sending a Vixen sequence of 52 channels?

darko886
11-30-2017, 03:12 PM
That number of channels give 60HZ, which wouldn't be a rapid flicker. But you may try it.

The testing of the Arduino & SSR can be done by using a "power-on" test that cycles through each channel for say 1/2 a second before it gets to start the Vixen reading stuff. If it still flickers then it is puzzling. I haven't experienced this phenomenon.

Pardon my ignorance but do you have an example of a power on test I could use? When I get home I will take pictures of my setup and video of the flicker so you see exactly what it's doing.

LightUp
11-30-2017, 03:17 PM
Yes, I had edited my previous reply while not realizing you sent your reply.

darko886
11-30-2017, 03:24 PM
Yes, I had edited my previous reply while not realizing you sent your reply.

Awesome, thank you so much for that. With regards to what I'm sending from Vixen, I pretty much set up a test sequence where I had each channel turn on and off for a second, and then do the same to the next.

LightUp
11-30-2017, 04:06 PM
Awesome, thank you so much for that. With regards to what I'm sending from Vixen, I pretty much set up a test sequence where I had each channel turn on and off for a second, and then do the same to the next.
I was wondering if you were sending 52 vixen channels but reading 16 in the Arduino sketch. If so, then Vixen's 52 channels of data would possibly cause a flicker at 9600 baud.

darko886
11-30-2017, 04:10 PM
I was wondering if you were sending 52 vixen channels but reading 16 in the Arduino sketch. If so, then Vixen's 52 channels of data would possibly cause a flicker at 9600 baud.

Unfortunately no, I have only 16 channels in Vixen as well. Do you think the Vixen version would matter as well? I have the newest version. I'll be home in a few hours and I'll try some of your suggestions and let you know if any work.

LightUp
11-30-2017, 04:22 PM
No, I don't believe it is a Vixen version problem. I don't recall anyone having this issue in recent months. There have been people who claimed flicker with LEDs but they used "snubber", which in this case is a 47K 1/2 watt resistor across the SSR output where your lights connect to. But only some people had this experience.

Since you say that your SSR indicator LED also flickers, it makes me think that the problem is more associated with your Arduino - SSR interface. Hence a "test sequence", just using an Arduino sketch without using Vixen, may help to track it down.

kev
11-30-2017, 04:27 PM
#define MEGA_VIXEN
//#define UNO_VIXEN

#ifdef MEGA_VIXEN
#define MAX_CHANNELS 52
int channels[MAX_CHANNELS] = {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, 21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37 ,38,39,40,41,42,43,44,45,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[i], OUTPUT);
}

void loop()
{
int i;

if (Serial.available() >= MAX_CHANNELS)
{
for (i=0; i < MAX_CHANNELS; i ++) incomingByte[i] = Serial.read();
}

for (i = 0; i < MAX_CHANNELS; i ++ ) analogWrite(channels[i], incomingByte[i]);
}

That is the code I'm using. If I remember correctly, the baud is 9600. I did plug the -DC into the GND.

I'm also trying to figure out if it's Vixen or the Arduino & SSR that are causing the issue. Is there a way to test the Arduino & SSR without Vixen?

This code uses AnalogWrite to write to all of the used pins. If you are using pins other than PWM (analog), the code won't work properly. Considering that you are using Sainsmart SSRs, they probably do not support dimming, so the analogWrite won't matter anyway. I suggest using the Victor_PV sketch found here - http://doityourselfchristmas.com/forums/showthread.php?35505-Simple-code-for-Arduino-Uno-Mega-Up-to-48-realy-SSR-channels-with-Random-mode
Victors code also has a Self-Test feature that will light the channels one at a time in order, so you can see if the MEGA/SSR is wired correctly without using Vixen.

LightUp
11-30-2017, 04:41 PM
That's good point kev, as I was just looking at the code again and noticed that too.
The other thing about our usual "recommendation sketch" you have pointed to is to remember is to use the header "~!" (without the quotes) in Vixen Generic Serial setup.

Edit:
I tried a crude sketch to use the analoWrite and it did give a sort of a flicker. I used LEDs as I don't have the SSR board. I also didn't use Vixen, but a stand-alone sketch using 8 LEDs.

darko886
11-30-2017, 05:46 PM
Thank you all for the help! LightUp, you solved it sir. I went back and checked my Vixen setup and I had 16 elements listed, but sure enough I had 48 channels listed for my controller. Changed that to 16 and no more flickering! Thank you so much, I would have never guessed that.

LightUp
11-30-2017, 06:12 PM
Thank you all for the help! LightUp, you solved it sir. I went back and checked my Vixen setup and I had 16 elements listed, but sure enough I had 48 channels listed for my controller. Changed that to 16 and no more flickering! Thank you so much, I would have never guessed that.
Glad you solved it. Yep... it's hard to troubleshoot remotely, without being able to look over your shoulders to see what you actually did.

MikeKrebs
11-30-2017, 09:51 PM
#define MEGA_VIXEN
//#define UNO_VIXEN

#ifdef MEGA_VIXEN
#define MAX_CHANNELS 52
int channels[MAX_CHANNELS] = {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, 21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37 ,38,39,40,41,42,43,44,45,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[i], OUTPUT);
}

void loop()
{
int i;

if (Serial.available() >= MAX_CHANNELS)
{
for (i=0; i < MAX_CHANNELS; i ++) incomingByte[i] = Serial.read();
}

for (i = 0; i < MAX_CHANNELS; i ++ ) analogWrite(channels[i], incomingByte[i]);
}

That is the code I'm using. If I remember correctly, the baud is 9600. I did plug the -DC into the GND.

I'm also trying to figure out if it's Vixen or the Arduino & SSR that are causing the issue. Is there a way to test the Arduino & SSR without Vixen?this is the "easiest" sketch and one of the worst for syncing lights.
just a guess on my part. you have zero cross ssr and are trying to pwm without a zero cross detection circuit. recipe for disaster.

LightUp
11-30-2017, 10:15 PM
this is the "easiest" sketch and one of the worst for syncing lights.
just a guess on my part. you have zero cross ssr and are trying to pwm without a zero cross detection circuit. recipe for disaster.
This is how many get started without knowing the pitfalls. In their excitement they can overlook some issues they don't understand, but are willing to give it a go. Very few seem to research it to any real depth before they make the plunge. But, we are here to help, right?

darko886
12-01-2017, 08:22 AM
So the consensus here is that the victor sketch is better and will still work for me?

LightUp
12-01-2017, 10:46 AM
So the consensus here is that the victor sketch is better and will still work for me?
Some years ago, many new to the lighting scene, had issues with serial ports, baudrate, channel counts, inverted logic, and Vixen interface problems. We saw repeat beginner problems and many had different sketches they found on the web that they wanted us to modify for them. It was thought that most problems would resolve themselves if all the beginners would start with the same sketch. Victor took it upon himself to do that so most could get started with a sketch that included all the basic items needed for these various relay and SSR products in one sketch. This minimized us having to constantly modify sketches to suit various needs. It was not designed for pixels. Yet some wanted both relays and pixels with one Arduino and so there are a few sketches here that do that, but it was not done by victor.


If you use Vixen, relays and zero-cross SSRs then victor's sketch will work for you.

thecanadiandaily
12-02-2017, 08:41 PM
Some years ago, many new to the lighting scene, had issues with serial ports, baudrate, channel counts, inverted logic, and Vixen interface problems. We saw repeat beginner problems and many had different sketches they found on the web that they wanted us to modify for them. It was thought that most problems would resolve themselves if all the beginners would start with the same sketch. Victor took it upon himself to do that so most could get started with a sketch that included all the basic items needed for these various relay and SSR products in one sketch. This minimized us having to constantly modify sketches to suit various needs. It was not designed for pixels. Yet some wanted both relays and pixels with one Arduino and so there are a few sketches here that do that, but it was not done by victor.


If you use Vixen, relays and zero-cross SSRs then victor's sketch will work for you.

yeah thanks, Victors did not work for mine at all. I went back to the original i had and now it seems to work the way it should, no issues. so there must have been something i had copied wrong, anyway it works perfect now, i just wanted basic functions of on and off and maybe some dimming all works.

here is the working code:
#define MEGA_VIXEN
//#define UNO_VIXEN

#ifdef MEGA_VIXEN
#define MAX_CHANNELS 48
int channels[MAX_CHANNELS] = {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,22,23,24, 25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41 ,42,43,44,45,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[i], OUTPUT);
}

void loop()
{
int i;

if (Serial.available() >= MAX_CHANNELS)
{
for (i=0; i < MAX_CHANNELS; i ++) incomingByte[i] = Serial.read();
}

for (i = 0; i < MAX_CHANNELS; i ++ ) analogWrite(channels[i], incomingByte[i]);
}

so far it works....