Signal bleed over from Arduino to SSR..PLEASE HELP

jst1979

New member
Signal bleed over from Arduino to SSR

Newbie needs help in a bad way. I started this project November of last year had to many problems to get it to work in time so I shelved it till this year. I am on a tight budget so Im using a Arduino mega 2560 with 4 SSR picture links below with incandescent lights and vixen software to run it. I learned my setup using videos from Dee Higginbotham the Cheapskate Video how to. I am using the sketch provided in the link from the videos it seems to work I just wish it had a random function when not receiving a signal. Anyway back to the problem every time the signal light flashes on the Arduino trips the first ten channels some times others this is when vixen is not playing. Right now the Arduino is powering the SSR's I have a 5V power supply that I could power the SSR's with the problem is I read you have to have the ground from Arduino hooked up to trip the SSR's not for sure how to wire the SSR's mine are a little different from what I see posted on other threads.

I hope I have provide all the necessary information to figure this out.
picks of SSR and arduino
https://ibb.co/4KVHtJj
https://ibb.co/DbYffJZ

Sketch im using

#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);
}
 
First I have to rant <rant> I hate this sketch! Creator should be forced to watch random lights blinking without any context! </rant>

But to your problem...There is nothing in your sketch that should cause the lights to come on. If it is happening, there must be something either corrupting the serial line or you have some wires exposed somewhere.

I would power all the relays separately. For the ground connection, run a wire from the Mega ground to the ground pin on the relay board.

What are your controlling on the output? Regular 110v incandescents? The G3MB-202P relays are zero cross relays. That means when you tell them to turn on, they wait for zero cross and turn on for one half cycle (until the next zero cross). I wonder if they are really working as well as you think. Would love to see them in action. Got video? Especially with you hitting them with a PWM (analog) signal.

There is sketch on this forum that has the random function built in. It is not hard to implement. look in the Arduino section.
 
The analogWrite instruction in the second-to-last line will turn the relays on and off. Output levels 0/255 will have the correct values for 100% OFF/ON at the zero-crossings, although intermediate values will do wonky things.

The bigger issue is that the sketch does not seem to have any method of recognizing the start/end of incoming data, i.e. to RELIABLY determine which byte in the incoming serial data stream is for channel 1. The only way for the sketch to know which serial character is for channel 1 is to count characters starting at the very first one (which is hopefully for channel 1). It will seem to work if there is a clean startup for both the PC and the Arduino, but there would not be any consistent recovery from a glitch without powering everything off and back on. The behavior PC/Arduino setup is going to be quite unreliable.
 
Back
Top