Daniel Judd’s Interesting Software Blog logo

What I learned - Watering System Using Raspberry Pi


Languages: Python, MicroPython System: Raspberry Pi Pico W GitHub link to project code and technical documentation

What Was the Problem #

Many gardeners own greenhouses in their gardens such as a lean to greenhouse or mini greenhouses. One of my Raspberry Pi Pico W projects aims to sit inside a portable box using my 2.4GHz wireless network to report any issues inside the environment (or microclimate) such as temperature, relative humidity, soil moisture content, light levels. These are then used to continually send and update graph data viewable on a separate device such as a user’s mobile phone (Android or iOS).

statistics

This solves the problem of having to trail cables to greenhouses and constantly visit during peak summer or winter periods to see if plants are healthy. It does this through accumulating vital data presented in the form of filtered data as you would get with notifications in other applications, so user action is only required in near-critical events that prevent plants or seedlings in the greenhouse from dying.

Additionally, a watering pump, a fan, and growing lights were added to test the effects of automation in the event that you were away or needed to maintain a constant soil level that prevents bacterial buildup. Additional lights (I used LED strip lights attached to the greenhouse’s ceiling) have a benefit during winter of seeing plants after work (say about 5pm) and increasing their growth, as studies of LED technology show that lighting around the ultra-violet spectrum (see: Why You Should Include UV-A In LED Grow Lights) are beneficial to plant growth.

lights

Did It Work? #

The solution did work well. It was apparent that historical and scientific data was the best part of the project as being able to store and manipulate data collected in the greenhouse over a 7-day period was quite an insight to how day and night cycles affect the data observed.

  1. I could see when sunrise/sunset was for the position of the greenhouse compared to actual reported sunrise/sunset times in the UK.
  2. The watering was reduced overall so I saved effort and money.
  3. The heatwave we had in early September 2023 was mostly mitigated by reading critical (i.e., filtered) data and being able to keep the greenhouse cooled. See image below.
  4. Soil had less bacterial growth and didn’t dry out completely.

temperature

Things that I couldn’t measure thoroughly:

  1. LED affects on plant growth
  2. Air extraction improvements
  3. Battery consumption

So the plant optimised, full-spectrum LEDs were really nice to look at, but I didn’t notice any change in growth. The small computer fan I attached to the greenhouse was ineffectual and didn’t seem to do anything for humidity and temperature despite it being used frequently in larger, commercial growing spaces and polytunnels - Automated Polytunnel Ventilation & Watering.

The whole system was quite efficient and ran on battery packs and parts you could find anywhere, so it was nice to see what small-scale technology can do if you program it efficiently. I made it so that the relay-actuated components could have hot swappable batteries but the main system ran off a dedicated lithium-ion portable USB charger delivering a steady 5V of power.

Changes if This Project Was Done Again #

I would offload generated data to a cloud server because it is not that important if I were to lose it (I may still sulk for a day). This would allow for more security and perhaps reliability despite not noticing these issues during use.

The 10,000 mAh battery pack lasted nearly a whole week of continuous use, this could also be improved through heavy code refactoring, using C languages, or making use of the system’s deep-sleep states, see (Deep sleeping the Raspberry Pico with Micropython).

Summary of how to reduce RP2040’s power consumption:




E-mail 📧 | Github 🐱‍💻 | Subscribe to RSS 👨🏻‍💻