SSR Relay latching

Hi - I'm testing a few circuits to get them working before moving on to a project, and I'd like some assistance with a two channel SSR relay as pictured. The SSR component are Weiba input 5V and output (load) 5-40VDC/5A. I've seen other posts saying SSRs shouldn't be used to switch DC but clearly this is intended to. The problem is that each circuit works OK in isolation but as soon as I hook up both, one seems to want to 'latch' and even though the on-board LED is off, the relay is 'energised' when it shouldn't be. And when running a sketch sometimes the 2nd relay works, sometimes not. Yet when hooking it up in isolation it works fine (my first thought was it was faulty). Anyone got any positive suggestions please? The circuit is two off plain LED circuits running from a breadboard using 12V to power the LEDs, Arduino powered via USB and connected to the SSR via pins 2, 3 and 5V and GND.

int ch1Pin = 2;// define pin 2 for chan 1 of SSR    FAN
int ch2Pin = 3;// define pin 3 for chan 2 of SSR    LED

int triggerType = LOW;// type LOW if low trigger and HIGH if high trigger SSR. SIMON LOW level trigger means zero volts activates relay NOTE ITS WRITTEN ON THE RELAY

int ssrON, ssrOFF;// used for two different SSR trigger type. Do not change

void setup() {
    
    pinMode(ch1Pin, OUTPUT);//define ch1Pin as output
    pinMode(ch2Pin, OUTPUT);//define ch2Pin as output
    
    if(triggerType == HIGH)
    {
      ssrON = HIGH;
      ssrOFF = LOW;
    }else{
      ssrON = LOW;
      ssrOFF = HIGH; 
    }       
   digitalWrite(ch1Pin,ssrOFF);// set initial state of SSR 1: OFF
   digitalWrite(ch2Pin,ssrOFF);// set initial state of SSR 2: OFF      
    
}

void loop() {
    digitalWrite(ch2Pin,ssrON);// turn relay SSR1 ON
    delay(1000);// waite for 3 seconds
    digitalWrite(ch2Pin,ssrOFF);// turn relay SSR2 OFF    
    delay(1000);// waite for 3 seconds

       digitalWrite(ch1Pin,ssrON);// turn relay SSR1 ON
    delay(1000);// waite for 3 seconds
    digitalWrite(ch1Pin,ssrOFF);// turn relay SSR2 OFF    
    delay(1000);// waite for 3 seconds
    
   
}  // close void loop

Please post the full sketch that you are using to test this. Does the problem occur whichever relay is turned on first ?

Thank you for adding the code to your first post

I am becoming increasingly bored at having to say this, but please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

Thank you! Have posted the code. Yes - the problem seems intermittent either one or the other works. I've played with the code, deleting all reference to one complete channel and yet the problem remains. It's almost like it refuses to work in conjunction with the other

Schematics might be helpful.

Post a schematic.

Post an image of your project.

Which Micro Controller are you using?

Is this simulator code?

Post a link to the relay's data sheet.

That would show that you connected the + and - correctly for the relay, which is really a MOSFET and a driver transistor in the large plastic package.

What would show that? I don't follow what you're saying. The +ve and -ve are connected to the Ardunio 5v and GND correctly, I don't believe the high voltage switching side has any polarity and can be used to switch the 'live' or 'ground' side of any circuit?

Using an Arduino Uno.
Simulator code? Not sure what you mean - this is the code uploaded to the Arduino.

I can't find a data sheet for the exact SSR - here is the ebay link to it. it's a DC-DC 5V / 5-40VDC SSSR 2 channel stating it's made for Arduino
It is a low level trigger written on it if that's any help

MIght there be a better SSR that I should use instead? Open to suggestions/guidance

Doesn't matter if you believe it or not. DC ALWAYS has polarity. A SSR for DC always is polarity sensitive, since the output is a MOSFET, not a mechanical relay!

1 Like


https://www.allaboutcircuits.com/technical-articles/basics-of-ssr-solid-state-relay-the-switching-device/

I'm dying to see that schematic!!!!!!!!!

schematic of the project?

