timpickup
Posts: 2
Joined: Sun Apr 05, 2015 11:57 am

Controlling 6 Solenoid Valves Using Raspberry Pi B?

Sun Apr 05, 2015 12:07 pm

Hi All,

I'm trying to find out how to control 6 solenoid valves from a raspberry pi. Preferably i would like the pi to be linked to a computer where somehow i can make programs which open a certain sequence of solenoid valves.

The application for this is a drinks machine, there will be 6 tubes which will hold the liquids and different drinks will have a different sequence of valves opening and closing. The user will choose which drink they want and it will then run the program for that particular drink...

Is this possible and if so how, i am basic on raspberry pi and have little coding and electronics experience.

Please Help!!

Thanks,

Tim

ame
Posts: 3172
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: Controlling 6 Solenoid Valves Using Raspberry Pi B?

Sun Apr 05, 2015 12:45 pm

timpickup wrote:Hi All,

I'm trying to find out how to control 6 solenoid valves from a raspberry pi. Preferably i would like the pi to be linked to a computer where somehow i can make programs which open a certain sequence of solenoid valves.

The application for this is a drinks machine, there will be 6 tubes which will hold the liquids and different drinks will have a different sequence of valves opening and closing. The user will choose which drink they want and it will then run the program for that particular drink...

Is this possible and if so how, i am basic on raspberry pi and have little coding and electronics experience.
Yes, it can be done.

You need a buffer transistor for each solenoid, or a driver chip with several buffers in it, which can be used to drive several solenoids.

You will probably need to do a bit of wiring, maybe some soldering, but fundamentally the Pi can easily control six solenoids, on and off, under program control. Once the Pi is set up to do this you can send messages from the network from another computer (or smart phone) to control the solenoids remotely.

If you really want to do this then start small (one solenoid) and progress from there. If you've never done it before it will be a bit of a slog, but there is no magic. Just do the work and you'll finish the project.

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

Re: Controlling 6 Solenoid Valves Using Raspberry Pi B?

Sun Apr 05, 2015 1:55 pm

There are several ways to accomplish this:
Here are some:
1. Build your own transistor switching circuits
2. Use a premade relay board such as this: http://www.sainsmart.com/8-channel-dc-5 ... logic.html
3. Use a couple opto isolator chips. https://www.sparkfun.com/products/784

Probably the easiest ..no soldering.. way is to use a relay board. Of course whatever method you choose will require an external power supply rated for whatever is required for the solenoid valves.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

timpickup
Posts: 2
Joined: Sun Apr 05, 2015 11:57 am

Re: Controlling 6 Solenoid Valves Using Raspberry Pi B?

Sun Apr 05, 2015 9:16 pm

This looks really promising!

http://www.sainsmart.com/8-channel-dc-5 ... logic.html

Would i be able to just hook the solenoids up directly to this and then switch them on using an App??

jwatte
Posts: 203
Joined: Sat Aug 13, 2011 7:28 pm

Re: Controlling 6 Solenoid Valves Using Raspberry Pi B?

Sun Apr 05, 2015 9:29 pm

No, you need a buffer between the RPi and that board, because each of the relays draws 20 mA and needs 5V control; RPi only gives you 3.3V, and doesn't like it at all if 8 pins are all drawing 20 mA...

That buffering isn't particularly hard; you could do it with one BS170 transistor and one pull-down resistor per relay. But if you know no electronics at all, you'll probably want something more ready-made.

What are the specs of the solenoid valves? How many volts, how much current?

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

Re: Controlling 6 Solenoid Valves Using Raspberry Pi B?

Sun Apr 05, 2015 10:33 pm

timpickup wrote:This looks really promising!

http://www.sainsmart.com/8-channel-dc-5 ... logic.html

Would i be able to just hook the solenoids up directly to this and then switch them on using an App??
YES The GPIO's can be connected directly to the relay board control lines without a buffer. The board already has the buffer built in.
The GPIO's are 3V3 but when GPIO's are configured for output, they will work fine with most 5V controls.

The 5V required for the relay coils can be taken from the RPi GPIO pin 2 or 4 which are 5V power source (not really GPIO's). The 6 relays, IF all on at the same time, will draw 120mA so that should be OK as long as there are not too many other things attached to the RPi.

As mentioned the solenoids will require as separate power supply.

Yes you need to create an app to control the relays.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

jwatte
Posts: 203
Joined: Sat Aug 13, 2011 7:28 pm

Re: Controlling 6 Solenoid Valves Using Raspberry Pi B?

Mon Apr 06, 2015 12:04 am

Oh - the description didn't make it clear that it was buffered, but the circuit diagram does. I take back my suggestion it wouldn't work.

Return to “Beginners”