5v Relay acting weird

I have the following attached diagram. The problem is when I disconnect the red line everything works as expected (i.e. turning off channel 0 turns off channel 0). When the red connection is connected and I try to toggle a channel other channels would turn on and random toggle occurs. For example turning on channel 4 only would turn off channel 1,2,3 & 5 leaving 6,7,8 on

It sounds like you have some wiring problems. Be sure all the grounds are connected. Debug it and get to work before connecting the mains. If you get when the mains equipment is operating it is probably generating EMI which is messing up your controller.

I went ahead and changed the controller and everything works as expected. The only problem now is that when i turn on a channel it closes another and then after a while it turns the switch channel back on . Maybe EMI is messing stuff, so how can I shield that


You should add a snubber circuit to the loads to minimize de EMI generated.
See this:
Snubber Circuit

Hi Hugo007

Do you mean something like that : https://www.amazon.com/Kingjinglo-Absorption-Snubber-Protection-Resistance/dp/B081F9W9X6

Also could that be the reason. It sometimes works and then a day or two it starts acting weird again.

Please can anyone help here?

In order to help you, we need to see your code and understand your wiring. And we need you to be specific about the problem, what you've tested and found, and details about your grounding connections (as has been suggested).

Is your AC / DC adapter providing a grounded output or floating? What is the connection shown as a red conductor on the diagram - is that an AC ground or is it the AC Phase (hot) wire?

Also,what is the available power at the DC adapter? For example, have you added up all the required power needed to drive the relays, the ESP and the 595 plus any other circuitry that may not be shown? If the adapter cannot supply sufficient power during relay switching for example, then there's no telling what the outputs might do. We don't know if your relays are opto isolated, or whether they are high side or low side switching (which may be affected by the grounding issues previously mentioned. People here want to help. We need all the detail.

You see, we cannot help because we do not know enough about your circuit, your code and your problem. We know only what you have said so far, and it's not enough to diagnose your problem and help you resolve it.

Hi steve_mcdonald,

I know it has been a long time and I might not get a reply, but I hope for the best :slight_smile:

for the code and wiring I followed this tutorial : ESP8266: Connection to SN74HC595 via SPI - techtutorialsx

The relay is this one which is currently unavailable and yes it is opto isolated: https://www.amazon.com/SainSmart-101-70-102-8-Channel-Relay-Module/dp/B0057OC5WK

The DC adapter is one of these and rated at 700ma ( I tried adaptor of up to 2A, but nothing changed) : AC DC 5V 700mA 12V 450mA 9V 500mA 3.5W Precision Buck Converter AC 220V to 5V DC step down Transformer power supply module|Switching Power Supply| - AliExpress

The red wire is the live wire from the AC while the other coming out of the source is the AC GND.

You'll need:

The added protection of separating power supplies is sensible and good advice, and the 595 should have a capacitor as noted. As far as the MOV, I may have misunderstood, but would it be better placed across the line (Active & Neutral) rather than in series with e the Active (across the relay contacts)?

@steve_mcdonald; Good question. I'm sure that connected across the switched line (or load) to neutral would better at limiting the peak voltage, but I'm wondering if connected across the contacts would be better at extinguishing (or preventing) arcing. It seems that its more popular to connect across the contacts, but that might be because there's no neutral available or that's its easier to mount the MOVs on a PCB (or both). Not really an answer ... both methods do work, but probably one works better than the other.

Regarding the separate power supply that is connected to the relay, does it matter if I connected it to the VCC and GND (the ones that are along the trigger pins) or if I connected it to the JDD-VCC ?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.