Smart Watering System

Updated 05 August 2022


This began as an idea after building a very basic single-channel unit. Commercial smart watering systems use a Wifi connection to the internet and get weather reports to determine the level of watering required. These systems are set up and controlled via a phone or tablet app, often you have to register with the company.

I wanted a stand-alone device based on the Raspberry Pi Pico using sensors to determine the watering required. With no need for external internet access.

To program the device a Radio link, via an nRF905 433Mhz transceiver, was used. Some level of remote access is better than having the controls on the front of the controller. Also, sensor data from the controller could be downloaded as basic weather information.

Reading through recommendations for smart watering systems, three sensors were chosen. Temperature, Humidity, and Rainfall. The idea was to record these over a 7-day period and calculate the level of watering required. ie 5mm Rainfall - reduce watering by 50%, 10mm Rainfall - no watering for 3 days at least, over 35 degrees - increase watering by 20%.

The most likely location for the controller would be outside so the case to house it needed to be as water-resistant as possible. A clear cover would allow for easy viewing of information on the display and maintain water integrity.


Power Supply

A number of ways of powering the controller were considered, the best was to follow the path of commercial controllers. Use a 24 VAC 1A plug pack. The 24 VAC would be switched to turn water solenoids ON amd OFF and a small switch mode power supply would convert it to 5VDC for the Pico.

The following power supply was built on a small piece of vero board and worked perfectly. The only modification was addition of a 10k resistor across the output. The supply needs a small load to produce 5VDC accurately, without the load voltage was measured to float as high as 9VDC.

Switching power supply schematic


Most commercially available water supply solenoids are switched by 24 VAC . Using an AC voltage avoids corrosion problems that can occur with DC control lines. Also, the higher voltage allows running of longer control lines. A number of relay modules were purchased and compared; mechanical and solid state (SSR). Solid state was chosen in the end due to less current consumption to trigger the relay and quieter operation. (solid state 1mA, mechanical 75mA at 5VDC to activate) The solid state relays were designed to switch AC volts.

The number of SSR channels was determined by the size of the case and the size of the modules. The 4 module and 1 module units fitted nicely; making 5 watering channels. The modules were mounted on a piece of vero board which was attached to internal case mounting points.

The use of terminal strips makes for easy connection of wires. The strips have a plastic cover to reduce the chance of shorting out the wires. The side strip is the output from the controller to the water solenoids. The bottom strip is the input to the controller. The 6 way terminal strip allows all 5 channels plus one side of the 24 VAC to be available on that strip. The bottom strip connects the 24 VAC and Tipping Bucket inputs. Two terminals are spare. 

four channel SSR module Single channel SSR module Six way screw terminal block

Sensors, Display, Real-Time Clock

The SHT31 temperature & humidity sensor was chosen because it is waterproof and has a 1 m cable. It can be placed in an optimum location to measure temperature and humidity with respect to the case.

The Tipping Bucket input is through an Opto coupler to a GPIO pin. Essentially the Tipping Bucket provides an On/OFF connection when the bucket tips. A magnet moves past a hall effect sensor. This triggers an interrupt in the Pico incrementing a counter.

The PiicoDev OLED is a neat little display and works well. But, the standard font displays 8 lines of 16 characters in a 23 x 11mm space. It is a little hard to read. The internet provided a solution, each character is drawn as a sequence of lines. 3 lines of 8 characters each fitted nicely and is readable from some distance away.

Any watering system needs to have an accurate clock. The Makerverse RTC fits the role perfectly with the added benefit of being powered by a capacitor rather than a button cell.

The PiicoDev Cap Touch sensor is an excellent product. It allows a simple bolt through the case to be used as a switch input when touched. This maintains the water integrity of the case.

The Makerverse Pico Development Board worked perfectly for mounting the modules. The breadboard space on the board allowed for mounting of discrete components such as the Opto coupler for the Tipping Bucket Rain Guage input.


nRF905 modulenRF905 module

This neat little transceiver provides up to 10mW output and 20 to 30 meters range, line of sight. Most of the RF hard work is done inside the chip and it is easy to use. For this project it was the perfect communications device. The biggest problem was the lack of a software library to use with Python programming language. 



Deciding on the placement of all the parts within the case was done first. This is little backward from how a project would usually be designed. But, bench testing of individual parts proved a breadboard setup was not really needed. Also a number of parts had been used in other projects giving confidence in how to use them. The pics show the stages of the installation. At the time none of the software had been developed, also a little backward. But, in the end, it proved to be the right decision.