First problem with a lot of this stuff is no actual data sheet. Looking at what you have, by name, I can't find anything. A good quality SSR will have a data sheet spelling out things like Output Voltage Max and Output Current Min.

Something you can try is placing a 10K resistor to ground on the + control inputs. Also less a minimum current specification I have no idea what you actually have. In this case a picture is not worth a thousand words but a true accurate data sheet would be. Again, try a few 10K resistors to ground on the + control voltage pins. Finally as mentioned Load Polarity certainly does figure into things. I suggest you look at data sheets from reputable DC SSR manufactures like Crydom or similar.

Ron

1 Like

And consider using millis() like so, not tested.

int ch1Pin = 2;// define pin 2 for chan 1 of SSR    FAN
int ch2Pin = 3;// define pin 3 for chan 2 of SSR    LED

int triggerType = LOW;// type LOW if low trigger and HIGH if high trigger SSR. SIMON LOW level trigger means zero volts activates relay NOTE ITS WRITTEN ON THE RELAY

int ssrON, ssrOFF;// used for two different SSR trigger type. Do not change

const unsigned long OneK = 1000;
unsigned long pastTickCOunt = millis();
int state = 0;

void setup() {

  pinMode(ch1Pin, OUTPUT);//define ch1Pin as output
  pinMode(ch2Pin, OUTPUT);//define ch2Pin as output

  if (triggerType == HIGH)
  {
    ssrON = HIGH;
    ssrOFF = LOW;
  } else {
    ssrON = LOW;
    ssrOFF = HIGH;
  }
  digitalWrite(ch1Pin, ssrOFF); // set initial state of SSR 1: OFF
  digitalWrite(ch2Pin, ssrOFF); // set initial state of SSR 2: OFF

}

void loop()
{

  switch ( state )
  {
    case 0:

      digitalWrite(ch2Pin, ssrON); // turn relay SSR1 ON
      pastTickCount = millis();
      state = 1;
      break;
    case 1:
      if ( (millis() - pastTickCount) >= OneK )
      {
        digitalWrite(ch2Pin, ssrOFF); // turn relay SSR2 OFF
        pastTickCount = millis();
        state = 2;
      }
      break;
    case 2:
      if ( (millis() - pastTickCount) >= OneK )
      {
        digitalWrite(ch1Pin, ssrON); // turn relay SSR1 ON
        pastTickCount = millis();
        state = 3;
      }
      break;
    case 3:
      if ( (millis() - pastTickCount) >= OneK )
      {

        digitalWrite(ch1Pin, ssrOFF); // turn relay SSR2 OFF
        pastTickCount = millis();
        state = 4;
      }
      break;
    case 4:
      if ( (millis() - pastTickCount) >= OneK )
      {
        pastTickCount = millis();
        state = 0;
      }
    default:
      state = 0;
  }
}  // close loop()

instead of using delay().

Yes, the project schematic . Sorry I did not make that clear.

The picture of the dual SSR that you posted shows on the screen printing on the case of the actual SSR that the two output pine have a + sign on one and a - sign on the other. Trace those to the green connector and those are the + and - connections for your external circuit.

1 Like

Posted :slight_smile:

1 Like

The SSR doesn't have a polarity on the switching terminals - just A1 / B1 etc. Besides does this matter - it's just a switch

Thank you for your assistance. This is what is posted on the ebay site for the SSE

Working Voltage: 5V/12V / 24V

  1. Channel:1 / 2 / 4 / 6 / 8

  2. Weight:13g/21.5g/40g/53g/70g

  3. Control Method: DC - DC

  4. Load voltage:5-40VDC

  5. Load current:5A

  6. Voltage version Quiescent current Working current

1-CH 5/12/24V 0mA 12.5mA

2-CH 5/12/24V 0mA 20.5mA

4-CH 5/12/24V 0mA 38mA

6-CH 5/12/24V 0mA 70mA

8-CH 5/12/24V 0mA 128V

  1. Trigger Signal Source: Low level trigger

Where would the 10k resistors go - between the CH1 and GND and the CH2 and GND pins that control the SSR? Does that ensure they're pulled to zero V with no signal?