Arduino Hygrometer

11K7518

Intro: Arduino Hygrometer

I am building an automated irrigation system for my vegetable patch. This will be a system that monitors the soil moisture level and then turns on a pump to send water to my garden according to the detected moisture level.

The water is coming from our rainwater tank, there is also an overflow on the tank that I've redirected to the garden (both the vegetable and ornamental gardens) so that water isn't just sluiced off into my neighbors property. It's been doing that since before we bought the property.

This instructable is about one fairly simple part of the project, the soil moisture monitor.

For this instructable, you'll need:

  • 1 x Hygrometer (I bought mine from eBay)
  • 1 x Arduino (I'm using a UNO)
  • 3 x LED (Red, Green, Blue)
  • 3 x 220 ohm
  • 1 x 10k ohm resistor
  • jumper wires

STEP 1: Wire It Up

There are three bits that are important in this project.

Connect the Hygrometer to Analog 0 (A0) on the Arduino, it doesn't matter which side of the Hygrometer is connected to A0.

This connection also passes through the 10k Ohm resistor to 5V (we are splitting the load). It is the difference in load that the Arduino will detect on A0.

The other pin on the Hygrometer connects to GND on the Arduino.

If that's as far as you go ... you'd be done, of course you wouldn't be able to see any blinky lights ... but that's OK.

If you want to have a visual monitor of the moisture level, then you'll be wanting some LED.

I've used pins 13 (RED), 12 (GREEN) and 11 (BLUE) in my sketch, you can use others if you want ... I won't oppress you.

Connect Pin 13 to the anode of the red LED (long leg)

Connect a 220 ohm resistor between the red LED cathode (short leg) and to GND

Connect Pin 12 to the anode of the green LED (long leg)

Connect a 220 ohm resistor between the green LED cathode (short leg) and to GND

Connect Pin 11 to the anode of the blue LED (long leg)
Connect a 220 ohm resistor between the blue LED cathode (short leg) and to GND

That's it ... you're all wired up.

STEP 2: Arduino Sketch


The guts of the sketch simply reads the value on A0, works out if the value falls within a predefined range (0 - 400 = Dry, 400 - 700 = Moist and 700 + = Wet).

It also turns the appropriate LED on and off according to the same range.

Because I have grand plans of connecting the device to a controller at some later stage, I'm also sending the output to Serial.

The entire sketch is very simple ... even I can understand it :)

The video simply shows the monitor transitioning between states of Dry/Moist/Wet ... with my ham fists in the action.

Oh, yeah ... please excuse my colour blindness ...

18 Comments

Is it measuring capacitance or resistance?

Hey gustavio101,

It measures Resistance ... the large exposed pads work like a variable resistor. When there is more moisture present, there is greater conductivity between the pads and will result in lower resistance.

Ok! Thanks for the reply. I'm looking for a way of making a sensor which measures capacitance rather then resistance since a resistance meter will rust and there's no way of isolating it.

Do you how to do that with Arduino, let's say by using lm555. Those are easy to find.

Well, you don't need a 555 to measure capacitance. This article is pretty good "How to make an Arduino Capacitance Meter".

It's true that the probe will eventually rust and that means that it's ability to measure will be attenuated. However, it works for a long time :)

What you are suggesting is a good alternative, but you will still be pushing ions around and that will cause oxidization ... won't it?

Cheers

Baelzabubba

Once again thank you very much for the well written reply. I need a capacitance meter since I will be measuring water and I don't want any oxidization since I will use that water.

Nice one, please post an update when you finish it! Or better, post an instructable!

Cheers

Baelzabubba

Just tested the meter and with some calibration I managed to get accurate readings from 1 uF to around 2000 uF which is precisely what I have been looking for.

Cheers

Gustav

Hey Gustav,

That's great news! Well done, and you're welcome. It's always gratifying to help someone along the way. To quote "If I have seen further, it is because I have stood on the shoulders of giants" (not suggesting that I'm a giant, at all).

Cheers

Also what about the commercial Arduino hygrometer?

http://www.ebay.com/itm/Soil-Hygrometer-Detection-Module-Soil-Moisture-Sensor-For-arduino-Smart-car-/400364471802

Well gustavio101 ... it looks pretty much the same to me :) except you get a moisture detector and probe, whereas I'm just using the probe and voltage splitting to analyse the resistance. However you wanna cut it ;)

Thanks you for this instructable!
thanks for the instructable, planning on making an automated flower watering system soon

Excellent, that's pretty much what this circuit is designed for. Keep me posted on your progress! For smaller installations, simply using a gravity fed water reserviour and a solenoid is all that you need.

That's actually the route I wanted to go. Much easier and simpler
would you want to switch the resistance on the red led since it has a lower voltage drop?

Sure, you can switch the resistance if you need to. I tend to use 220 ohm for the LED that I have and, typically, different LED from different manufacturers have different forward voltage. 220 is a pretty safe resistor for most applications.