Solar Powered 'Smart' WiFi Controlled Irrigation System

by Solar_Matt in Circuits > Wireless

13901 Views, 86 Favorites, 0 Comments

Solar Powered 'Smart' WiFi Controlled Irrigation System

20200418_121902.jpg
20200418_122131.jpg
20200418_122158.jpg
Screenshot.PNG

This project makes use of standard DIY solar and 12v parts from ebay, along with Shelly IoT devices and some basic programming in openHAB to create a homemade, fully solar powered, smart garden power grid and irrigation setup.

System Highlights:

  • Fully solar powered system (day and night)
  • 3 zone irrigation system (can be more!)
  • Fully wifi controlled, with Google Home/Alexa integration using Shelly RGBW2 devices
  • 'Smart' Irrigation, use set automatic watering system, with links to weather API to check recent rain fall.

Why this design?

1) I was looking at irrigation systems for my vegetable garden and found that they were either very expensive, or fairly limited in function (just on/off at a set time for a single hose).

2) My garden is really long and there is no external power, so setting up a solar powered 12v garden grid from my shed seemed like a fun (and safe!) idea to get power all over the far end of the garden)

3) I've been playing about with Shelly devices and OpenHAB and thought it would be fun to see what i could achieve!

Supplies

Solar System:

  • Solar Panel (120W)
  • Battery (130aH leisure battery)
  • Solar charge controller (30A)
  • 12v stabilizer
  • Cabling

'Smart' Irrigation System:

  • Waterbutt / Water supply
  • 12v DC water pump
  • 12v Solenoid valves (3x = 1 per irrigation zone)
  • Waterproof housing
  • Irrigation hose, connectors and hose
  • 5-Core cable
  • Shelly RGBW2

(+standard items like tools, cable connectors, hoses etc. as required!)

It is possible to complete many of the functions in the project using the Shelly app, but for more advanced automation logic on the irrigation i have been using OpenHAB.

Solar System Setup

IMG-20200126-WA0000.jpeg
IMG-20200126-WA0002.jpeg
Screenshot_20200416-202002_Chrome.jpg
20200418_121832.jpg
20200418_122120.jpg
20200418_122127.jpg
20200418_122258.jpg

