SSR sticks on and won't switch off again until disconnecting from circuit

I'm using SSRs for the first time - currently just a dry run with an LED, later to run a heater in a project.

Its this one from ebay, although I have several and get the same result with each:

https://www.ebay.co.uk/itm/1pcs-5v-1-Channel-OMRON-SSR-G3MB-202P-Solid-State-Relay-Module-For-Arduino/191852059219?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2057872.m2749.l2649

I have it wired into my Arduino Uno board with 5v and ground, and pin 4 as my signal. At the moment I also have 5v and ground from the arduino on the high voltage end, running the LED, though later this will be mains power.

This is my code:

int relay = 4;

void setup() {
  pinMode(relay, OUTPUT);
}
void loop() {
  digitalWrite(relay, LOW);
  delay(5000);
  digitalWrite(relay, HIGH);
  delay(5000);
}

This brings the LED on after 5 seconds at which point it then stays on indefinitely. The SSR also has an LED on it which pulses on 5 second intervals as I'd expect.

If I manually break the LED circuit and reconnect it while the SSR should be off, it will stay off until the arduino turns it on again, but once on, the arduino won't turn it off as I expect it to.

Not sure if my code is faulty or I've misunderstood something about the way relays/arduinos work.

Any help much appreciated.

1 Like

Do you have any electronic experience ?
A solid state relay (most of them anyway) switches AC not DC.
A led from the output to GND is not a correct load.
You need to connect a 120VAC to 240VAC lamp by leaving the Neutral wire untouched and cutting the HOT wire and connecting the two cut ends to the two terminals of the solid state relay so it can switch the hot
lead of the lamp load. DO NOT UNDER ANY CIRCUMSTANCES connect BOTH of the lamp wires to the SSR terminals. It will not do anything because no AC would be connected. You have to cut the lamp hot wire and connect the two cut ends to the relay output terminals and then plug the lamp plug into the AC outlet and switch the lamp with the arduino (or apply 5Vdc to the input terminals)

It will not switch dc. (at least not correctly)

FYI, you should have watched something like this before messing around with it.

raschemmel:
Do you have any electronic experience ?
A solid state relay (most of them anyway) switches AC not DC.
A led from the output to GND is not a correct load.
You need to connect a 120VAC to 240VAC lamp by leaving the Neutral wire untouched and cutting the HOT wire and connecting the two cut ends to the two terminals of the solid state relay so it can switch the hot
lead of the lamp load. DO NOT UNDER ANY CIRCUMSTANCES connect BOTH of the lamp wires to the SSR terminals. It will not do anything because no AC would be connected. You have to cut the lamp hot wire and connect the two cut ends to the relay output terminals and then plug the lamp plug into the AC outlet and switch the lamp with the arduino (or apply 5Vdc to the input terminals)

It will not switch dc. (at least not correctly)

FYI, you should have watched something like this before messing around with it.

Probably not a good idea for him to try messing with mains voltages considering his level of experience. ...

Thanks for your advice. That makes things a bit clearer. Cheers

Hi,
That SSR is an AC control device, probably using a TRIAC in its output.

If you at the moment are switching DC with its output, that latching effect will occur.

You need to look up triac or thyristor control theory to understand how the AC SSR works.

Tom... :slight_smile:

and FYI "SSR Sticks ON..." screams "I know nothing about electronics.

The reason being, that "sticks on" behavior is called "latching" in electronics.

If your post title said "SSR Latching.." it would not have been quite so obvious, however, upon reading the
post the title suddenly becomes "SSR Latching with DC Load.." which also screams "no electronic experience".

This is useful to us because we immediately what the issue is and what to explain to the OP.