12.6 Humidity Sensor-Driven Sprinkler System
Hook up a DHT22 temperature and humidity sensor to an Arduino attached to a stepper motor that drives a water spigot attached to a garden hose connected to a lawn sprinkler.[116] When the temperature is high and the humidity is low for a prolonged duration, turn on the stepper motor crank valve on the water spigot. Let the water run for ten minutes and then shut off the water valve. Calculate the volume of water used based on the duration it was running. Do this by first calibrating the number of seconds it takes to fill up a liter (or gallon, for the metric system-challenged) at the valve setting established by the stepper motor crank.
For example, if it takes thirty seconds to fill up a liter container, running the sprinkler for ten minutes will consume 20 liters (2 liters per minute times 10 minutes) of water each time you run the sprinkler. Log this amount with the help of an XBee/PC setup (from Chapter 5, Tweeting Bird Feeder) over the duration of the month, and determine from your water bill the percentage of water used on your lawn. Once this metric is calibrated, you can calculate lawn sprinkling costs in real time and literally watch your money flow out of the spigot.