Autonomous Solar-powered Irrigation & Monitoring Station




Introduction: Autonomous Solar-powered Irrigation & Monitoring Station

About: Industrial Designer. Interested in all kind of projects, mainly electronics and object manufacturing.

This instructable compiles the development and build process of my Autonomous Solar-Powered Irrigation and Monitoring Station with Stevenson Screen, named Steve Waters, which I made for my home garden.

This Station gathers atmospheric data as well as soil moisture data and sends it in real time to the cloud for remote monitoring, while also autonomously controlling the irrigation via a drip-irrigation system, to keep the plants happy and within a proper humidity range.

The real time data from the station can be visualized on the following link:

Origin of the project

One of my main ongoing and ever-evolving projects is an urban rooftop greenhouse, which has been for me a playground and terrain for experimentation around urban farming, in which I have already implemented rain water harvesting and local waste processing, however, one of the main issues I've had is ensuring all the plants are consistently watered, as even with a single extra day without watering, many small plants quickly dry or get sunted, plus every time I went on vacation I had to arrange for someone to come and water everything.

Thus, I decided to develop some sort of autonomous system to handle the irrigation, and ideally, allow me to check and manage the whole system remotely. Since I didn't have a fixed design in mind, I knew from the beginning I wanted to approach this project in a very modular and iterative fashion, so as to gradually build up and refine the systems funcions.

I begun by researching all around the internet for simillar projects to gather resources and ideas which I could implement and adapt for my system, and in this process I found many simillar projects, buy mainly a few stood out particularly and ended up serving as the main inspiration and stepping stones for my desing.

Step 1: Inspiration and Resources

I feel it is very important to mention some of the main sources of inspiration for this project, as the whole proces has been very gradual and iterative, with more and more refinement each time as I gathered experience and ideas from all over the internet.

From the first time I encountered Ben Eater's semi-permanent circuits built beautifly on breadboards, I fell in love with the idea of just making a no compromises prototype, but built neatly enough to be reliable and serve it's purpose for extended periods of time, while still keeping all the flexibility of breadboarding. Thus i decided to extend this semi permanent breadboarding concept to the whole approach, so I decided to tackle this project in a completely modular and modifyable way, in which I could build the functionalities and improvements gradually and without wasting all the previous effort.

Ben Eater's Breadboarding Tricks

Another main source of inspiration for this project were OpenGreenEnergy's various weather stations, from which I mainly kept the concept of an all-in-one board which is meant to be a base for various modules.

Debasish's Solar Weather Station V2 (Also Instructable)

Also from his project I catched the look of some particularly aesthetic stevenson screen enclosures, which were not too round nor too square, but just sort of softened boxes, so I decided to base my enclosure development around these designs, mainly this one:

Glen Lewis' 3D Printable Stevenson Screen Enclosure (Also on GrabCAD)

However, I found that these stevenson screen enclosures were quite big and super plastic-hungry for 3D printing them, so in the effort of optimizing the whole process as much as possible I developed my own version of the enclosure, building on the same modular design, but on a much more compact and plastic-efficient fashion.

Step 2: Setting Up the Thingspeak Channel

One of the first things to do when developing a project like this is to set up the Cloud Data channel and test the communication between the device and the channel. This way you will have a consistent log and reference of all the data and historic behaviour of your system as you develop it.

So begin by creating a Thingspeak account and a new channel. Next, proceed to set it up as referenced on the images, and take note of the Channel ID, as well as the Write API Key and the Read API Key, as you will need to input all these onto the Arduino Sketch to establish the link properly.

Once this is set up, everything is ready to start recieving and viewing the data, so just remember to add the channel information as well as your WiFi Network credentials onto the sketch, and upload it to the Wemos Board. As the code is optimized for battery power, it will not connect to the internet untill it reads the I2C sensors, so connect them to the board to be able to send the data on the cloud.

As soon as the board connects to the Internet, you should see a first data point appear on the thingspeak channel, and now you have not only successfully tested the Cloud connection, but also the sensors. You can test how these behave by periodically pressing the reset button, each reset will send 1 data point. alternatively, just leave the station running to recieve periodic data points at 15 minute intervals for a few hours, this way you can proof run everything before installing it.

Step 3: Developing the Semi-permanent Prototype

