Water Your Garden w...
Clear all

Water Your Garden with IoT - Soil Moisture Sensors

6 Posts
6 Users
DroneBot Workshop
Noble Member Admin
Joined: 4 years ago
Posts: 1171
Topic starter  

Learn to use Soil Moisture Sensors with microcontrollers and build a Soil Moisture Meter and an automated watering system that uses the Arduino IoT Cloud!

There are many methods of measuring the moisture content of soil, but the two types that are most commonly used by hobbyists are resistive and capacitive sensors.

I’ll show you how to use and calibrate both of these types of sensors, both with analog and I2C interfaces.

After we get our sensors calibrated, we’ll use them to build a soil moisture meter using a Raspberry Pi Pico and an OLED display.

We’ll then focus our attention on the main project in this video, an automated watering system that uses an Arduino Nano 33 IoT and works on the Arduino IoT Cloud. This will allow you to maintain your solid at a specific moisture level and monitor it from anywhere on the Internet, with both a desktop and mobile interface.

Here is the Table of Contents for this video:

00:00 - Introduction
01:55 - Soil Moisture Sensors
07:06 - Moisture Sensor Calibration
14:49 - I2C Moisture Sensors
20:52 - Build a Soil Moisture Meter
29:30 - IoT Plant Watering System
52:33 - Conclusion

I’ll also explain why I’m the last person on planet Earth that you’ll want to get gardening advice from!

I hope you enjoy the video.


"Never trust a computer you can’t throw out a window." — Steve Wozniak

Reputable Member
Joined: 3 years ago
Posts: 249

Yesterday I built two 5' x 3' raised garden beds for my wife.  I would like to use this project to add automated watering to each of the garden beds.  Does anyone know how to determine soil moisture sensor spacing?  My google search results were primarily for farm fields.

Famed Member
Joined: 2 years ago
Posts: 2219


Interesting question.

Mark the half way point on each of the walls. That will give you a 9 point grid (including the centre point of the bed). Use a moisture meter to measure and record the moisture level at each corner, midpoint and the centre point.

Then, water the bed the way you expect your irrigation system to work.

Wait half an hour to an hour to allow the added water to spread out in the bed and then repeat the process from the first paragraph.

Calculate the differences in before and after results at each point.

If the difference at each point is substantially the same, then a single moisture sensor will probably be sufficient as it seems that the water has spread evenly.

If some point's differences are significantly higher than the rest, you'll probably need additional sensor coverage to handle that area. 

Experience is what you get when you don't get what you want.

huckOhio reacted
Famed Member
Joined: 2 years ago
Posts: 3926

@will I have had many gardens most made of raised plots 4'x4' (sq ft gardener) the most recent was 24 ft x 18 ft. I watered with a single wave sprinkler and never saw less than 100% coverage. If you plan on using instead a 1/4" line fed drippers and sprayers, as long as you overlap a single probe in the middle will suffice. Check out Lee Valley for a systematic approach. Very cool, but  the cost vs a hardware store variety wave sprinkler is an order of magnitude more. Good luck.

Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting

Inst-Tech reacted
Eminent Member
Joined: 11 months ago
Posts: 20

I could not help it, I rebuilt the project using an ESP32, mqtt and node red. as I cannot post images yet, here is a link to my dashboard https://imgur.com/gallery/FYksNIW

Noble Member
Joined: 4 years ago
Posts: 912
Posted by: @huckohio

Does anyone know how to determine soil moisture sensor spacing?

In my experience these soil water meters are not too good at determining the soil readings in a large raised bed due to the fact that on a sunny day the moisture at the top level can be quite dry, but down where the roots are the soil can still be suitably damp.  I would use a watering regime that takes the temperature and sun hours into account so that on sunny days hot days you turn on a water feed say 3 times a day but maybe just once a day for dull overcast days etc.  The timing and duration of a watering session will have to be determined by experience of your conditions, but can be happily automated with suitable sensors once a little manual observation is done. 

Get your wife to stick a finger in the soil at intervals and at various depths and log the results so you can automate you watering system based on sound analysis.  But maybe this is not such a good idea 🤔 so don't tell her I suggested it.

I think these soil moisture meters are probably better used for small flower pots and the like.  Well thats my experience anyway. 😎 

huckOhio, Inst-Tech and Ron reacted