1
\$\begingroup\$

I am designing a PCB with a 5V relay that controls an external DIN mounted latching relay (red line with the "1."):

Wiring

The problem I have, is that the ESP32 often restarts after turning the latching relay on/off. This only happens if the latching relay is connected. I don't have any problems when the 5V relay triggers without being connected to anything.

When I connect the oscilloscope to the 3.3V rail, I can see a spikes from -40V to 50V (Vpp ~ 90V)

img img

This is my schematic for the Power Supply and relays:

img

RAC PS datasheet: datasheet
Relay PCN-105D: datasheet
Project full schematic, layout, etc: github

Can those spikes be the responsible of the ESP32 restarting?
What can I do to fix that?

Thanks!

[Edit] My probe is connected to the thermal pad of the TO220, and to a pin header where I expose the GND:

probes

And this is my entire setup
setup

\$\endgroup\$
17
  • \$\begingroup\$ Yup those spikes are most probably reseting your controller! I have seen similar situations. The most simplest and easy solution I see is use an isolator. Since its a relay I think a photocoupler should do the trick. EL817C is cheap and easy to use. \$\endgroup\$
    – Bubu
    Aug 3 at 17:07
  • 1
    \$\begingroup\$ Already tried a flyback diode at the relays? \$\endgroup\$
    – RemyHx
    Aug 3 at 17:12
  • \$\begingroup\$ @Bubu where would you add the isolator? I think the spikes are coming from the mains. I control the relays using a uln2003a driver \$\endgroup\$ Aug 3 at 17:16
  • 2
    \$\begingroup\$ To verify/debug IF it is your power spike are caused due to mains OR lack of isolation, use a battrey to power your digital circuit. If the spikes go away with battrey then your power supply circuit need imporvment. Else if it doesn't help then definetley your digital system needs isolation \$\endgroup\$
    – Bubu
    Aug 3 at 17:25
  • 1
    \$\begingroup\$ When you attach the scope how do you attach the ground? \$\endgroup\$
    – user253751
    Aug 3 at 20:13

2 Answers 2

1
\$\begingroup\$

You can check the reset reason of the ESP32 through esp_reset_reason()

If it's "brownout detector" you know the spikes are the cause and you need better isolation. You could turn-off brownout detection if you want (I do after I discovered that starting a radio when my device was USB powered was doing that), but strongly discouraged because BP is there for a reason.

\$\endgroup\$
1
  • \$\begingroup\$ Thanks for the tip! I checked the reset reason and it is Power On Reset. I have no clue what it means. Will try with disabling that, to at least be sure that that is the problem \$\endgroup\$ Aug 8 at 11:38
1
\$\begingroup\$

I think it is unlikely that you are actually getting those high voltage transients on the 3.3 V logic rail, or you would be seeing damage to those components. More likely the transients form the AC relay coil are being coupled to the scope probe via inductive or magnetic coupling, or through a ground loop. Try connecting the scope probe to the ground point, and you will probably still see significant noise.

Are you seeing this mostly when the relay opens?

Adding a snubber across the AC coil of the relay will probably help. Try something like a 100 ohm resistor in series with a 220 nF film capacitor across the coil to see if it helps.

You could also try adding more capacitors across the 3.3V logic supply, as well as a TVS diode to absorb such transients.

\$\endgroup\$
3
  • \$\begingroup\$ Yes! I see this mostly when the relay opens. Since the outer it is a latching relay, I turn on the PCB relay and turn it off 200ms later, so I keep it on for a very short amount of time. I am not sure what you mean with Try connecting the scope probe to the ground point. Do you mean both connector from the probe connected to the PCB GND? \$\endgroup\$ Aug 8 at 11:41
  • 2
    \$\begingroup\$ Yes. If you still see this noise, it is being picked up by the probe or through a ground loop. If the shorted input shows no noise, you have serious problems on the 3.3V power supply. \$\endgroup\$
    – PStechPaul
    Aug 8 at 20:43
  • 1
    \$\begingroup\$ @CarlosGarcia Correct probing is vital! See here: m.youtube.com/watch?v=Edel3eduRj4 \$\endgroup\$
    – winny
    Aug 9 at 16:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.