Electronic – Relay Spike at Vdd

diodesflybackmicrocontrollerrelay

I have a problem with voltage suppression at the time of relay switching.

I use a transformerless ac to 12v dc conversion circuit similar to (I use 12V zener and 470uf capacitor) :

enter image description here
![enter image description here][2]

and my relay is set up as exactly like:

enter image description here

When I turn on the relay I see a spike in my 12v dc (not at the bjt collector but at the vdd). This causes my microcontroller to reset.

How can I supress that Vdd spike?

Thanks in advance.

The 12V to 5V converter is below:

enter image description here

Best Answer

I redrew your circuit as an LTspice schematic., below, and I think I got it right.

I'm assuming that you're turning on the relay with current into the base of Q1 from your MCU, represented here by S1 and R4, R4 being the MCU load on the 5 volt supply, and S1 an I/O.

I also assumed that the relay is one of those garden variety 400 milliwatt coil jobs with a closed inductance of 10 henrys and a series resistance (not shown on this schematic) of 330 ohms.

enter image description here

If you want to run the simulation, the file is here

If you run it you'll see that the 5 volt supply is nice and clean, that the relay switches properly and doesn't load the 12 volt rail to the point where it affects the 5 volt rail, and that the relay coil's turnoff spike is nicely shunted to the 12 volt rail with no voltage overshoot, and that it doesn't even faze the 5 volt supply.

With that in mind, I'd be suspicious of layout causing your MCU to reset, particularly the RF burst @Spehro mentioned.

As an aside, R1 dissipates about a watt, so if I were building this I'd go for one of those nice little Panasonic 2 watt metal-film power resistors you can find here

Related Topic