rickyh89
Posts: 55
Joined: Mon Jun 18, 2018 11:01 pm

Irrigation design

Mon Jul 16, 2018 11:04 pm

Hey, i have been looking into using wireless sensors and came across using MQTT. After seeing how cool that is i began rethinking my design for irrigation setup. I am looking for a design that i can easily reproduce and expand. i made a couple drawings to give you guys a gist of what i am trying to accomplish...

As of right now i already have my system finished and working with just water counter, solenoids, relays and a GUI with tkinter i made to manually feed plants (viewtopic.php?f=37&t=216270&p=1330002#p1330002). I am adding moisture sensors to my existing setup to allow full automation. With my current setup i do not need wireless sensors, the relay boards i have that attach onto my Rpi have additional input/output pins --- https://www.sequentmicrosystems.com/ind ... egaio.html

Onto my actual point in this post... refer to my attachments you will see i want to use multiple RPI to control a large area and many sensors/solenoids. a friend of mine is going to use my system inside his building (5000 + sqft). My current system i need to run wiring to every single solenoid (2), every single soil sensor (2), a relay for each solenoid (8 per board / max 32 per RPI). So you can see how using just one RPI to control it all would be a disaster wiring wise and would max out with relays pretty quickly.

A ESP8266 got me thinking that would work perfectly however, i would still have to run wires to the solenoid from the RPI as the ESP8266 would be unrealistic to use with 8+ relays, mine as well just use a RPI and seperate the building into "quadrants" each section would have a RPI with on board relays and the pins to connect the soil sensors. no need even for a breadboard. Example would be 1 RPI with relay board attached controlling 8 solenoids with 8 soil moisture sensors. Then just copy that setup for each "quadrant". The final RPI would control the reservoir, counter, pump, mixing nutrients and receiving the input from other RPI moisture sensors to tell when to feed. Obviously during the feeding process the solenoids would turn on/off based on the water meter.

The only downfall i can think of is the delay with main RPI counting water and telling another RPI to close a solenoid and open the next. Honestly not sure how much of a delay would exist to send message using MQTT. Hopefully my pictures work and you also understand my giberish lol
0734301001531782615_rpi-2.png_0.png
0734301001531782615_rpi-2.png_0.png (43.67 KiB) Viewed 417 times

rickyh89
Posts: 55
Joined: Mon Jun 18, 2018 11:01 pm

Re: Irrigation design

Mon Jul 16, 2018 11:28 pm

This is my existing setup. 1 RPI controls everything. This is not realistic to expand with even though it works.
0047143001531783540_rpi-1.png_0.png
0047143001531783540_rpi-1.png_0.png (43.03 KiB) Viewed 415 times

User avatar
bill z
Posts: 4
Joined: Mon Jun 15, 2015 6:59 pm
Location: Spring, Texas, USA

Re: Irrigation design

Thu Aug 30, 2018 11:30 pm

Your porject caught my attention. It looks like something I can use in West Texas for an unattended watering system to grow grass.

However, I’m new to Raspberry PIs (not new to electronics, networking or programming).

Because so many RPIs / sensors & solenoids would be required is there a cheaper way? would RPI Zeros work better or maybe an Arduino?

Then there is the issue of a cost effective solenoid using ether 6, 12 or 24 volts (AC or DC). Also, what are the more cost effective drivers to use between the RPIs and the solenoids. Yes, the MEGA IO expansion looks good, but is it over kill or is there one cheaper?

I can order and buy stuff, but I have no idea about what one solenoid or driver will get the work done and may be way cheaper.

Lastly, because this irrigation system will be many miles away, I would want it to always restart and run without any intervention should the power go out. It would be a problem each RPIs was sitting waiting for a prompt when the power cam back 2 weeks back.

I suppose I'm asking for way too much information, but I can see that stuff like this is important.
Computers are fun but freely given relationships are the best!

rickyh89
Posts: 55
Joined: Mon Jun 18, 2018 11:01 pm

Re: Irrigation design

Thu Aug 30, 2018 11:54 pm

I am actually in the process of doing this now. I made and finished one but it requires me to manually mix nutrients and then use a GUI I made to chose how much each solenoid lets out... so it's going to be to hands on for what your doing.

However, you could easily use some of my code an make it work. Most likely use the clock or ping the weather station on Internet to water if not rain in forecast, get rid of the GUI and have a script that runs on its own on statup.
Maybe have it send an email at start up of script so you know if it exited for some reason and had to restart, or/and send an email at end of each day to let you know how long water on for and so you know the rpi is on and running. If no email at end of day and no start up emaIL then you'll know something wrong and try to ssh into the pi.

As for hardware, it's going to depend on if your doing grass like you said whereas mine is for plants that are indoors. I don't know how well solenoid's I have will hold up outdoors. I really like the relay boards. Crazy easy to use. They actually just made new cheaper ones that do not have all the extra input/outpUT pins.

This project for me has changed since this because I am going to use Bluetooth moisture sensors to communicate with 1 rpi. The 1 rpi will have wires going to all solenoids/counter. The moisture sensors are inaccurate to use with long wiring so had to find Bluetooth ones.

The grass wouldn't need so much work. Rpi plus relay boards/counter and 1 solenoid per squared area of grass. The Internet could tell it when to turn water on.

Oh yeah, as for the rpi, I have only used the rpi3 before. If anything I can help with lmk.

User avatar
OutoftheBOTS
Posts: 660
Joined: Tue Aug 01, 2017 10:06 am

Re: Irrigation design

Fri Aug 31, 2018 9:25 am

You guys might be interested in something like these https://www.aliexpress.com/item/WIFI-Re ... autifyAB=0

or something like this https://www.aliexpress.com/item/DC-7-30 ... autifyAB=0

They are a relay with a ESP8266 connected to them. The ESP8266 is known as the IOT chip. People use then as a node for the IOT projects usually driven with MQTT as a client and something liek a RPi as the MQTT broker. They can be programmed with Micro-Python or LUA-MCU or Ardunio or C/C++.

rickyh89
Posts: 55
Joined: Mon Jun 18, 2018 11:01 pm

Re: Irrigation design

Fri Aug 31, 2018 12:12 pm

OutoftheBOTS wrote:
Fri Aug 31, 2018 9:25 am
You guys might be interested in something like these https://www.aliexpress.com/item/WIFI-Re ... autifyAB=0

or something like this https://www.aliexpress.com/item/DC-7-30 ... autifyAB=0

They are a relay with a ESP8266 connected to them. The ESP8266 is known as the IOT chip. People use then as a node for the IOT projects usually driven with MQTT as a client and something liek a RPi as the MQTT broker. They can be programmed with Micro-Python or LUA-MCU or Ardunio or C/C++.

Those pretty cool but I couldn't use them. Well I could but would be messy wiring for having a lot of solenoids... rather have 1 power supply for relays with the rpi and wires leave the rpi into a single loom. Those small boards would need wiring to go to it which would be messy when usING 8+ of them.

User avatar
OutoftheBOTS
Posts: 660
Joined: Tue Aug 01, 2017 10:06 am

Re: Irrigation design

Fri Aug 31, 2018 8:58 pm

Yes if needing lots of relay in 1 place then single relay board might be a bit of a pain.

There is also some boards out there with 4 relays

here's a ESP8266 with 4 https://www.aliexpress.com/item/ESP8266 ... autifyAB=0

And 1 here with big brother ESP32 https://www.aliexpress.com/item/RCmall- ... autifyAB=0

PhatFil
Posts: 454
Joined: Thu Apr 13, 2017 3:55 pm

Re: Irrigation design

Sat Sep 01, 2018 12:01 am

I can thoroughly recommend the itead sonoff range of esp based wifi controllers which are sold with the expectation of getting hacked.. the itead/sonoff wiki pages detail the process for almost every device.. https://www.itead.cc/wiki/Sonoff_Smart_Home_Solution

the tasmota project provides a comprehensive mqtt centric firmware replacement that includes the capacity for independent timers and rules and with the capacity to add additional sensors/buttons /switches etc to the basic hardware.
https://github.com/arendst/Sonoff-Tasmota

a sonoff 4ch pro is a 4xrelay option with the additional feature of being able to pair each relay with a 433mhz button controller.
https://github.com/arendst/Sonoff-Tasmo ... nd-4CH-Pro



to sum up tasmota firmware installed on esp8266/5 esp32 based control h/w along side a mqtt broker and some sort of control hub (could be a couple of shell script files) tho i personally use node red, provides you with a joined up drag n drop system thats intuitive to configure once you get used to the tech.. you could write a gui interface for such a system, Or you could simply download and install the tasmoadmin https://github.com/reloxx13/TasmoAdmin project and use that as an inteface to view the status of all your devices at a glance with links to open ech devices own web server to provide access for configuration or to the console interface for you to issue queries commands and set configuration without the using the config gui.

tasmota and tasmoadmin are both thriving live projects.

User avatar
bill z
Posts: 4
Joined: Mon Jun 15, 2015 6:59 pm
Location: Spring, Texas, USA

Re: Irrigation design

Sun Sep 02, 2018 1:14 pm

Thanks for this input!

I like the WIFI Relay Module ESP8266 IOT APP Controller 2-Channel For Smart Home 12V but not sure if it will work with my knowledge of RPIs or Arduinos. Where these are going, there are no cell phone towers around. I did send a message to the seller. Maybe they can offer help.


Back to one of my original questions: because this irrigation system will be many miles away, I would want it to always restart and run without any intervention should the power go out. It would be a problem each RPIs was sitting waiting for a prompt when the power cam back 2 weeks back. How do I set up the OS to start the program on power up with no GUI?
Computers are fun but freely given relationships are the best!

rickyh89
Posts: 55
Joined: Mon Jun 18, 2018 11:01 pm

Re: Irrigation design

Sun Sep 02, 2018 3:38 pm

I wouldn't use a GUI for something you want. The pi isn't going to be used by anyone, just a script doing what it is supposed to...

If wanted some sort of hands on use while away than I would save feedings and information the script does to a database and make a GUI for your phone or pc that you have access to which will pull information than display on GUI local to you.

The pi itself will run the script and do its job. Doesn't need a GUI for all that. The GUI is only going to make the data displayed in a convenient way for you to read... as for running script at start up, there is a lot of info on which location to add your script on the pi that makes it start right away. Like I said before, just add something in script that has pi send out something to let you know it's on.

PhatFil
Posts: 454
Joined: Thu Apr 13, 2017 3:55 pm

Re: Irrigation design

Sun Sep 02, 2018 5:29 pm

bill z wrote:
Sun Sep 02, 2018 1:14 pm
Thanks for this input!

I like the WIFI Relay Module ESP8266 IOT APP Controller 2-Channel For Smart Home 12V but not sure if it will work with my knowledge of RPIs or Arduinos. Where these are going, there are no cell phone towers around. I did send a message to the seller. Maybe they can offer help.


Back to one of my original questions: because this irrigation system will be many miles away, I would want it to always restart and run without any intervention should the power go out. It would be a problem each RPIs was sitting waiting for a prompt when the power cam back 2 weeks back. How do I set up the OS to start the program on power up with no GUI?
If you lost power for 2 weeks and were relying on a puter system to keep potted plants watered i dont think it would really matter what the puters did when power returned..

The tried n tested stable model is a Pi to host comms this could include providing a wifi ap too but everyone has an old isp router somewhere.
and a subnet of dedicated esp putres to simple tasks such as reading sensors and switching a relay or relays, as each esp is wifi enabled the network establishes itself when configured.

different firmware systems (you can author your own with esp support in the arduino ide, platformio, VS,,etc..) but there are a few very accomplished live projects in existence so you have no need to reinvent the wheel.

whichever esp puters you opt for, Select the best firmware and stick to devices that are supported https://github.com/arendst/Sonoff-Tasmota/wiki for simplicity just configure each device to react to power outages as you want. just as when your pi will restart and start serving its services on the subnet with power returning each of your esp computers will also restart and carry on as before..

check out utubes and the links above to grasp the scope of these devices, with off the shelf systems like mosquitto mqtt broker and node-red on your pi you have all the glue you need to stick together a custom system. though thats just my preference for system control, there are more options available just check out all the home automation systems out there as what you propose is just a subset of home automation.

**EDIT also esp puters can sleep drawing less power, So battery ups power can be supplied and the puters can be configured for minimal power usage to monitor watering a computer needs to be live for 5 seconds each hour? and perhaps another minute or 2 if watering is needed?

Return to “Automation, sensing and robotics”

Who is online

Users browsing this forum: EinSoldiatGott and 9 guests