Carp
Posts: 7
Joined: Fri Jun 07, 2013 9:12 pm

Solenoid valve operation

Wed Jun 22, 2016 6:36 pm

Hey there,

I am wanting to operate a 24v solenoid valve using the raspberry Pi. Can someone give me a suggestion on how to do this?

https://www.orbitonline.com/site_files/ ... cation.pdf

klricks
Posts: 7211
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Solenoid valve operation

Wed Jun 22, 2016 7:47 pm

You will need a relay board.
If you don't already have 24V available then you will need a 24VAC transformer.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

boyoh
Posts: 1490
Joined: Fri Nov 23, 2012 3:30 pm
Location: Selby. North Yorkshire .UK

Re: Solenoid valve operation

Wed Jun 22, 2016 8:46 pm

Carp wrote:Hey there,

I am wanting to operate a 24v solenoid valve using the raspberry Pi. Can someone give me a suggestion on how to do this?

https://www.orbitonline.com/site_files/ ... cation.pdf
24vac-------( N/O )-------Solenoid---Nac
(5v+-------( Relay )--------------------c
GPIO3.3v -----( 270r )---------- b 2n2222
( 0v---------------------------------------e

( ( k Diode a )
5v+-----------( + Relay - )---------- c

Transistor 2n2222

N/O = normally Open contacts ( On Relay)

Diode across Relay coil to divert Inductive energy
From coil winding,when relay switching off ( I will explain more later )
The Diode Is connected reverse biased
BoyOh ( Selby, North Yorkshire.UK)
Some Times Right Some Times Wrong

gordon77
Posts: 5133
Joined: Sun Aug 05, 2012 3:12 pm

Re: Solenoid valve operation

Wed Jun 22, 2016 8:51 pm

You could use an opto relay, eg LCA710, connected to a gpio output through a 300 ohm resistor.
Wire it for AC operation.

http://uk.farnell.com/clare/lca710/rela ... tch|p|plid|
Attachments
IMG_20160622_215502.jpg
IMG_20160622_215502.jpg (14.05 KiB) Viewed 3747 times

klricks
Posts: 7211
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Solenoid valve operation

Wed Jun 22, 2016 9:41 pm

boyoh wrote:
Carp wrote:Hey there,

I am wanting to operate a 24v solenoid valve using the raspberry Pi. Can someone give me a suggestion on how to do this?

https://www.orbitonline.com/site_files/ ... cation.pdf
24vac-------( N/O )-------Solenoid---Nac
(5v+-------( Relay )--------------------c
GPIO3.3v -----( 270r )---------- b 2n2222
( 0v---------------------------------------e

( ( k Diode a )
5v+-----------( + Relay - )---------- c

Transistor 2n2222

N/O = normally Open contacts ( On Relay)

Diode across Relay coil to divert Inductive energy
From coil winding,when relay switching off ( I will explain more later )
The Diode Is connected reverse biased
Most relay boards have the control logic..... transistor or opto isolater and back EMF diode included. Plus wiring terminals and indicator LED.
Only a 'raw' relay would need those components added.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

geoffr
Posts: 89
Joined: Wed Aug 22, 2012 11:25 am
Location: Melbourne, VIC

Re: Solenoid valve operation

Thu Jun 23, 2016 3:12 am

boyoh wrote:
Carp wrote:Hey there,

I am wanting to operate a 24v solenoid valve using the raspberry Pi. Can someone give me a suggestion on how to do this?

https://www.orbitonline.com/site_files/ ... cation.pdf
....
Diode across Relay coil to divert Inductive energy
From coil winding,when relay switching off ( I will explain more later )
The Diode Is connected reverse biased
If you are looking to build your own, rather than just hook up a relay board, some of the commonly available Darlington transistor arrays can work out as a very easy way to drive relays.

What you need to keep in mind is that the raspberry pi's GPIO pins are running at 3.3V, and can't source much current. - This has essentially been covered by the recommendations in this thread to use a transistor to drive the relay. - Most relays need to be driven with at least 5V.
Darlington transistor arrays like the ULN2803A also have integrated flyback diodes to cater for inductive loads like relays. - That reduces the number of discrete components you need if you are building your own relay board.

boyoh
Posts: 1490
Joined: Fri Nov 23, 2012 3:30 pm
Location: Selby. North Yorkshire .UK

Re: Solenoid valve operation

Thu Jun 23, 2016 2:06 pm

boyoh wrote:
Carp wrote:Hey there,

I am wanting to operate a 24v solenoid valve using the raspberry Pi. Can someone give me a suggestion on how to do this?

https://www.orbitonline.com/site_files/ ... cation.pdf
24vac-------( N/O )-------Solenoid---Nac
(5v+-------( Relay )--------------------c
GPIO3.3v -----( 270r )---------- b 2n2222
( 0v---------------------------------------e

( ( k Diode a )
5v+-----------( + Relay - )---------- c

Transistor 2n2222

N/O = normally Open contacts ( On Relay)

Diode across Relay coil to divert Inductive energy
From coil winding,when relay switching off ( I will explain more later )
The Diode Is connected reverse biased
I said I would explain why a Diode is connected reverse biased across the relay coil
When a EMF is applied to a copper coil with a Iron core , It magnetizes the iron core
This then allows It to act as a mechanical actuator for the relay contacts.

When the applied EMF is switched off , this leaves the Iron core with a lot of
Magnetic energy stored in It, This magnetic energy will collapse back into the copper coil
Creating a high EMF amplified by the number of copper turns of the coil, many times
Greater than the applied EMF, This high back EMF can damage components in Its reverse
Path, The Diode will divert the high EMF back through the coil until it is burnt up, witch is
Very quick
BoyOh ( Selby, North Yorkshire.UK)
Some Times Right Some Times Wrong

Massi
Posts: 1691
Joined: Fri May 02, 2014 1:52 pm
Location: Italy

Re: Solenoid valve operation

Thu Jun 23, 2016 3:03 pm

klricks wrote:Most relay boards have the control logic..... transistor or opto isolater and back EMF diode included. Plus wiring terminals and indicator LED.
Only a 'raw' relay would need those components added.
What you say is correct.
more or lesse, every "good" relay board has those components. Even the diode.

BUT

you have to consider that in this case we have TWO solenoids.
One is the relay coil
One is the solenoid valve.
no relay board at all has a diode on the load connectors.

And i can assure you that the problem with a solenoid valve is present and is big.

In my case, i solved putting a capacitor on load connectors, but it should be ok (probably even better) putting a reverse diode on the solenoid valve contacts

boyoh
Posts: 1490
Joined: Fri Nov 23, 2012 3:30 pm
Location: Selby. North Yorkshire .UK

Re: Solenoid valve operation

Thu Jun 23, 2016 4:04 pm

Massi wrote:
klricks wrote:Most relay boards have the control logic..... transistor or opto isolater and back EMF diode included. Plus wiring terminals and indicator LED.
Only a 'raw' relay would need those components added.
What you say is correct.
more or lesse, every "good" relay board has those components. Even the diode.

BUT

you have to consider that in this case we have TWO solenoids.
One is the relay coil
One is the solenoid valve.
no relay board at all has a diode on the load connectors.

And i can assure you that the problem with a solenoid valve is present and is big.

In my case, i solved putting a capacitor on load connectors, but it should be ok (probably even better) putting a reverse diode on the solenoid valve contacts
Please correct me if I'm wrong But is the Solenoid 24vAC.
Putting a Diode across the Solenoid , would only give it Half Wave
And short the other half cycle out

I'm basing this on the first post 24vac Solenoid

Please correct me if I'm wrong
BoyOh ( Selby, North Yorkshire.UK)
Some Times Right Some Times Wrong

Massi
Posts: 1691
Joined: Fri May 02, 2014 1:52 pm
Location: Italy

Re: Solenoid valve operation

Thu Jun 23, 2016 7:48 pm

lol my fault, i just saw "24V solenoid valve" in the first post and did not open the link..

my solenoid valve is 12V dc and emits like a beast :)

i'm so sorry!

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

Re: Solenoid valve operation

Thu Jun 23, 2016 7:50 pm

The OP says 24V without specifying AC or DC.
klricks suggested a 24VAC supply.
Personally I would expect the solenoid to require DC, in which case a reverse diode is recommended. AC is far more of a problem.

We need more information (maybe that should be a standard footer?)
Location: 345th cell on the right of the 210th row of L2 cache

klricks
Posts: 7211
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Solenoid valve operation

Thu Jun 23, 2016 9:35 pm

davidcoton wrote:The OP says 24V without specifying AC or DC.
klricks suggested a 24VAC supply.
Personally I would expect the solenoid to require DC, in which case a reverse diode is recommended. AC is far more of a problem.

We need more information (maybe that should be a standard footer?)
I said AC based on the link in the OP. The 24VAC is typical for all the irrigation valves I have worked with. You don't have to worry about polarization of the solenoid wires.

Arcing across the relay contacts is possibly a problem which I believe a capacitor will help.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

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

Re: Solenoid valve operation

Thu Jun 23, 2016 10:10 pm

Apologies, I missed the link which does specify 24VAC. A diode across the coil will not be suitable, so a capacitor it is. I have no idea of a typical value, though.
Location: 345th cell on the right of the 210th row of L2 cache

boyoh
Posts: 1490
Joined: Fri Nov 23, 2012 3:30 pm
Location: Selby. North Yorkshire .UK

Re: Solenoid valve operation

Thu Jun 23, 2016 10:23 pm

Massi wrote:lol my fault, i just saw "24V solenoid valve" in the first post and did not open the link..

my solenoid valve is 12V dc and emits like a beast :)

i'm so sorry!
Thank you Regards BoyOh
BoyOh ( Selby, North Yorkshire.UK)
Some Times Right Some Times Wrong

Carp
Posts: 7
Joined: Fri Jun 07, 2013 9:12 pm

Re: Solenoid valve operation

Fri Jun 24, 2016 8:09 pm

Thank you for all the replies! O really appreciate it. I'm sorry I wasn't more clear on what I wanted to do.

Is there some type of relay that will allow me to raise a pin on the Pi and put out 24VAC on the other end?

Thank you.

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

Re: Solenoid valve operation

Fri Jun 24, 2016 8:48 pm

Carp wrote:Thank you for all the replies! O really appreciate it. I'm sorry I wasn't more clear on what I wanted to do.

Is there some type of relay that will allow me to raise a pin on the Pi and put out 24VAC on the other end?

Thank you.
You will need to but a relay board with however many relays you need (one for each solenoid). Get one designed for Pi from a Pi supplier. That way there will be no problem with Pi compatibility or with the circuit on the Pi side. Usually they take a 5V supply from the Pi to activate the relays. Look for a 24VAC 0.5A contact rating (both are minimums). The 24VAC supply is a separate item, as is the spark suppression capacitor referred to earlier (which should be mounted at the solenoid). I don't think you will find a relay board with a 24VAC supply built in.
Location: 345th cell on the right of the 210th row of L2 cache

Carp
Posts: 7
Joined: Fri Jun 07, 2013 9:12 pm

Re: Solenoid valve operation

Mon Jun 27, 2016 4:47 pm

What supplier could make this board for me? Thanks.

klricks
Posts: 7211
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Solenoid valve operation

Mon Jun 27, 2016 5:57 pm

Carp wrote:What supplier could make this board for me? Thanks.
There are many. If you need 2 relays then Google [2 channel 5V relay] etc.
As mentioned if you don't have 24VAC available then you will also need to purchase a 24VAC transformer.

You should also Google for tutorials about using relay boards with the RPi and get a thorough understanding of how relay circuits work before beginning your project. The transformer will need to be connected to mains power.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

jardino
Posts: 131
Joined: Wed Aug 08, 2012 9:03 am
Location: Aberdeenshire, Scotland

Re: Solenoid valve operation

Mon Jun 27, 2016 8:41 pm

davidcoton wrote:
Carp wrote:Thank you for all the replies! O really appreciate it. I'm sorry I wasn't more clear on what I wanted to do.

Is there some type of relay that will allow me to raise a pin on the Pi and put out 24VAC on the other end?

Thank you.
Have a look at this new product from ModMyPi:

http://www.modmypi.com/raspberry-pi/bre ... elay-board .

It has 4 relay outputs rated to handle mains power.

I'm happy with the one I bought recently, though I'm only using it to drive 12 V DC circuits.

Cheers,
Alan.
IT Background: Honeywell H2000 ... CA Naked Mini ... Sinclair QL ... WinTel ... Linux ... Raspberry Pi.


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

Re: Solenoid valve operation

Tue Jun 28, 2016 8:38 am

Carp wrote:http://www.supplyhouse.com/Rheem-SP1055 ... AquL8P8HAQ

Will this transformer work?
That will handle up to eight solenoids (as specified in your OP) as long as they switch on one at a time.
Location: 345th cell on the right of the 210th row of L2 cache

klricks
Posts: 7211
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Solenoid valve operation

Tue Jun 28, 2016 5:08 pm

Carp wrote:http://www.supplyhouse.com/Rheem-SP1055 ... AquL8P8HAQ

Will this transformer work?
There are also 'wall wart' power supplies that could work: http://www.markertek.com/product/evf-ad ... fgodHVgJmA
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

Return to “General discussion”