After exploring these sources of inspiration, I started to outline and plan my station. The station is based on the ESP8266 microcontroller in the D1 Mini presentation. This microcontroller is a very compact and handy way to build IoT devices, however, it doesn't have so many IO pins as an Arduino, thus we must use digital sensors which can all communicate through a single data bus. This is actually not a problem as nowadays most sensors are digital and of much more precision than analog sensors. The base board breaks out an I2C bus to install the various sensor modules, which can be easily interchanged or combined with modules of other purposes

The key functions I wanted to implement were atmospheric monitoring, soil monitoring, and irrigation control, so I determined that I would use an ESP8266 Board as the brains of everything, and attach a BME280 air sensor module, an ADS1115 16-bit analog input module, and a DC Booster module to be able to drive the watering solenoid valves from the battery. Additionally, I wanted to be able to turn the soil sensors off when not in use, so I added 2 N-MOSFETs to switch the sensors and the watering valve (I used sot-23 SMD MOSFETS on a small breakout board for prototyping)

I also wanted it to be solar powered, so I added a TPS4056 BMS (Universal 1S LiPo USB Charger) module and a MP1584 DC-DC ultra efficient buck module to be able to accept input voltages from 6 to 24v and harvest as much energy as possible.

For ease of prototyping, I began by building the battery charger module and installing it along an 18650 Cell on a solid flat module of the enclosure, which goes just below the top slanted cover of the station and leaves the main inside clear and isolated from the occasional heat of charging the battery.

I developed my weather station to fit entirely on a half-sized breadboard so it can be built without compromises and easily modified as the needs evolve. For my application, once I settled on an effective configuration, I moved all the modules onto a permanent base board built with headers so that all valuable modules can be easily replaced or salvaged in the future, however, a properly done breadboard should already be very reliable and durable, and this was how I tested and developed this station for a few months.

Step 4: Developing the Modular 3D Printed Enclosure

As part of this project, I inquired into the wolrd of sensor enclosures, and I cite Debashis (OpenGreenEnergy) here: "The ideal enclosure for keeping the weather sensors is the Stevenson Screen. A Stevenson screen is an enclosure for weather sensors against rain and direct heat radiation from outside sources, while still allowing air to circulate freely around them."

Upon searching through the web, I found several designs of such enclosures, however, all seemed to be excessively bulky and costly to print, as well as quite tricky to assemble or modify reliably. Thus, I decided to develop my own version of such enclosure, with the aim of making it highly modular, easy to assemble or modify, and most importantly, resource-efficient.

I mainly based my design on the aesthetics of Glen's enclosure, but about half the size in al dimensions, which translates roughly to 1/8th the volume of plastic, or even less, as I made the wall thickness of the flanges effectively as thin as possible while remaining strong and durable (around 1.5mm). I found that even the hollow level modules are surprisingly stiff and rigid mostly due to ther geometry. The 3D modelling was done in SolidWorks and all pieces are optimized to print cleanly without support material.

On my first implementation, I created several stackable hollow modules, plus a slated top module, which all press fitted together and, of course, I couldn't resist adding a small solar panel atop the enclosure and set the whole thing outside. The inside mounting board features spring loaded locks to hold it in place and is just the right size to fit a breadboard with a bit of air surrounding it.

All the pieces MUST be printed in PETG filament, as PLA will inevitably soften and deform under the sun, plus it is much less resistant. For printing PETG I have found it is essential to print with a 0.6mm nozzle (or wider), in order to both prevent clogging and significantly reduce print time. The settings for all pieces must be 2 perimeters, 0.2 - 0.3mm layers and 4 top and bottom solid layers. This will effectively make all pieces fully solid, as they are designed to work as an active surface structue.

This first version however, had several flaws, begining with the flimsyness of the assembly, but mainly around the whole thing getting excessively warm in the sun and therefore not being very useful as a reference for the greenhouse. So for the second iteration I decided to make a more sturdy and adaptable enclosure, and implement the whole station inside the greenhouse with an external panel. Also, the whole assembly system had to be replaced with some sort of threaded fastener system, hopefully all 3D printable. So for the second version I set out to fix all these issues.

The CAD file for the original enclosure is available on this step in case you are interested in viewing them.

Step 5: The Final 3D Printed Enclosure (Stevenson Screen)

I originally designed the enclosure to be able to fit one half size (400 points) breadboard, but after building a first prototype, I realized that there was quite a bit of empty space inside, so I modified the design to be able to accept 2 breadboards inside, held facing one another.

