Relay – Switching HV DC Relay Crashes Microcontroller


So I´ve designed a PCB for a Pre-/Discharge Circuit for a 400V DC system which is controlled by a STM32 microcontroller.
When powered the program waits for 1s and then starts by switching the (precharge) relay on the PCB and one of the accumulator insulation relays (AIR) to allow current to flow thru a 1k resistor into the capacitors of the system.
After a calculated time the second AIR closes and completes a circuit without the resistor.

When testing the circuit with no connected load everything works just fine but with the accumulator on one side and the load on the other the microcontroller apparently gets stuck in some kind of loop of switching the first relay, then resetting and the relay gets released, and so on.

Below is the basic schematic of how the power supply is handled and the circuit used to switch all relays.

How can I stop the relays from chattering? What is causing this in my circuit?

circuit overview
enter image description here


enter image description here

Best Answer

I would suggest that when the relay closes/opens and makes/breaks the 400 VDC, it may be generating an EM wave that crashes or stops dead your MCU.

I would look into this possibility.

You can try adding snubbers across your relay contacts. These are traditionally an RC network that absorbs the energy that would otherwise arc across the contacts. There may be other, more modern contact suppressors you can try.

It may not be the same reason but for the record...

I had a major problem with a design many years back, where a mechanical relay was switching the mains going to an AC motor. When the relay opened, our microprocessor (MPU) froze completely. There was no bus activity and only cycling the power let the MPU recover. This was a repeatable fault and occurred on six test machines. It took me two days of hunting to find the cause. It was when I tried it with the lights off that I noticed the spark across the relay contacts. The relay actually started switching when the mains had fallen around 80 Vac, not at the full 340-ish V peak of the 240 V mains.

Note that the microprocessor PCB was on one side of an excellently earthed, large (maybe 800 x 600 mm) 4 mm-thick steel plate. The relay was on the other side of the plate, about a foot lower and amongst more earthed steel. All that earthed metal didn't stop the problem.

We needed the complete disconnection of a mechanical relay for other reasons so I designed a board to put an SSR in series with the relay, and therefore with the mains to the motor. The board controlled the timing sequence of the relays (ON was: relay on, wait 10 ms contact travel, SSR on; OFF was: SSR off, 20 ms for mains to cross next 1/2 cycle with margin, relay off). This solved it and we made at least 20,000 units of that machine with no more problems.

Months later, we saw another freeze on the microprocessor when an insulated metal part picked up a large static charge then later touched the earthed steel metalwork. The sparking/touching and discharge into earth knocked the microprocessor over every time. By then, we were on the lookout for it, and earthed the metal part, stopping it charging and fixing the problem. We used a static discharge gun to prove it all, removing and reattaching our earthing strip fix and watching the problem come back and go away.

Related Topic