this post was submitted on 26 Nov 2023
1 points (100.0% liked)

Home Automation

79 readers
2 users here now

Home automation is the residential extension of building automation.

It is automation of the home, housework or household activity.

Home automation may include centralized control of lighting, HVAC (heating, ventilation and air conditioning), appliances, security locks of gates and doors and other systems, to provide improved convenience, comfort, energy efficiency and security.

Warning: Working with electricity can result in injury, property damage, or even death if it is not done properly. Please keep this in mind while assisting others. If you are not sure about what you are doing, hire a licensed professional.

Rules

founded 1 year ago
MODERATORS
 

So I’ve been making this project where a micro:bit sends soil moisture and temperature data to a raspberry pi, and I would like the pi to open and close a 3-wire normally closed ball valve based on certain moisture and temperature thresholds. I am receiving data from the micro:bit, but I’m really struggling to figure out how to open and close the valve. Maybe my wiring is wrong? I am using a single channel relay with connected wires to these pi pins: GPIO 17, GND, and 5V. I am using a 3-wire normally closed U.S. Solid ball valve. I have the yellow wire connected to the negative pole of a 12V AC/DC power adapter, the red wire connected to the normally open port of the relay, and the blue wire connected to the normally closed port of the relay. I have a separate wire connecting the positive pole of the power source to the common connection port of the relay. Please let me know if this wiring is correct! After I have the wiring set up correctly, any assistance with setting up code to allow the pi to send a signal to the relay to open and close the valve would be greatly appreciated.

top 2 comments
sorted by: hot top controversial new old
[–] [email protected] 1 points 11 months ago

What's the coil voltage on your relay? Also is this a raw relay or one on a PCB with a diode, etc?

It sounds like your relay wiring might be a little messed up. Assuming you don't have the auto return model, according to documentation on the US Solid site:

How to wire this valve?
In direct current (DC) situations, the red wire is connected to the positive terminal, and the blue wire is connected to the negative terminal. The valve opens when the yellow wire is simultaneously connected to the positive terminal with the red wire, and the valve closes when the yellow wire is disconnected and the red wire is connected to the positive terminal alone. This means that the red and blue wires are always connected to the positive and negative poles, respectively, and the valve is controlled by parallel or disconnection of the third yellow wire with the red wire.

So for that you want Red to the Positive on your 12 volt PSU, blue to the ground, and then the yellow on the NC or NO connection on the relay, with the common on the relay tied to +12VDC.

Check out Node-Red if you want an easy way to program on the PI and interact with the GPIO.

[–] [email protected] 1 points 11 months ago

Watch out on the Pi I believe the GPIO are not 5v tolerant ( 3.3v only). Also the current drive is probably not enough for the relay coil. A simple N-FET of suitable size and a resistor would solve this. 10k from GPIO to the FET gate and the FET on Source on the ground side Drain to the relay. Diode across the relay for EMF if the relay does not have one internally.