Also, I had aready done some 3D printed threads studies in the past, so I knew that the M6 threaded rods implemented on Glen's design were practically impssible to print properly and guaranteed to be a hassle. But I also knew that by creating very big threads and trimming the rods to have 2 flat faces, they could be printed very cleanly and work really well at a proper scale, both the rods and the nuts.

The top of the enclosure has 4 threaded holes into which the 4 threaded rods screw, and then all the subsequent modules slide onto these rods. After the last module, 4 nuts secure everything together tightly. I also created trimmed step modules, so that they can be assembled with 4 additional nuts to hold together a partial assembly without incrementing the height. i.e. you can assemble it so that the bottom cover can be removed without the rest of the modules falling apart (8 nuts total).

This enclosure features a spacious interior with enough room to mount 2 half-sized breadboards, or simillar sized boards on the inside, plus a 18650 battery + charger module just below the solar panel. The original intention of this enclosure is to include a solar panel atop to be entirely self-contained, however, since I have it set up inside a greenhouse, I printed a solid top and connected an externally mounted panel.

Additionally, since my greenhouse is on a rooftop the WiFi signal isn't great, so I quickly realised that I had to add an antenna for reliability. Since I installed the antenna, there have been practically no missed cloud report intervals.

The CAD and 3D Object files of both the enclosure and the solar panel mount are available on this step as well as on thingiverse.

Step 6: Weatherproofing the Soil Moisture Sensors

Eventhough these Soil Moisture Sensors are of the new Capacitive kind, in which no bare metal is exposed on the probing area, they are still not fit to be used right away, as humidity will soak all into the board through the edges and wreck the sensor within a few weeks. Therefore, we must seal each sensor completely by applying a generous coat of epoxy glue all over the edges, wiring and electronics.

For this I recommend some 2 part 5 minute epoxy such as this one: BSI 5 minute Epoxy bottles

You can do a few sensors at a time, but it's best to go gradually as the glue sets rather quickly, so don't mix too much at a time. Start by first sealing up just the electronics and wiring on each sensor, and then do a second, very generous coat that covers all edges and faces completely. Leave them hanging to set without touching anything, and don't apply thick coats, as it will only drip and cause a mess.

Step 7: Final Schematic, Code and Operation of the System

After several modifications to the connections and to the code of the station, I finally came up with a completely funcional (respecto to what I set to achieve) hardware design and software, so you get the convenience of skipping all the trouble and building a fully funcional station from the beginning.

The operational principle of the code is the following:

The station should read and report ambient conditions as well as soil moisture at regular intervals to a cloud service, and autonomously manage the irrigation through a drip-irrigation system to keep the plants healthy while allowing remote monitoring and managing of the system. All the time between reports should be spent sleeping to save power. All procesess must occur in Setup(); and run only once after each wake up. Loop(); should only run if there are pending irrigation cycles.

Cloud Platform: Thingspeak

Report Interval: 15 Minutes

Irrigation: 3 minutes ON every 15 minutes (1 cycle each)

The functional breakdown of the code is as follows:

  1. On wakeup, enable power to the sensors and disable the irrigation valves.
  2. Read all sensor (Ambient conditions and Soil Moisture) and store their values in memory.
  3. Enable WiFi connection and fetch the latest stored data from the Thingspeak Channel.
  4. Update the Thingspeak Channel with the newest data and if either Soil Sensor is below the threshold, set the pending irrigation cycles to 3.
  5. If there were pending irrigation cycles on the previous data read from thingspeak, begin an irrigation cycle and decrease the counter in the channel, otherwise, go to sleep for 15 minutes.
  6. If an irrigation cycle is enabled, turn WiFi off, turn the valve on, and let the water run for 3 minutes. Then, turn the valve off and go to sleep for the remaining of the 15 minutes.

The program behaves in such a way that the Cloud Platform governs the irrigation, and so if the station detects a plant below the humidity threshold, the irrigation won't begin untill the next report, 15 minutes later, and if for some reason the station is unable to read or update the channel, the irrigation can't auto activate uncontrollably. Likewise, if desired, the Thingspeak channel can be updated externally to remotely enable or disable the irrigation cycles in case the intervention is required.

Step 8: Building the Permanent PCB

The permanent base board for the station is rather easy to solder up. Eventhough the board looks quite crammed, there is actually a lot of free space under each module, and many of them connect to the same pins, so most of the wiring can be done on the underside. For assemblying, take as a guide the board I made, but always reference the schematic to ensure your circuit reflects all the final implementations.

