I was looking for a way to control a sprinkler in my yard that was simple and cheap.
I ran across the Orbit 58874N, which is a valve that plugs into a controller unit, which in turn lets you set timers etc. https://www.amazon.ca/gp/product/B003LY4I2I/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1
I thought I would try to see if I could make the valve function by itself (i.e. without the controller). It has a two-pin plug on it that plugs into the controller, so I started playing with actuating it.
My initial assumptions for how it worked were wrong (I assumed current on = open, current off = closed), but I managed to figure out that applying a momentary 12v DC current in one polarity opens it (at which time it locks open), and a momentary 12v DC current in the other polarity closes it (and locks it).
I put together an ESP8266, 12v DC power supply, and dual-relay hat, together with Tasmota, to control it. The dual relays are needed to be able to reverse the current polarity while using only one power supply.
I set up Tasmota with two physical momentary switches (i.e. switch with corresponding relay), one for ‘open solenoid’ and one for ‘close solenoid’, and one virtual switch (i.e. switch with no relay), for water on/off. I programmed rules in Tasmota so that the two physical relays could never be actuated at the same time. The third switch acts as the ‘keeper’ of the state of the valve (remember the physical switches are momentary so they go back to an off state after they are actuated). Setting the value of the third switch required more rules to set it’s value each time one of the physical switches is triggered. This third switch is also the entity that is controlled from Home Assistant and turns the water flow on and off (Tasmota rule so that if the state of this switch changes it actuates one or the other of the physical switches).
I ran a 22 gauge two conductor wire from the relays out through the hole in the wall that the water line passes through, and attached it to the valve outside. The ESP, relays and power adapters are all safe inside the house.
- I tried using a buck converter to power the ESP and the solenoid at the same time from one 12v power supply, but the load from the solenoid was too great (or at least came on too fast) and caused the ESP to reboot each time the solenoid actuated. There’s probably a way to put a capacitor inline and stop this, or use a better power supply, but it was what I had
- The solenoid in the valve, like any solenoid, will heat if power is continually applied to it. I set the actuation to be for 1 second in Tasmota (relay closed, 1s, relay open) to protect the solenoid
- You could do all the rules in Home Assistant as automations rather than Tasmota, but this seems like a case if there ever was one for edge processing
- With the way this works (and indeed even if you bought the official controller), there isn’t a ‘fail to off’ scenario, so if you lose power or anything breaks (ESP or relays) your water might stay on
- There is probably a better way to reverse current, but again this is what I had on hand (and I was going on holidays)
Sorry if this is a bit vague - I’m working from memory but wanted to post this because it is a simple solution and has worked really well so far. I can post the rules of someone wants, but I’m remote right now and can’t get into the ESP.
Hope this is useful.