Relays causing voltage spikes on microcontroler pin

Thread Starter

kramzar

Joined Mar 7, 2022
35
Hello,

I have a custom esp32-based PCB that controls 2 power relays that drive a 32A load.
Until recently the board worked fine and didnt have a problem driving the relays. But today one of the boards stoped working,
due to one of the pins that controls the relays. Upon closer inspection the pin is still controlled via softwere, but it can only output 0.6V instead of the regular 3.3V needed to drive the transistor for the 12V relays.

Here is the circuit diagram for the relay control part of the circut:
relays.PNG
The transistor in question is a Diodes Incorporated 2N7002E-7-F


My first theory was that some type of voltage spike from the relays caused damage to the pin due to overvoltage,
and sure enough, after measuring the turn-on signal on the pin of a new working esp32 board, I found the voltage spike.

spike.PNG


My question is how can i deal with this spike so it does not cause any more damage or reliability problems on the board?
 

sghioto

Joined Dec 31, 2017
5,388
What is the WELD DET line going to? I suspect that is picking up the spike when the relays are activated.
How soon is that spike showing up after the output from the ESP32 goes high?
 
Last edited:

Thread Starter

kramzar

Joined Mar 7, 2022
35
What is the WELD DET line going to? I suspect that is picking up the spike when the relays are activated.
How soon is that spike showing up after the output from the ESP32 goes high?
Weld DET stands for welding detection and is a set of mirrored contacts on the relay to detect if they are welded shut. The line goes directly on a microcontroler pin, but why would that pick up noise? Does the noise usualy not come from the coil of the relay? The switching contacts of a relay are just switches after all, and the 10k resistor prevents any real current from flowing through.
 

Pyrex

Joined Feb 16, 2022
267
Hi,
it's a weird design to use same 35 Amp relay to drive power line and to use it's extra contact to detect if the relay is actuated/sticked or not. Small signal line and power line in the same casing mean you can expect some disturbance.
I guess, it's beter to use a third low power relay with one NO contact, powered by 12V and driven by those two NC contacts in series . The third relay will send the signal to the microprocessor
 

Alec_t

Joined Sep 17, 2013
14,313
The fact that there is a significant delay between the pin going high and the spike occurring suggests to me that it is the main contacts of the relay (not the coil or the weld-detect contacts) which are generating a transient, perhaps because of contact bounce. This transient is getting through to the pin via spurious inductive or capacitive coupling.
What load(s) are the main contacts switching?
 

LowQCab

Joined Nov 6, 2012
4,071
I would suspect that your FET could easily be smoked as well, ( in a shorted condition ).
It's very under-rated for the job.
.
.
.
 

Ian0

Joined Aug 7, 2020
9,814
Hello,

I have a custom esp32-based PCB that controls 2 power relays that drive a 32A load.
Until recently the board worked fine and didnt have a problem driving the relays. But today one of the boards stoped working,
due to one of the pins that controls the relays. Upon closer inspection the pin is still controlled via softwere, but it can only output 0.6V instead of the regular 3.3V needed to drive the transistor for the 12V relays.

Here is the circuit diagram for the relay control part of the circut:
View attachment 294950
The transistor in question is a Diodes Incorporated 2N7002E-7-F


My first theory was that some type of voltage spike from the relays caused damage to the pin due to overvoltage,
and sure enough, after measuring the turn-on signal on the pin of a new working esp32 board, I found the voltage spike.

View attachment 294949


My question is how can i deal with this spike so it does not cause any more damage or reliability problems on the board?
A 32A load is a job for a contactor, in which case you can add an auxiliary contact to detect the position of the main contacts. The aux contact fits on the top, so it is much further from the source of interference.
10uF load and 100nF on the gate is going to make things worse, as it keeps the FET in its linear region dissipating power for longer.
Do the job properly - use a 32A contactor with a 230V coil, and switch the coil with a triac/opto-triac combination.
4-pole contractors are common so you would just need the one.
 

Thread Starter

kramzar

Joined Mar 7, 2022
35
A 32A load is a job for a contactor, in which case you can add an auxiliary contact to detect the position of the main contacts. The aux contact fits on the top, so it is much further from the source of interference.
10uF load and 100nF on the gate is going to make things worse, as it keeps the FET in its linear region dissipating power for longer.
Do the job properly - use a 32A contactor with a 230V coil, and switch the coil with a triac/opto-triac combination.
4-pole contractors are common so you would just need the one.
Thank you. So you are sugesting i get rid of the capacitors? The main reason i added them is to prevent bouncing from the mcu pin.
I sadly can not switch out the relays at this point, but would it be also good if i replace the transistor with an octocoupler and the WELD_DET line i add one as well?

If not, what transistor should i use instead?
 

Ian0

Joined Aug 7, 2020
9,814
You just need a bigger FET. I don’t know how much bigger as you haven’t said the relay coil resistance (and take the capacitors off).
The interference is coming in on the WELD DET line, so add another resistor between relay and board, so you have one on both inout and output and make sure that the tracks that are the relay side of the resistor don’t cover too much board.

A further thought: if you join WELD DET to pin 4 of the relay coil (without the 10k) then attenuate the 12V signal down to 3.3V when it reaches the board, you have eliminated one wire down which interference can enter, and you have also attenuated the interference by a factor of 3.
 

LowQCab

Joined Nov 6, 2012
4,071
Having ANY concern about "welding" the Contacts on your Relay
indicates that the Relay is grossly underrated for the actual Load-characteristics,
( who knows, it may not be rated for DC-Current at all ).

You have not provided nearly enough information to make it possible
for anyone to provide a truly reliable, and efficient, solution.
.
.
.
 
Top