0
\$\begingroup\$

I have a PCB (SEPARATE PCB) that I want to test by building up a "Test PCB". The test will involve switching the relays. This PCB (SEPARATE PCB) has a few relays on it, however, they do not have any flyback diodes on it.

I am using an Atmega32 to turn on an IRL540 logic MOSFET. I thought by applying a flyback diode across a resistor and an LED on my Test PCB then the voltage spike can be suppressed through my Test PCB instead of the SEPARATE PCB that does not have a flyback diode.

D3 is a 20V Zener diode

I am not PWMing the MOSFET, just using it has a switch.

Is this method okay? If not how do I prevent the spike from the SEPARATE PCB using my Test PCB?

I cannot tamper with the SEPARATE PCB, by adding components to it

Before:

schematic

simulate this circuit – Schematic created using CircuitLab

After:

schematic

simulate this circuit

\$\endgroup\$
7
  • \$\begingroup\$ Is the the same 12V supply on the two boards? \$\endgroup\$ Dec 5, 2021 at 17:59
  • \$\begingroup\$ @KevinWhite not the same 12V supply, however the grounds are common \$\endgroup\$
    – JoeyB
    Dec 5, 2021 at 18:01
  • \$\begingroup\$ Are those 12V on the pcbs provided by the same power supply? D1 is a mid-/high-power LED, right? Other wise 50Ohm is not suitable... \$\endgroup\$
    – Sim Son
    Dec 5, 2021 at 18:02
  • \$\begingroup\$ @SimSon I used the wrong forward current value. I have updated it to 500 ohm now. The 12V source power supplies are different \$\endgroup\$
    – JoeyB
    Dec 5, 2021 at 18:08
  • 3
    \$\begingroup\$ Flyback diodes do not protect the relay (which doesn't need protection), they protect the circuitry switching the relay. \$\endgroup\$
    – Hearth
    Dec 5, 2021 at 18:59

2 Answers 2

4
\$\begingroup\$

Is this method okay? If not how do I prevent the spike from the SEPARATE PCB using my Test PCB?

If you can't modify the relay board then you have fewer options: -

  • A flyback diode as you have shown providing both 12 volt supplies are linked else...
  • A Zener diode (rated at least 3 volts higher than your relay supply voltage) with cathode to M1's drain and anode to 0 volts.
  • A snubber (a resistor in series with a capacitor) across M1 drain and 0 volts

Note that R2 likely is too small in value for a standard LED.

Circuit showing zener and snubber options: -

enter image description here

Put the snubber (or zener) across the MOSFET as close to the MOSFET as you can. The snubber protects the MOSFET so, it should be closest to the MOSFET but, don't worry if it's an inch either way.

A regular parallel diode with the relay (close up) keeps back-emf current local to the relay and, when placed further away, extends the back-emf current loop and can cause EM interference so, it's a compromise in not having that diode directly across the relay coil.

Make sure that if you do opt for the diode to your local positive supply, that power supply should not be too much lower than the relay 12 volts else it'll keep the relay activated when the MOSFET is deactivated. Given all of this, I favour a zener or the snubber.

Watch out for wiring non-idealities that can cause relay or relay load currents to flow into the ATMEGA control and potentially reset it. That is why I suggest a star-point grounding arrangement.

\$\endgroup\$
10
  • \$\begingroup\$ Will the relay input into my PCB, be inserted after the capacitor or before the resistor? \$\endgroup\$
    – JoeyB
    Dec 5, 2021 at 18:15
  • \$\begingroup\$ Yes, snubber across the MOSFET as close to the MOSFET as you can. The snubber protects the MOSFET so, it should be closest to the MOSFET but, don't worry if it's an inch either way. A regular parallel diode with the relay (close up) keeps back-emf current local to the relay and, when placed further away, extends the back-emf current loop and can cause EM interference so, it's a compromise in not putting a diode across the relay coil. \$\endgroup\$
    – Andy aka
    Dec 5, 2021 at 18:30
  • \$\begingroup\$ Make sure that if you do opt for the diode, your MOSFET power supply should not be too much lower than the relay 12 volts else it'll keep the relay activated when the MOSFET is deactivated. Given all of this, I favour a zener or the snubber. \$\endgroup\$
    – Andy aka
    Dec 5, 2021 at 18:32
  • \$\begingroup\$ @JoeyB I've added the circuit. \$\endgroup\$
    – Andy aka
    Dec 5, 2021 at 18:43
  • 1
    \$\begingroup\$ Apart from concerns about grounding (previously discussed), it looks fine joey \$\endgroup\$
    – Andy aka
    Dec 5, 2021 at 21:26
1
\$\begingroup\$

This will work in principle, but:

1: The diode is not to protect the relay, but to protect the switching MOSFET.

2: If the '12V' for the test PCB is lower than the '12V' for the separate PCB, then the relay will turn off very slowly, or may not turn off at all. This is because the flyback diode will allow current to flow from the separate 12 V, through the relay, the diode D2 and into the test 12V.

3: If you (accidentally) disconnect the test 12V supply while the relay is energized, then when the MOSFET turns off, there will be clamping action when the hMOSFET turns off, and it may be damaged.

The most rugged solution is to add a (>> 12 V -- say 20 V) zener diode, and a normal diode in series with it, between drain and gate of M1. This will clamp independently of the test 12V supply.

You could totally eliminate the test 12V supply from your system by taking the cathode of D2 and instead of connecting to the test 12V, connect through a 12 V zener (cathode to cathode) to the gate of M1. Now connect the LED + resistor between the GPIO and GND.

added zener + possible new LED connection

\$\endgroup\$
1
  • \$\begingroup\$ Is it possible to include a schematic of the Circuits you mentioned to remove any ambiguity when connecting it up? \$\endgroup\$
    – JoeyB
    Dec 5, 2021 at 18:37

Your Answer

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

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