Irrigation control - water valve?

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

Here’s my take on OpenHAB Irrigation Automation. I’ve tweaked the Spilota approach of referencing recent past & predicted weather. To that I added final control based on the reading of a home made soil moisture sensor (instead of various timers)

My version uses a Gateway <-> Node approach, but probably could be adapted to an ESP8266 wifi node. See this thread about using & calibrating the soil moisture sensor node. See this thread about irrigation automation that uses the weather data AND the soil moisture sensor node.

Can Rachio or RainMachine be paired with OpenHAB? I’ve tried doing so but failed for unknown reasons.

If anyone has succeed in the pairing process, please, guide me through it. :yum:

Hi Spilota

I tried to set up your way of doing irrigation control with openhab. But I have some difficulties.
I can successfully control the ESP8266 manually with the buttons on the sitemap you have on github.
But with the irrigation program it doesn’t work. I think there is a problem with the irrigation.rules.
First of all I always had an error in the log which was saying:

2018-10-30 22:12:36.523 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘ScheduleProgramA’: The name ‘sendTweet’ cannot be resolved to an item or type; line 203, column 3, length 96

I got rid of that by commenting the sendTweet in the irrigation.rules file with // out.

But it still doesn’t work. In the log I can find:
11-30 22:58:34.009 [INFO ] [rthome.model.script.ScheduleProgramA] - Running Program A Scheduler
2018-11-30 22:58:34.021 [INFO ] [rthome.model.script.ScheduleProgramA] - Scale Factor: 0
2018-11-30 22:58:34.042 [INFO ] [rthome.model.script.ScheduleProgramA] - Start Time: 2018-11-30T22:59:00.000+01:100:

But no command is sent to the ESP8266

Any idea?

Thanks

The sendTweet will not work unless you have the binding installed and configured.

It looks like the scale factor is set to 0. Try setting to 100%.

hi Spilota

my mqtt server requiers a username and password but i have not been sucessful in adding that to the mqtt client i am quite new in arduino and so