Terminal strips, protoboard and relays installed Close up of the ferrules in relay screw terminals

Solid State Relays and Terminal Strips


power supply components, present is the driver IC, and various passives Soldering components onto power supply protoboard

Power Supply Construction


Attaching power supply module and nRF905 module into enclosure nRF905 mounted on the opposite side to the power supply module

Relays, Power Supply & nRF905


Mounting the protoboard and mounts for remaining sensors Pico placed into protoboard

Development Board, Pico and Sensors


Completed assembly with sensors attached to screw terminals and all internal components mounted

Completed Controller


Some time was taken to route the wires in a way that looked neat and made for easy removal of parts. Every stage of construction was tested as it was made, giving confidence that part worked. One of the worst things that can happen when building a project, is to get it all done and it does not work, with no indication why. Often resulting in wasted construction time and parts by having to pull it all apart to find the fault.

Once the controller was built, a Pico was setup on a development board to get the basic RF communications working. This part was tricky, having 2 Pico devices programmed through Thonny on the same PC was a challenge. The best solution was to do one at a time and test every step.


Completed system along with a testing setup with the nRF905 on a breadboard



This setup was only used to get the RF communications working. The final design for the programming device was a nRF905 mounted on a piece of vero board attached to a Raspberry Pi 4 with an LCD screen, wireless keyboard and mouse. The Pi 4 became the development environment for the Programmer software and the PC the development environment for the Controller software. Highly recommend Thonny as a Python development tool, it is excellent and easy to use on both PC and Pi.

For software development, a normal sized monitor was used for the Pi 4 rather than the LCD screen. In operation, when configuring the controller, the Pi 4 would use the LCD as the display. Both the PC & Pi monitors were placed on the desktop beside each other, making it easy to change the program and see the results immediately.   


DIY nRF905 HAT Custom enclosure for nRF905 HAT mounted to Pi screen
Front view of the enclsoure with nRF905 module visible Smart Water System UI open on the Pi with nRF905 module shown


The Raspberry Pi 4 program was written in Python 3. The Pico program was written in MicroPython. The Pico interprets commands sent by the Pi 4 and configures itself appropriately. It also determines when to turn the watering system ON and OFF based on the configuration settings and the sensor readings.

 Screenshot of UI, options to sync time set watering profiles and live data view

The GUI window is basic, it provides functionality and could use some improvement in the way it looks. Most of the development time was learning how to use the Tkinter graphical library.

The nRF905 library for the Pi 4 is written as a class. On the Pico, it is def functions. As a class on the Pico, it did not work properly. Further development would be necessary in this area to understand why.

When the Pi 4 program starts it asks the controller for the date-time; if a reply is received the date-time from the Pico is displayed. If no reply the date-time fields remain blank.

  • If communications are established, the Pi 4 then sends its own date time to the Pico; which changes the date time to that of the Pi 4 ensuring time synchronisation between both devices.
  • Asking for the date-time is a way of testing whether the Pi 4 is in range of the controller.
  • The Pi 4 then it asks for the sensor readings and displays them.
  • It then asks for each of the 5 channel configurations and sets its display to channel 1 saving the other 4 in memory.
  • The window at the bottom of the display is for status, it shows the commands and responses sent and received.
  • Both the Pi 4 and Pico programs default to all channels OFF if there is no communication or configuration settings.

The above happens automatically on power up of the Pi 4. If it is out of range, getting the configuration, date time and sensor readings would be done manually via the LCD screen.

Whenever the configuration is changed, the Pico saves it in a file for future reference. The Pico reads this file whenever it is powered up and sets it configuration appropriately. If the file does not exist the Pico defaults to all channels OFF.

  • Every minute the Pico will check the channel configuration against the time and set the channels ON or OFF.
  • Every 5 minutes it will read the sensor data and keep a rolling average.
  • Every 1.5 hours the averaged values will be saved to a text file.
  • The file records data for the last 7 days.
  • New records are added to the end of the file and the first record is removed (FIFO).
  • Rainfall is interrupt-driven, a counter ticks up with every bucket tip.
  • Rainfall count is also saved to the file every 1.5 hours.
  • If the Pico loses power the sensor and rainfall data for the last 1.5 hours will be lost. Not a big issue when being used as a watering system.
  • Every day at midnight the controller will calculate the Auto channel settings for the next day based on the recorded sensor data.

