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 ā¦
For more detail: Build An Hygrometer Using Arduino