TomFisher
Posts: 1
Joined: Tue Nov 27, 2018 11:18 am

Flyback Diodes - Solenoid Valves

Tue Nov 27, 2018 11:28 am

Hi guys,

My first project with the Raspberry Pi involves switching 24v solenoid valves on and off using a relay. Am I correct in thinking I need to use a diode across the solenoid valve? If so - how would I go about speccing this diode? A 1N4001 seems to be commonly used, would this be suitable?

The valves are these: https://uk.rs-online.com/web/p/pneumati ... s/8929993/
and the relay I propose to use is: https://www.amazon.co.uk/SunFounder-Cha ... B00E0NTPP4

Thanks a lot!

Tom

drgeoff
Posts: 9885
Joined: Wed Jan 25, 2012 6:39 pm

Re: Flyback Diodes - Solenoid Valves

Tue Nov 27, 2018 11:57 am

Yes and yes.

(Make sure you get the polarity correct. Band on diode to positive on solenoid,)

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7411
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Flyback Diodes - Solenoid Valves

Tue Nov 27, 2018 12:13 pm

If using a relay then I'd say there was little need for the flyback diode. The potential on one contact of the relay goes up, but that's not going to cause any grief (unless it could get high enough to arc).

If using a transistor then you certainly do need them to avoid blowing up the transistor. The coil side of your relay board already has them fitted as it is relevant there too.

The 1N400x series are certainly the most common diodes used for this sort of thing.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

User avatar
Mortimer
Posts: 923
Joined: Sun Jun 10, 2012 3:57 pm

Re: Flyback Diodes - Solenoid Valves

Tue Nov 27, 2018 1:31 pm

6by9 wrote:
Tue Nov 27, 2018 12:13 pm
If using a relay then I'd say there was little need for the flyback diode. The potential on one contact of the relay goes up, but that's not going to cause any grief (unless it could get high enough to arc).
Surely there will be an arc between the relay contacts every time the contacts are opened (and the circuit is powered of course). Yes this won't destroy the relay as quickly as the back EMF could take out a transistor, but diodes being as cheap as they are why wouldn't you? It should prolong the life of the relay contacts, possibly indefinitely.
--------------
The purpose of a little toe is to ensure you keep your furniture in the right place.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7411
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Flyback Diodes - Solenoid Valves

Tue Nov 27, 2018 1:57 pm

Mortimer wrote:
Tue Nov 27, 2018 1:31 pm
Surely there will be an arc between the relay contacts every time the contacts are opened (and the circuit is powered of course). Yes this won't destroy the relay as quickly as the back EMF could take out a transistor, but diodes being as cheap as they are why wouldn't you? It should prolong the life of the relay contacts, possibly indefinitely.
There's the potential for a very small arc, but I wouldn't expect it to reduce the lifespan significantly.

In this case there is no harm in doing so, but no absolute need. Just don't later switch to the AC version of the solenoid unless you like exploding diodes!
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

User avatar
davidcoton
Posts: 4182
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Flyback Diodes - Solenoid Valves

Tue Nov 27, 2018 2:45 pm

6by9 wrote:
Tue Nov 27, 2018 1:57 pm
Mortimer wrote:
Tue Nov 27, 2018 1:31 pm
Surely there will be an arc between the relay contacts every time the contacts are opened (and the circuit is powered of course). Yes this won't destroy the relay as quickly as the back EMF could take out a transistor, but diodes being as cheap as they are why wouldn't you? It should prolong the life of the relay contacts, possibly indefinitely.
There's the potential for a very small arc, but I wouldn't expect it to reduce the lifespan significantly.

In this case there is no harm in doing so, but no absolute need. Just don't later switch to the AC version of the solenoid unless you like exploding diodes!
The standard wisdom is that back EMF arcing can reduce relay contact life significantly. Back EMF supression diodes should be included as a matter of routine, since they will also reduce EMI if properly fitted directly at the solenoid coil. It also protects against a later revision replacing the relay with a transistor...
Signature retired

jdb
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2116
Joined: Thu Jul 11, 2013 2:37 pm

Re: Flyback Diodes - Solenoid Valves

Tue Nov 27, 2018 3:12 pm

I'm assuming that this is a low-voltage DC solenoid (24Vdc).

Two points of note from someone who used to fix systems using electromechanical components:

Adding a snubber across the solenoid coil is the best method of protecting the control relay contacts. A snubber can either be a diode, RC filter or other more complex arrangement.

Adding a simple anti-parallel diode across the solenoid coil suppresses the additional back EMF to just +1V above the supply voltage, but will considerably increase the "opening" time of whatever it's mechanically connected to. When the relay contact opens, current in the solenoid coil decays as L/R, with the mechanical force proportional to the decaying current. The forward-biased diode is a "small" resistance, so the decay time is large. This causes the solenoid to release far more slowly than if it was simply open-circuited.

An RC filter can be used, but this requires tuning specific to the coil.

A cheap but best-fit solution is to use a diode-zener clamp - add a 10-20V zener diode in series opposition to the standard diode - this increases the effective resistance (and thus speed) of the snubber while clamping the voltage that the relay contacts will be exposed to.

https://electronics.stackexchange.com/q ... r-analysis
Rockets are loud.
https://astro-pi.org

User avatar
joan
Posts: 14354
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Flyback Diodes - Solenoid Valves

Tue Nov 27, 2018 3:27 pm

The linked relay module has all the protection you need. I do not understand why others are saying you need more.

https://www.amazon.co.uk/SunFounder-Cha ... B00E0NTPP4

drgeoff
Posts: 9885
Joined: Wed Jan 25, 2012 6:39 pm

Re: Flyback Diodes - Solenoid Valves

Tue Nov 27, 2018 3:48 pm

:shock:
joan wrote:
Tue Nov 27, 2018 3:27 pm
The linked relay module has all the protection you need. I do not understand why others are saying you need more.

https://www.amazon.co.uk/SunFounder-Cha ... B00E0NTPP4
The relay module has protection for whatever onboard device is driving the relay coil. It does NOT have any protection for the relay contacts.

User avatar
davidcoton
Posts: 4182
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Flyback Diodes - Solenoid Valves

Tue Nov 27, 2018 5:26 pm

jdb wrote:
Tue Nov 27, 2018 3:12 pm
A cheap but best-fit solution is to use a diode-zener clamp - add a 10-20V zener diode in series opposition to the standard diode - this increases the effective resistance (and thus speed) of the snubber while clamping the voltage that the relay contacts will be exposed to.

https://electronics.stackexchange.com/q ... r-analysis
Thank you, I've learnt something!
Signature retired

Return to “General discussion”