The sensor data text file contains 112 lines of 38 characters giving a file size of 4,256 bytes.

Each line in the file has 7 fields separated by a comma with a '\n' at the end.

DD/MM/YY, Hour, Temperature High, Temperature Low, Humidity High, Humidity Low, Rainfall\n
Variable Size
DD/MM/YY 8 bytes
Hour 2 bytes, 24 / 1.5 = 00 to 15
Temperature High 4 bytes, 25.7 format
Temperature Low 4 bytes
Humidity High 4 bytes
Humidity Low 4 bytes
Rainfall 5 bytes


The file is written to the flash memory of the Pico 16 times a day. 5,840 writes per year. Flash memory will usually last about 100,000 writes giving a life span of about 15 years. 

Note: When reading a large amount of sensor data over a short period of time and needing to save it; a Micro SD module and SD card should be used. The card can be changed if it runs out of writes. In this case the 15 years is seen as an acceptable buffer.

The OLED has a custom character generator to write 3 lines of 8 characters which is much more readable than the standard font of 8 lines of 16 characters.

Only 1 of the 3 Capacitive Touch buttons is used. Repeated pressing will cycle through data on the OLED. There are 6 screens:

  • Date time
  • Current temperature/humidity
  • Current rainfall
  • Bar graph of temperature over the last 7 days
  • Bar graph of humidity over the last 7 days
  • Bar graph of rainfall over last 7 days

Note: The bar graphs above are not a true representation; they were recorded when the controller was being tested. Rainfall data is from manual clicks of a push button and a set level to prove software operation.

OLED temperature and humidity readout OLED rainfall bargraph
OLED temperature bargraph OLED time and date readout

Four of the six total screens


Getting the radio link working was achieved using another Pico and a development board, as can be seen in the pics. The 1-second difference in time display is due to the Cap Touch buttons being pressed at slightly different times. The OLED displays whatever the time is when the button is pressed, but the display is not updated. (future improvement)


testing communications, updating the time between modules testing communications, updating the temperature and humiditybetween modules

To test the overall system, the timing cycle was changed to 1 second from 1 minute. Taking 22.5 minutes for 1 day. This produced enough data to test all the features of the program including the ON/OFF operation of the relays and a change of day update for Auto channels.

Further testing will be done when the controller is in use. Installation of water piping and solenoids is a whole different exercise compared to developing the electronics of the project. A Tipping Bucket Rain Guage was not available when testing, one will be acquired for in-use testing.

The spare pair of inputs could be used with a device that detects rainfall and opens a switch. It is mainly used to stop watering systems from running when it is raining. The program could be modified to measure the time the switch is open and estimate the level of rainfall that has occurred and change the watering requirements.


Smart Watering System Schematic


The development of this project was a challenge which is what I wanted. Writing and testing two different programs on two different Raspberry Pi's at the same time through Thonny was interesting. The project was taken on to see what could be done with the Pico. The results have exceeded my expectations and I am generally happy with them.

Future improvements:

  • The radio comms can cause a crash if the controller and programming device are too far away from each.
  • The software in the controller loops looking for an address match, it would be better if it was interrupt driven.
  • The controller is passive as far as communication goes, it never initiates a conversation.
  • The software in the programmer sends a message and waits 0.5 seconds for a reply, it does not listen for incoming communication messages.
  • The nRF905 Python library could be improved by making communications a two-way street, any device can initiate a transmission at any time.
  • Checking of the received messages could be improved.
  • The Pi 4 LCD is a touch screen. It would be improved if this function was used rather than a keyboard and mouse.
  • The look of the GUI needs improvement.
  • Downloading the last seven days of data and producing a graphical output on the Pi 4 would make for basic weather recording.

All the best, Cheers


Have a question? Ask the Author of this guide today!

Please enter minimum 20 characters

Your comment will be posted (automatically) on our Support Forum which is publicly accessible. Don't enter private information, such as your phone number.

Expect a quick reply during business hours, many of us check-in over the weekend as well.



Please continue if you would like to leave feedback for any of these topics:

  • Website features/issues
  • Content errors/improvements
  • Missing products/categories
  • Product assignments to categories
  • Search results relevance

For all other inquiries (orders status, stock levels, etc), please contact our support team for quick assistance.

Note: click continue and a draft email will be opened to edit. If you don't have an email client on your device, then send a message via the chat icon on the bottom left of our website.

Makers love reviews as much as you do, please follow this link to review the products you have purchased.