Irrigation control - water valve?

Thanks @Artyom_Syomushkin, got it :wink:
Actually I use a FGS-222 already.
But if I need a power supply anyway I will start with the plug (I need one anyway for another project :wink:

@Branden_Smale
I thought about it, but I have a raspberry pi running openhab somewhere else and I don’t want to use another raspi for the open sprinkler setup.

Furthermore for my purpose it’s cheaper:
50 € for switched wall plug,
23 € for water valve
14 € power supply

For a huge garden with multiple irrigation channels you are absolutely right.

I created my own controllers. I used a cheap microcontroller board with wifi (ESP8266) to control an 8 channel relay board. Communication between the microcontrollers and Openhab is done via MQTT. Openhab does all scheduling and weather compensation, the microcontrollers just switch the valves.

Openhab:
Provides user Interface (via dedicated sitemap)
Scheduling
Provides weather delay

Controller:
Programmed in Arduino IDE
Receives on / off commands from Openhab via MQTT
Provides status feedback

The most expensive part was the enclosure

ESP8266 - $4.00
Relay Board $6.50
24VAC power supply - $12.00
Orbit Weatherproof Enclosure - $30.00

Irrigation Controller.pdf (145.4 KB)

1 Like

Hardware wise I setup exactly the same.
I’m very interested how you setup oh side, esp the weather compensation part & timing.
Would you mind sharing the oh side of your setup

@Spilota , what about the valve? It’s one of the most expensive parts.

Would it be possible to also add e.g. a DHT sensor to this board?
I will have my system sitting i a greenhouse in which I would like to monitor temperature/humidity as well.

Valves (12 or 24 V) can be bought for about $5 piece. Here is an example.

Absolutely, This is programmed with the Arduino IDE, so you can do anything with this board that an Arduino can do.

I have tested this with both the DHT22 and ds18b20 sensors on an “official” NodeMCU board. I believe the NodeMCU boards (ESP8266 development boards) provide pinouts for 9 GPIO, so I can fit 8 relays and a temp / humidity sensor. You can probably change functionality of some of the other communication pins to get more IO. The senors log to Openhab via MQTT as well as Thingspeak via wifi. I did have problems with this particular Aliexpress version of the NodeMCU (LoLin) not appearing to support the DHT library. I’m still trying to fix that issue.

As a plus, I can also push OTA firmware updates to the controllers, so no need to plug into a computer to make a change.

The most expensive part of the controller. I have 8 sprinkler and drip zones with (2) valve manifolds. I use typical rainbird valves (~$15) and have probably a couple hundred feet of PVC in the ground, so the rest of the system wasn’t cheap :smile:

Wouldn’t mind at all, I used the wiki as a starting point. I’ll try to put a write up together this evening. Message me if you’d like to see my configuration files. It’s quite a bit of code, too much to post here

@Spilota - i too would be keen to see more of the config/code!
As i use MySensors - id like to use a $20 Rboard https://www.itead.cc/rboard.html as the arduino/relay side, and Openhab for the logic.

Just as a side note - those valves from Ali are quite unreliable. People are installing two-three of those in series to prevent leaks.

Hmm. I will find out soon enough :wink:

Thanks for the info. Do you have any form of encryption enabled on the MQTT communication? Mosquitto and the ESP8266 MQTT client supports ssl as far as I can see, but not the OpenHAB binding.
My concern is that if the WIFI security is breached, then there is open access to control of all MQTT controlled devices on the network!

My philosophy is that is someone wants to come hack into my wifi and mess with my sprinklers then go for it. A) I’m not that important and B) you’re wasting your talent! (Maybe I shouldn’t post that on the internet?)

I do have a watchdog timer programmed into the sprinkler controller that will shut the valve off after a set time period if it doesn’t receive a close command from OpenHab.

Hi @Spilota,

I would be greatly interested in your item and sitemap config for your dedicated weather sitemap as well as your logic to switch the valves.

Your hardware setup sounds great, but it’s far beyond my capabilities (time and brain wise) :smiley:

Based on this thread, I ordered one of the TIAO Raspberry Pi Sprinkler boards and have been using it with OpenSprinkler. It came out to about the same price as a Rachio first gen, but is much more flexible (and fun to tinker with) http://imgur.com/a/U3afk

im glad i could help someone!

Would you share more information about your setup? I’d like to set up something very similar.

My system is based off of the irrigation example on the wiki, I’ve been expanding on this as I get time. I have separate valve stations / controllers in my front and backyard.

Hardware:

  • Raspberry Pi running Openhab
  • (2) NodeMCU ESP8266 development boards (separate boards for frontyard and backyard zones)
  • (2) 8-channel relay boards
  • (2) 24VAC transformer
  • (2) 5VDC power supply (USB)

System Description:

ESP8266

  • Programmed in Arduino
  • Controls sprinkler valves via 8 channel relay board
  • Does not execute sprinkler timing logic, scheduling done in Openhab
  • Receives open / close commands from Openhab
  • Provides status updates to Openhab via MQTT
  • Has “watchdog” timer limiting runtime of any zone, preventing lawn flooding if comms are lost
  • Only one zone can run at a time

Openhab

  • Allows for manual on / off via sitemap
  • Provides (4) programs
  • Provides weather compensation, via wunderground (or weather binding of your choice)

I put a gihub page together to host my files. Openhab files and arduino code are up there.

Source Code - Click Here

This code is pretty messy, I still have a to do list

  • Combine code into function blocks - Suggestions welcome! I didn’t spend the time to figure out how to use functions in openhab rules (suggestions welcome!)
  • Refine weather compensation, make sure run / delay decision is made at run time, not midnight
  • Add items for last runtime of each zone, next scheduled runtime, and last status update received from each controller





7 Likes

I tried to use your code but got some errors MQTTClient. Do you have the library I can use for the MQTT?

I had a slightly simpler approach than the one above using one 24V AC valve and a gardena distributor. Although I don’t have the automatic shutoff that the esp8266 gives you, although if the esp8266 died in mid program that would also not help.

1 Like

Looks like I missed this post, I’m using MQTT by Joel Gaehwiler, version 1.8.0, based on the Eclipse Paho project.

If someone is interested here’s my version, very similar using nodemcu, mqtt and openhab for the control based on the weather

1 Like