# Using Flyback Diodes in Relays Prevents Electrical Noise in Your Circuits

Created: September 8, 2017
Updated: November 25, 2020

Engineers sometimes have the tendency to overcomplicate a problem instead of focusing on simple logical solutions. For example, my friend’s motorcycle broke down and he spent hours checking on the battery, carburetor, and electrical system. It turns out that this was all done in vain. We were pretty amused to find out that this mayhem was caused by a faulty fuel indicator that let his fuel tank run empty.

In electronics, what might seem like a large problem can sometimes have an easy solution. For example, when designing PCBs that have mechanical relays, you can avoid large voltage spikes and provide relay noise suppression by adding a flyback diode relay to your circuit. However, when you have placed one on a relay diode for flyback protection and your controller still keeps resetting, you might need to consider other sources of electrical noise. Like my friend’s motorcycle issue, oftentimes these sources are hiding in plain sight and can be solved with the same noise-reducing techniques you’ve applied to your design. Here’s why and how you can use freewheeling diodes to reduce EMI in your relays, and what you should consider if your design is part of a larger system.

## What Is a Flyback Diode and Why You Need It

So how does a flyback diode protect a circuit? If you’ve been creating printed circuit boards that feature mechanical relays, then you probably have heard of flyback diode relays. A flyback diode is placed with reverse polarity from the power supply and in parallel to the relay’s inductance coil. The use of a flyback diode in a relay circuit prevents huge voltage spikes from arising when the power supply is disconnected. They are sometimes called flywheel diodes, freewheeling diodes, relay diodes, or snubber diodes.

### Why Put a Diode Across a Relay Coil?

When the power supply is connected to the relay diode protection, the inductance coil’s voltage builds up to match that of the power source. The speed at which current can change in an inductor is limited by its time constant. In this case, the time it takes to minimize current flow through the coil is longer than the time it takes for the power supply to be removed. Upon disconnection, the inductive load in the coil reverses its polarity in an attempt to keep the current flowing according to its dissipation curve (i.e., % of maximum current flow with respect to time). This causes a huge voltage potential to build up on the open junctions of the component that controls the relay.

This voltage built-up is called flyback voltage. It can result in an electrical arc and damage the components controlling the relay. It can also introduce electrical noise that can couple into adjacent signals or power connections and cause microcontrollers to crash or reset. If you have an electronics control panel that resets each time a relay is de-energized, it’s highly possible you have an issue with flyback voltage.

To mitigate this issue, a diode is connected with reverse polarity to the power supply. Placing a diode across a relay coil passes the back electromagnetic field and its current through the diode when the relay is energized as the back EMF drives the flyback protection diode in forward bias. When the power supply is removed, the voltage polarity on the coil is inverted, and a current loop forms between the relay coil and protection diode; the diode again becomes forward-biased. The freewheeling diode allows current to pass with minimal resistance and prevents flyback voltage from building up, hence the name flyback diode relay.

Tiny flyback diodes prevent huge flyback voltage from damaging your components.

### Wiring for Relay Noise Suppression

The placement of a flyback protection diode is rather simple; it should be placed directly across the relay's coil. A schematic for a relay's flyback diode circuit is shown below. In this schematic, the resistor R in parallel with the flyback diode wiring represents the coil's intrinsic DC resistance.

Flyback diode wiring in a relay circuit.

Note that the placement of the flyback diode does not prevent a voltage spike from traveling to some downstream load. Instead, it provides a path with low resistance that reroutes the current, thus the voltage spike at the downstream load will be much lower. Using a simple 1N4007 diode is sufficient to suppress large voltage spikes in a 24VDC relay with a diode protection circuit.

The current path in the flyback diode depends on whether the switch in the relay is closed or opened. As the switch is initially closed, the inductor load generates a back electromagnetic field as its transient response, and the voltage slowly rises to the supply voltage value. Once the switch is opened, the back electromagnetic field created by the inductor switches direction and points toward the ground, creating a transient response that slowly dies off. Thanks to the low resistance loop created by the flyback diode in forward bias, the current is diverted through the diode rather than creating a large voltage spike elsewhere in the circuit.

Current flow through the flyback diode wiring in a relay circuit.

## How Electrical Noise Can Interfere with Your Electronics Despite OnBoard Flyback Diodes

You might have thought that placing flyback diodes in a relay circuit will solve all your electrical noise issues. That’s what I used to believe until I faced a mind-boggling issue when a humidity controller that I designed was constantly resetting. This was despite the fact that I used every relay with a diode protection circuit.

The humidity controller was connected to external mechanical relays that controlled industrial heating elements. This routine project turned into a witch hunt for the problem causing the controller to reset. When you have tens of similar setups showing the same symptoms, it’s easy to assume that you’ve messed up the product design.

After hours of trying out various power supplies, cables, grounding methods, and electromagnetic interference (EMI) foil, it finally dawned upon me that perhaps it was the external mechanical relays that were causing the problem. True to my suspicion, none of the external relays installed by the third party had a flyback diode circuit connected in parallel to their inductance coils. The resulting flyback voltages caused electrical interference over the connecting cable and into the humidity controller, thus causing the system to reset.

While you have little control over electrical installations performed by the third party, there is no excuse for not adhering to best practices with flyback diodes in your PCB. For a start, you’ll want to make sure the corresponding forward current of the flyback diode is larger than that of the coil when brought into forward bias by the coil's electro-magnetic field. Also, choose a flyback diode that has a reverse voltage that’s higher than the coil’s voltage rating.

The absence of a freewheeling diode can be your electrical nightmare.

In my practice, I place the flyback diodes as close as possible to the relay. A typical 1N4007 diode serves me well in most applications and it saves me from the problem of having to manually create footprints. More so, having a good bill of material software, like Altium Designer’s management tool, makes managing their lifecycle and availability a breeze. This is particularly useful when I repurpose older designs.

Still, wondering how a diode protects a circuit? Have a question about flyback, freewheeling, or flywheel diodes? Contact an expert at Altium Designer.

## Related Technical Documentation

Thank you, you are now subscribed to updates.