7

Here's what I'm looking to do and I'm having a hard time wrapping my head around the electrical/wiring part of this:

I have a 1" PVC pipe. I want to put a valve inline with this pipe and with my Raspberry Pi 2 I want to be able to open and close this valve. I'm guessing the type of valve I'll want to use is something like this.

Obviously that takes 110 volts, so the power source wouldn't be the pi. I have 120 volts run to the same area which I imagine I would use to control the valve (for the power source).

How does the pi fit in this place? How exactly could I wire this up so that a signal from a GPIO could switch this valve on/off?

3
  • 5
    You would use a Pi GPIO to switch a relay which would switch the 110V. That would isolate the Pi from dangerous voltages. Just do a site search for using a Pi to switch a relay. – joan Mar 3 '16 at 21:59
  • @joan makes total sense, thank you! Something like this? Would that handle a 120V circuit? amazon.com/gp/aw/d/B00P7QDJD2/… looks like it would take the 5V RPI2 for the controller circuit..? – Thomas Stringer Mar 4 '16 at 2:52
  • Probably. I couldn't see the ratings. They usually quote a maximum AC switching voltage and current and a DC switching voltage and current. Just make sure it's high enough for your 120V (AC?) circuit. There are two other considerations 1) the voltage needed to latch the relay coils, normally quoted as 5V or 12V. You need at most 5V if you power via the Pi. 2) the voltage needed to trigger the relay logic circuitry, you need at most 3V3 as that matches the Pi GPIO. You just need to make sure that is okay for the relay you choose. One which mentions RPi compatibility will be fine. – joan Mar 4 '16 at 8:52
4

Use a Solid State Relay for 10 bucks like: This here You control it from Rpi GPIO ports and is isolated from the outlet and is compatible with Rpi outputs. Has also a LED which shows the status of the relay. enter image description here

2

The Raspberry Pi is the brain.

The relay is the muscle.

The brain sends low voltage signals (5v) to the relay, which trigger it to contract (by using a coil) - This flips a mechanical switch (which isolates 120VAC to 5V) and turns on the 120VAC to the valve.

You must always isolate high voltage from low voltage by using relays, octocouplers, transistors, etc.

Connecting 120VAC to the brain equals death.

*Don't mean to be sarcastic with the answer but this is great way to understand the basics. Another way is to find a book about basic electronics, basic home automation, embedded circuits and similar. You can find allot of free books but spending a few bucks on a well rated book or two, is knowledge that will stay with you for the rest of your life. Priceless.

1

Here is something that may be more directly usable.. already has an optoisolator for protection:

1
1

Controllable 4-outlet power relay, driven by a very low current 12VDC line. Perfect for the job if you're using a 120V valve. https://www.adafruit.com/product/2935

However, there are 12VDC water valves that will eliminate the need for the intermediate 120V relay and you can then use a smaller relay HAT, a GertBoard, or something like that to switch it on and off. Like this: https://www.adafruit.com/product/997

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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