Mega 2560 and Vixen 2.1 SSR relays flicker when vixen runs

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/fo...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?
 
Last edited:
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.
 
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.
 
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.
 
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.
 
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.
 
Code:
#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/fo...-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.
 
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.
 
Last edited:
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.
 
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.
 
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?
 
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.
 
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, 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);
}

so far it works....
 
Back
Top