The final parts list for the station is the following:

  • ESP8266 D1 Mini board
  • BME280 sensor module
  • ADS1115 ADC module
  • SX1308 DC-DC Boost module
  • MP1584 DC DC Buck Module
  • TP4056 Battery charger module
  • 4x A03400 N-Mosfet
  • 2x A03401 P-Mosfet
  • 18650 LiPo Battery
  • 6x 51k resistors
  • 6x 2k resistors
  • 3x Capacitive Soil Moisture Sensors
  • 2x 2 pin JST XH connectors
  • 3x 3 pin JST XH connectors DC Barrel jack (panel mount)

Step 9: Mounting the Board on the Station

As the PCB is already mounted on 3 standoffs, it's very easy to mount it inside the Stevenson Enclosure. For this, simply place it atop a blank base board, center it, and carefuly trace around each standoff. Next, eyeball the center of each and drill them all with a 1/8" bit. Now secure the PCB to the base board using 3 nylon M3 screws and line it up on it's rails inside the enclosure.

Remember to upload the code to the Wemos Board and connect the battery before pushing the assembly in. As it reaches it's position, the spring fingers shoud click and hold it in place.

If you need to take it out, you migh be able to release the spring fingers with your pinkies, otherwise, some sort of hager wire tool might be necessary.

Step 10: Deploying the Station

The Stevenson Enclosure is designed to slide onto a 1/8" x 1" aluminum strip, and clicks in place on a single central hole. The spring mechanism keeps the station securely in place, while also being easily removable in case it be required.

Once Steve is in place, it is only a matter of plugging in the sensors, solar panel, and irrigation valve. Now the whole system should be online and reporting real time data to the cloud.

To mount the external solar panel, I 3D printed a thin bracket that holds it from the middle atop the steel structures on my rooftop, and is easily repositionable and adjustable.

Step 11: Results and Behavior

Now that the station has been deployed for quite some time, I have been able to observe that the periodic data reporting is quite consistent and reliable, and also that the solar panel is more than sufficient to keep the battery fully charged most of the time.

However, I have also observed that the Soil Moisture Sensors aren't so precise, and are quite sensitive to placement with respect to their calibration, but this has the upside that recalibrating the system is as simple as pulling the sensors out a little bit, or sinking them in slightly deeper in the soil.

Eventhough the sensors aren't so precise, they are quite adequate for gageing when the irrigation is required, and since I enabled the system, I have had no lost or stunted plants due to overdrying, and I have been able to gather a lot of insigth about how the greenhouse behaves as a system which are the best times to be workin there. For example, thee hottest period is between 2 and 3 PM, and surprisingly, between 5 and 8 PM the temperature is the most comfortable for working.

This station has definately been a worthy upgrade for my greenhouse and it is already having a prominent effect in the efficiency and reliability of the greenhouse.

Step 12: Future of the Project and Sneak Peeks

As this is an ever evolving project, I have already developed several plans for future upgrades, and already begun to implement some of them, of which a few are likely to end up documented here on Instructables in the near future, so be sure to follow me to get notified as soon as they are posted.

Amongst the projects brewing up are the following:

  • tinyStacky - A fully autonomous recirculating garden tower (low cost and based on attiny85).
  • Smart Solar Pack - A 75 Wh power bank with solar input, regulated 12v output, and digitally controlled 12v & 24v outputs for higher power systems such as water pumps and fans.
  • tinyTanker - a simple water reservoir manager that balances rain water collection and tap water usage.


This project is an entry in the Automation contest, and as it is in constant development, getting a prize would certainly help push tings forward, so if you liked it plesae consider voting for it on the contest.

Automation Contest

Runner Up in the
Automation Contest

Be the First to Share


    • Stick It Challenge

      Stick It Challenge
    • Tinkercad to Fusion 360 Challenge

      Tinkercad to Fusion 360 Challenge
    • Woodworking Contest

      Woodworking Contest



    1 year ago

    hello, and thanks for an awsome instructable. I would like to know your opinion on the following matter: I am planning on deploying this system in a place with no wifi coverage, I could include a cell phone or even just a gsm module to provide internet connectivity to the microcontroller.


    1 year ago

    Though this is well beyond my capabilites, it's exactly the kind of project my own milk crate garden needs, and a perfect example of why I love Instructables. Cheers to your cool project!


    1 year ago

    Really fantastic! So awesome to see you using other instructables for inspiration :D