This step is just a quick explanation of my setup, there are many good guides on how to best setup a DIY solar system and the main objective of this Instructable is the 'Smart' garden grid and irrigation system! (This step is also optional, you can power the whole system via a mains powered 12V transformer if you have easy access to a power source and don't want to use solar.)

I used a 120W solar panel (eBay or Amazon), a 130aH leisure battery (can use smaller capacity, but recommend using a leisure battery over a normal car battery due to cycle use of a solar system such as this) and a 30A solar charge control unit. You can go for a smaller Amp unit, but the cost difference is very minimal and when drawing power at 12V, the Amps can soon climb!

The solar system itself will output a range of voltages (documentation with my model says 10.7V to 14.4V depending on the battery charge level and solar input). The Shelly devices used in this project are reasonably voltage sensitive and need a steady 12V supply. To achieve this you'll need a voltage stabilizer, easily available on eBay. I got an 8V-40V input to 12V output capable of carrying 10A. 10A was the largest stabiliser i could find in this voltage range, so will only be able to draw 10A at a single time via this connection. It is always possible to connect a second stabiliser later to provide another 10A power supply.

I did a quick test setup on my garden table to ensure everything was working OK before installing. I checked the voltage output of the solar controller and it was indeed ~13.4V. Once the voltage stabiliser was connected i rechecked and it was 12.2V - suitable for the Shelly RGBW2 and i connected it.

The Shelly powered up immediately and I was able to configure it to my WiFi and tested it's response - my first Solar Powered IoT device!

Once it was all tested and working, i took the setup apart and moved the components to my garden shed for full installation.

I built a basic frame to hold the solar panel at 40 degree angle (most efficient is south facing at 40 degrees elevation at my location - check online, there are many calculators to get the best angle for your locaiton!)

Smart Irrigation - Irrigation Valve Housing

s-l1600.jpg
IMG-20200111-WA0022.jpeg

The first step for creating the automated smart irrigation system is to create a valve control system.

The valves I used for this project are basic, normally closed, 12V DC, 1/2" Solenoid valves. These are easily obtainable from eBay relatively cheaply. Different dimensions are available also. I used 1/2" as there are many different standard irrigation system components that can be used with this size valve/tubing. The valves come with a standard 1/2" screw thread on each side, so you will need appropriate fittings to suit the type of hose/irrigation tubing you want to use.

As the electrical components of the valves are not waterproof, you need a water proof housing. I found that the Schnider Electric 12-entry junction box (195x165x90mm) was the perfect size to fit the 3 valves i wanted to use, plus the 1/2" screw on adapters for the 12mm irrigation hose i have.

I am running the water flows horizontally across the box, with power/control cable entering via the bottom of the junction box through a weather proof glad.

Smart Irrigation - Connecting Valves to Shelly RGBW2 Controller

wiring 1.PNG
IMG-20200111-WA0024.jpeg
20200418_121954.jpg

Each valve has 2 spade terminals. On the valves I am using there is no polarity difference, so I can connect positive or negative to either terminal. No power, valve is closed. Power on, valve is open.

(Note, for the build/testing of this part of the system, i used a standard 12V DC transformer (old LED driver) so that i didn't have to keep going out into the garden and connecting to the solar power supply to test it).

Terminate 3 of the cables from the 5-core cable coming into the box with appropriate sized spade connectors. (In the example photo, brown, black and grey are used for this). One cable (blue in the photo) will be used as the common +ve, so terminate one cable into a suitable multi-cable connector (I used a 5 terminal Wago 221).

The Shelly RGBW2 must be set to 'White' mode (under settings in the Shelly control screen). This effectively means that the Shelly is operating as 4 separate 12V DC (dimmable) relays.

The power source and Shelly should be somewhere away from the water in a safe (dry) location and the connection made to the valve housing using the 5 core cable (mine is about 5m long, going from shed to vegetable patch). The Shelly is inside a small weatherproof junction box inside my shed.

Connect the power as per the attached diagram and it should look something like in the photo. Note, the spare cable and space on the 5-terminal Wago are for connecting the pump.

Smart Irrigation: Connecting the Pump

wiring 2.PNG
20200418_121954.jpg
IMG-20200111-WA0024.jpeg
20200418_121902.jpg
20200418_121853.jpg

The next step is to connect the pump. For my setup, i connected the pump via the valve housing as i used the main 5-core cable to get the power out from the shed, but you could easily connect the pump separately if that is more convenient.

I used the highest flow 12V pump i could find on ebay (1000L/h), but there are many options available. (I have several pumps connected to Shelly RGBW2 now and found that some pumps only work ON/OFF at 100%, whereas others you can control the flowrate using the Shelly dimmer function. This is not important for the irrigation system as you just want 'max' flow, but it may be important for a water feature etc).

Note, unlike the solenoid valves, pumps ARE polarity sensitive, so you need to ensure you connect the +ve and -ve supply the correct way around.

Once this is complete, the pump needs to be connected to the inputs of each valve and each valve give an outlet from the box (so you don't flood the box when testing!).

You can test the valves without any water by turning them ON/OFF in the Shelly RGBW2 interface. You should see the power consumption going up to ~10W when they are open (ensure the 'dimmer' is set to 100% before turning the channel on, they don't seem to like anything but 100%!). If you have wired up the Shelly RGBW2 as shown in the wiring diagram, channels 1-3 should control the valves and channel 4 the pump.

The image shows me testing the system using a bucket in my bath to circulate the water around (the pump is the red thing in the bucket).

Final image shows how I have connected this setup to my water butt for water supply.

Smart Irrigation: Connecting Shelly RGBW2

20200418_122141.jpg
20200418_122158.jpg
20200418_122208.jpg
wiring 2.PNG

All the cables from the system need to come into a dry area (with wifi connectivity!) where the Shelly RGBW2 can be housed.

The cables should be connected up to the Shelly as per the wiring diagram. I opt to use a static IP on all of my Shelly devices as it generally makes the connect more stable.

Smart Irrigation: Control System

Screenshot.PNG
Google home integration of Irrigation System using Shelly RGBW2

Now that the system is setup, there are various ways you can choose to control your system and various levels of how 'Smart' you want it to be!

Basic: The most basic way to control your system is via the Shelly App and native integration with Google Home or Alexa. In the app you can setup standard schedules for each of the channels (Pump, Zone 1, Zone 2 etc) and also connect these to voice control if you so desire.

Advance: The Shelly App also allows you to create 'Scenes', you could setup various 'scenes' that run through different watering patterns at different times of day etc. There are many options within the app... get creative!


Really Smart!

I decided I wanted to go one-step further. I am already using OpenHAB to control most IoT devices in my house, so i setup my own Irrigation system control using OpenHAB. I have attached the basic .items .rules and .sitemap files to this Instructable to assist if you would like to setup something similar.

Overall features:

  • Full automatic and manual control from dashboard page.
  • Google home integration - "Hey Google, Start Irrigation" . - See video.
  • Weather integration - I connected to the OpenWeatherMap API to check the total rainfall for the last 24 hours and if it has rained more than 10mm, the irrigation cycle is not run automatically
  • Irrigation can occur at a set time each day, or variable with sunset/sunrise etc.
  • System calculates how much water will be used for each irrigation cycle (important if you are using water-butts collecting rain water like i am!
  • Push notification to your phone to alert you when the automatic irrigation is about to run.