1
\$\begingroup\$

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

\$\endgroup\$
16
  • \$\begingroup\$ Does the problem manifest only when switching a load or does it reset with just the relay operating? If the former, what exactly is the load? \$\endgroup\$ Jun 5, 2015 at 18:52
  • \$\begingroup\$ Only at the time of switching. \$\endgroup\$
    – eetest
    Jun 5, 2015 at 18:53
  • \$\begingroup\$ Switching what? \$\endgroup\$ Jun 5, 2015 at 18:56
  • \$\begingroup\$ switching the relay control pin i.e turn on the bjt by applying 5v. \$\endgroup\$
    – eetest
    Jun 5, 2015 at 18:57
  • \$\begingroup\$ Spike up or spike down? Does the supply voltage increase above 9V? What current does the relay draw? \$\endgroup\$
    – jippie
    Jun 5, 2015 at 19:00

3 Answers 3

2
\$\begingroup\$

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

\$\endgroup\$
3
  • \$\begingroup\$ thanks for your answer. I do not have any R4 and mcu output pin activates Q1 in my circuit besides that my circuit is the same as you drew. I currently increased c3 value to 10uf I observe the resets have decreased so far. maybe I will increase it more to have a more stable circuit. \$\endgroup\$
    – eetest
    Jun 6, 2015 at 21:01
  • \$\begingroup\$ R4 is only there to simulate the load that your MCU would put on the 5V rail, and S1 simulates an MCU I/O by sending 5 volts to R2 in order to turn on Q1 and energize the relay. By the way, how much current does your MCU need when it's running full-bore? \$\endgroup\$
    – EM Fields
    Jun 6, 2015 at 22:50
  • \$\begingroup\$ at most when relay is on a total of less than 50 mA. \$\endgroup\$
    – eetest
    Jun 8, 2015 at 5:32
1
\$\begingroup\$

I bet the 0V line also spikes when the relay switches because how can you expect to use an o-scope to measure a line that is "kind-of" but still irregularly connected with an earth a few hundred metres away at a substation.

The average o-scope measures with respect to a local wall-socket earth and both the 0V (derived from live/neutral) AND the 12V (same way) are going to be wobbling up and down together when the 500 watt load switches.

Try using two o-scope channels and measuring the differential between "12V" and "0V".

\$\endgroup\$
1
  • \$\begingroup\$ I already used differential measurement. \$\endgroup\$
    – eetest
    Jun 5, 2015 at 20:04
1
\$\begingroup\$

I have no confidence whatsoever that your oscilloscope measurement reflects anything of value other than the fact there is EMI being generated when the contacts switch.

The EMI at the contacts can be coupled through the relay coil-to-contact capacitance or by other means. The microcontroller circuit can bounce around with respect to earth and that can be coupled into the reset pin, other pins or even the power supply if the layout or bypassing is inadequate. Things as simple as a cap on the reset pin, a 4-layer board with ground and power planes, reversing the N.O. and COM on the relay, screening the chip, protecting pins that go off board etc. can fix this. Some micros are just better than others.. those used in appliance applications (eg. ST) tend to be more immune.

As @EM has shown you, there is no theoretical reason that can be inferred from your description that this should be happening, yet it is. If you want to pursue this from a theoretical angle, get one of the many books on mitigating EMC problems. By the way, you'll probably see a spike on the scope under a lot of unlikely conditions besides this one- play with it to learn when to distrust the scope.

Another take-away from this answer is the root cause of the EMI, which is that there is inductance (probably not shown in your simplified schematic representation) in the power wires to your 500W heater. When the contacts open or bounce on closing this forms a spark-gap transmitter creating strong bursts of RF typically in the AM radio band.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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