Green Technology: Build an Electronic Soil Moisture Sensor to Conserve Water
AbstractWater is a valuable resource, and water shortages are a serious problem in many parts of the world. The problem can be made worse by people who waste water; for example, by watering a garden or using sprinklers on their lawn (or a farmer taking care of an entire field) when it has rained recently or the soil is already moist. How can you help conserve water and prevent such waste? One way is to build an electronic soil moisture sensor. This project will show you how to build a circuit that indicates whether soil is wet or dry, but the circuit itself is unprotected. It will be up to you to engineer a solution, like a waterproof carrying case that turns the basic circuit into a useful, portable soil moisture sensor.
Design a portable, weatherproof case for a soil moisture sensor circuit.
Do you live in an area that experiences droughts? If so, you might have to cut back on your water consumption, for example by taking shorter showers. What about watering your garden? Irrigation, or the artificial application of water to plants and landscaping, accounts for over two-thirds of the world's freshwater consumption (U.S. Geological Survey, 2016)! While that total includes farms, in the United States landscape irrigation (Figure 1) still accounts for almost one-third of home water use. As much as half of that water is wasted due to inefficient watering methods (WaterSense, 2016), like watering when the soil is already wet, or watering too much at once, resulting in soil that becomes saturated; excess water then flows away as runoff.
Figure 1. Lawn sprinklers like these account for a huge amount of residential water use in the United States. Image credit Wikimedia Commons user Ildar Sagdejev, 2003.
One way to combat this wasteful over-watering is through the use of a soil moisture sensor. Most sprinkler systems run on timers that tell them to run at a certain time every day. A soil moisture sensor can electronically detect whether the soil is already wet and tell the sprinkler system not to run. If it has rained recently, or if it has been cloudy and cool since the last time the sprinkler ran and not much water has evaporated, it will prevent the sprinkler from running unnecessarily, which saves water. The same concept applies to someone who uses a hose to water a garden manually. For example, the sensor can use a light to indicate whether or not you need to water your garden.
There are many different types of soil moisture sensors. Some are intended for agricultural use, and can be distributed in many locations over large fields. Some can be hooked up to home sprinkler systems, and some are simple handheld devices that you can use to check the soil moisture in potted plants. In general, they work by using two metal probes to measure the electrical resistance of the soil, or how difficult it is for electricity to flow through the soil. This is the opposite of electrical conductivity, which is how easy it is for electricity to flow through soil. Wet soil has a much lower resistance (or a much higher conductivity) than dry soil. The resistance depends on how wet the soil is, and the surface area of the probes and the distance between them.
In this project, we will give you a design for a simple soil moisture sensor circuit that you can build on a breadboard. The circuit will have two probes that you insert into soil. It will turn on a small light (called a light-emitting diode (LED)) if the soil is too dry, and the light will stay off if the soil is wet (for a detailed explanation of how the circuit works, see the Help section). Then, when the light is on, you will know it is time to water your plants or lawn.
However, the circuit by itself is not very portable or durable. It has loose wires that can easily come apart if you do not handle it gently, and it is not waterproof at all. What if you want to easily pick up and move the circuit so you can check the soil moisture on a dozen different potted plants? What if you want to leave it outside so you can monitor the soil moisture level of your lawn or garden? You will need to do some work to design a safe, durable, and portable enclosure for your circuit. To do this, you will need to follow the engineering design process. Are you ready to help conserve water and save the planet? Move on to the Materials section to get started!
Terms and Concepts
- Soil moisture sensor
- Electrical resistance
- Electrical conductivity
- Surface area
- Light-emitting diode (LED)
- Engineering design process
Advanced students who want to understand how the circuit works should also research these terms:
- Digital logic
- Logic gate
- NAND gate
- Truth table
- The statistics about water consumption given in the Background section are for the entire world and the United States overall. Can you look up more specific water usage statistics for your city or region? From where does the water come? For what is it used?
- Estimate how much water a typical household could save by using a soil moisture sensor for their lawn or garden.
- What are some of the environmental hazards of runoff?
- Why is irrigation important?
- Why does wet soil have a lower resistance than dry soil?
- How and where would you want to use your soil moisture sensor? How will this affect your case design?
Use these resources to learn more about irrigation and water conservation:
- U.S. Geological Survey. (2016, May 2). Irrigation Water Use. Retrieved May 16, 2016.
- WaterSense. (2016, May 12). Outdoors. Environmental Protection Agency. Retrieved March 16, 2018.
This resource will be useful for students who are new to using a breadboard:
- Science Buddies. (n.d.). How to Use a Breadboard.. Retrieved May 16, 2016.
The background sections of these projects are good resources for students who want to learn the basics about circuits:
- Science Buddies. (2016, April 12). Squishy Circuits Project 1: Light Up Your Play Dough!. Retrieved June 14, 2016.
- Science Buddies. (2016, February 6). Which Materials are the Best Conductors?.. Retrieved June 14, 2016.
If you are not familiar with the engineering design process and how it differs from the scientific method, you should review these resources.
- Science Buddies. (n.d.). The Engineering Design Process. Retrieved June 9, 2016.
- Science Buddies. (n.d.). Comparing the Engineering Design Process and the Scientific Method. Retrieved June 9, 2016.
These resources will be useful for advanced students who want to learn more about how the circuit works:
- Hord, M. (n.d.). Digital Logic. SparkFun Electronics. Retrieved May 16, 2016.
- Lindblom, J. (n.d.). Voltage Dividers. SparkFun Electronics. Retrieved June 9, 2016.
- Texas Instruments. (2003). CD4011B, CD4012B, CD4023B Types CMOS NAND Gates. Retrieved May 16, 2016.
Materials and Equipment
Recommended Project Supplies
- Electronic Sensors Kit, available from our partner
Home Science Tools. You will need the following items from the kit. See Table 1 in the Procedure if you do not know what these parts look like.
- 9 V battery
- 9 V battery snap connector
- CD4011 NAND gate integrated circuit (IC)
- 100 kΩ resistors (2) (brown, black, yellow, gold stripes)
- 470 Ω resistor (yellow, purple, brown, gold stripes)
- Red LED
- 10 MΩ resistor
- Jumper wires (assorted)
- Alligator clip leads (2)
- You will also need the following items to test your sensor (not included in your kit):
- Access to soil, either outside or indoors (for example, from potted plants)
- The ability to make wet soil; for example, with a hose or a bucket and access to tap water.
- The ability to make dry soil; for example, you can put soil in a baking pan and leave it in the sun, or dry it in an oven for several hours (at about 220 °F, or 105 °C)
- You will also need some other materials and tools, not included in the kit. Since this is an engineering project and you will come up with your own design for the case, there is not an exact list of materials required to do the project. Here are some suggestions to get you started:
- Popsicle sticks
- Aluminum foil
- Small block of stiff foam or wood
- Small plastic container with lid
- Power drill or hobby knife (adult supervision required)
- Safety goggles
- Hot glue or waterproof silicone sealant
- Lab notebook
Disclaimer: Science Buddies participates in affiliate programs with Home Science Tools, Amazon.com, Carolina Biological, and Jameco Electronics. Proceeds from the affiliate programs help support Science Buddies, a 501(c)(3) public charity, and keep our resources free for everyone. Our top priority is student learning. If you have any comments (positive or negative) related to purchases you've made for science projects from recommendations on our site, please let us know. Write to us at firstname.lastname@example.org.
Assembling the Circuit
If this is your first time using a breadboard, refer to the Science Buddies resource How to Use a Breadboard for Electronics and Circuits. Assemble your soil moisture sensor circuit on a breadboard, as shown in the slideshow and described in Table 1. For advanced students, see the Help section for a circuit schematic and detailed description of how the circuit works.
Slideshow with step-by-step instructions viewable online.
|4011 NAND gate||
||Rows 1–7, straddling the middle of the breadboard, with semicircular notch facing up|
|10 MΩ resistor||
||B2 to (-) bus|
|470 Ω resistor||
||B3 to B11|
||Long lead to A11
Short lead to (-) bus
|100 kΩ resistor||
||C2, other lead free|
|100 kΩ resistor||
||D1, other lead free|
|9 V battery and snap connector||
||Red lead to (+) bus
Black lead to (-) bus
|Jumper wires (4)||
||B1 to (+) bus
J1 to (+) bus
A7 to (-) bus
Left (+) bus to right (+) bus
Testing Your Circuit
The circuit works by "detecting" the resistance between the two free 100 kΩ resistor leads. If the resistance is very high (like with dry soil), the LED will turn on to indicate that the plants need to be watered. If the resistance is very low (like with wet soil), the LED will turn off, and stay off until the soil dries out again. You can easily check to make sure your circuit is working:
- Make sure the free 100 kΩ resistor leads are not touching each other. The LED should be on, because the resistance between the leads is very high (electricity would have to travel through air to get between them, and air is not a good conductor).
- Touch the two free leads directly to each other. This should cause the LED to go out, because the resistance between the leads is zero. Electricity can flow easily from one lead to the other.
- Put a small pile of dry soil on a plate. Touch both resistor leads to the soil at the same time. The LED should turn on, because the resistance of the dry soil is very high.
- Slowly add drops of water to the soil and watch as the soil gets wet. Eventually the LED should turn off, because the wet soil has a low resistance. See Figure 2.
- You can also try testing the circuit with your hands. Try touching both resistor leads to your palm at the same time. If your hands are slightly damp or sweaty, the LED should turn off.
- If you cannot get your circuit to work, see the Help section for troubleshooting information.
Figure 2. The LED stays on when the resistor leads touch dry soil (left) and turns off when the leads touch wet soil (right). So, if the LED is off, that indicates that the soil is already wet and you do not need to water your lawn or plants.
Designing and Building a Case for Your Soil Moisture Sensor
Now you should have a working soil moisture sensor circuit. However, you have probably noticed that this circuit is not very practical for everyday use, because it is rather fragile. What if you wanted to leave the circuit in your garden, or carry it around your house to check on different potted plants? Here are a few problems you could run into:
- The circuit has loose parts dangling off the breadboard, like the 9 V battery, that could fall out easily as you carry it around.
- The resistor leads are very small and flexible. It is difficult to insert them into soil at the same distance repeatedly (remember from the introduction that it is important to keep the distance between the probes the same, because the soil's resistance depends on this distance).
- The circuit is not covered or protected at all. If you took it outside, the breadboard holes could get clogged with dirt or the entire circuit could be damaged by rain.
This is where the engineering design process becomes important. How could you improve the circuit to solve these problems? The engineering design process is open-ended, meaning there is no single "right answer." A design that works well for somebody who wants to leave the sensor in his or her yard might not work for somebody who wants a portable sensor to check on potted plants, and vice versa. Figure 3 shows one possible design to improve the usability of the circuit, but how you modify the circuit is up to you. You could do something totally different!
Figure 3. An example of a modified soil moisture circuit. The breadboard is placed in a plastic container with a sealable lid to make it waterproof (the removable lid ensures that you can still change the battery). Two small holes are drilled in one side of the container to allow the 100 kΩ resistor leads to poke through. The resistor leads are connected with alligator clips (included in your kit) to two popsicle sticks covered in aluminum foil. These popsicle sticks serve as sturdier probes that are easier to handle than the tiny resistor leads. Note that the outer surface of the probes must be an electrically conductive material, and most metals are conductors. The probes would not work if they were just wooden popsicle sticks. Finally, the popsicle sticks are inserted through slots cut in a sponge, which keeps them at a fixed distance from each other. Remember, this is just one potential way to improve the circuit—you could do something totally different with different materials!
If you are new to the engineering design process and need help getting started, these steps will help walk you through it for this project. You can also refer to the resources about the engineering design process in the Bibliography.
- Define the problem: From reading this far, you already know that the general idea of this project is to build a soil moisture sensor, and use it to conserve water by indicating whether soil is already wet when watering plants. But that is not specific enough. Where will the sensor be used and who will use it? Will it be used indoors or outdoors? Will it remain in one place or does it need to be portable? Define a specific problem, such as "Design a weatherproof soil moisture sensor that can be left outside."
- Do background research: You have already started this research if you read the Background section and the Bibliography of this project. You may need to do additional research, depending on the problem you define in step 1. You could also interview potential "customers" for your soil moisture sensor (for example, interview your parents if they do most of the gardening at your house).
- Specify requirements: Come up with specific requirements based on your problem statement and background research. For example, if you intend to leave the circuit outside, one requirement could be "the circuit needs to be waterproof." If you want the circuit to be portable, a requirement could be "You must be able to pick the circuit up and move it without any of the parts falling out." Many engineering design projects also specify a budget, so you could put a limit on the total cost of all your materials.
- Brainstorm, evaluate, and choose a solution: This is where the engineering design process becomes totally open-ended. Remember that there is no single "right answer" to your problem. Use your lab notebook to write down and sketch ideas. Try to come up with as many ideas as you can for now, and do not worry about ideas being "wrong." For example, how many different ways can you think of to make the circuit waterproof? What materials will you need to build your design? Once you have thought of multiple solutions, evaluate them based on the requirements you came up with in step 3. Which one meets your requirements the best?
- Develop and prototype solutions: Build a prototype (or an early model) of your best solution. You do not have to stick to exactly what you drew in your lab notebook. You can tweak the design as you build it if you find out that part of your idea will not work.
- Test solution: once you have a prototype built, it is time to test it! First, test your circuit with wet and dry soil to make sure the LED still lights up properly. Then, test your circuit to make sure it meets all your other requirements. For example, if the circuit is supposed to be waterproof, you can leave it outside in the rain (or, if it is a sunny day, run it under a faucet) and then check to see if it still works.
- Does solution meet your requirements? If not, do not worry! Engineers rarely get things perfect on the first try. Now it is time to iterate, or go back through some steps of the engineering design process to refine your solution. If your prototype did not work, go back to step 4. Maybe you can make some small changes to your existing design, or maybe you should go with a totally different solution. There is nothing wrong with iterating through the steps multiple times until you arrive at a final solution.
- Communicate results: Once you have a final solution, you are ready to write the report for your science project. Be sure to take lots of pictures of the device you built!
For troubleshooting tips, please read our FAQ: Green Technology: Build an Electronic Soil Moisture Sensor to Conserve Water.
Ask an Expert
There are many possible variations of this project. Some might use parts solely from your kit, and others may require purchasing additional parts. Note: Some of these variations are for advanced students who have more experience with circuits.
- Can you use your sensor on real plants? How much water does the sensor help you save? How does using the sensor to determine when to water the plants, as opposed to watering on a regular schedule, affect water consumption and plant growth? See the Abbreviated Project Idea Monitor Your Plants with a Soil Moisture Sensor for more information.
- For outdoor plants exposed to direct sunlight, does watering at different times of day affect how long the soil takes to dry out?
- Your kit comes with an LM7805 voltage regulator, which will convert the voltage from the 9 V battery (which decreases slowly as the battery drains) to a fixed 5 V. Does using the voltage regulator affect the battery life of the circuit? Can you find a way to reliably measure the battery life? You can learn how to connect the voltage regulator from its datasheet. The voltage regulator is also used in the project Measuring Magnetic Fields.
- Use potentiometers to replace the fixed 10 MΩ resistor to make the threshold at which the LED turns on or off adjustable. Potentiometers are not included in your kit, but you can purchase them separately, for example the 10 kΩ (Jameco), 100 kΩ (Jameco) and 1 MΩ (Jameco) (you can combine multiple potentiometers in series to give you coarse and fine-tuned adjustments). Look up "soil moisture content" and how it is measured and defined. Prepare samples of soil with different moisture contents by completely drying some soil in an oven, then measuring known amounts of soil and adding measured amounts of water to it (for example, adding 10 mL of water to 100 mL of soil gives 10% soil moisture content by volume). For each soil sample, insert the probes and then adjust the potentiometers until you find the threshold where the LED turns on/off. Use the multimeter included in your kit to measure the resistance of the potentiometers. Can you use this data to create a calibration curve of resistance vs. soil moisture content? This would allow you to tune your sensor to a desired soil moisture content for certain plants or environmental conditions. You may also need to experiment with different resistor values (or no resistor at all) for the two probes to see what works best. Your kit comes with 220 Ω, 470 Ω, 100 kΩ and 10 MΩ resistors. Note that, after you have completed your calibration curve, you could also use this circuit to measure the moisture content of an unknown sample of soil.
- How, if at all, do the surface area, depth, distance between, or material of your soil probes affect the performance of the circuit? Can you "calibrate" the circuit (as described in the previous point) by changing the probe geometry instead of using a potentiometer?
- The 4011 chip in your circuit contains four individual NAND gates. This means that you could connect up to four separate LEDs and sets of probes to the chip; for example, to monitor four different potted plants or four different areas in a garden. See the chip's datasheet for a pin diagram. Note that your kit only comes with four alligator clips, so you would need to purchase more if you are using them for the probes. Additional alligator clips are available from Jameco Electronics.
- How long does the battery last if you leave the circuit on continuously? (Note: The circuit will always draw a small amount of power, even when the LED is off). Can you improve the battery life by only turning the circuit on when you want to check the soil, instead of leaving it on all the time? If so, can you add an external power switch to your circuit so you do not have to manually disconnect a battery pack wire from the breadboard each time? A variety of switches are available from Jameco Electronics.
- Changing the battery could get annoying if you want to leave the circuit outside for long periods of time. Can you modify the circuit so it is powered directly from a solar panel, or a combination of a solar panel and rechargeable battery? A variety of solar panels are available from Jameco Electronics.
- Solderless breadboards are great when you are first learning electronics, and useful for quickly prototyping a circuit; however, they are not very good for permanent long-term devices since the components can fall out. Use a soldering iron to create a permanent version of the circuit on a protoboard (also called "perfboard"). A variety of protoboards are available from Jameco Electronics.
- The circuit in this project uses an LED as in indicator for whether or not you should manually water plants. This works fine if you normally water with a garden hose or watering can, but what if you want to connect to an automated sprinkler system? Do research on solenoid valves, a type of electronically controlled valve that can be opened and closed by an electrical signal. While the output of the 4011 chip is strong enough to drive an LED directly, it is not powerful enough to drive a solenoid valve. You will need to research how to use a transistor and an external power supply to drive a larger electrical load by controlling the transistor with the output of your circuit.
For more projects about water conservation, see:
Frequently Asked Questions (FAQ)
|Input A||Input B||Output J|
In this circuit, shown in Figure 4, the LED is connected between the output of the NAND gate and ground. When the output (J) of the NAND gate is high, the LED turns on, and when it is low, the LED turns off. Input A of the NAND gate is connected directly to +9 V, so it is always high (so effectively, we are only using the first two rows of the truth table, since input A is never 0). Input B is connected to ground (0 V) by a pull-down resistor (R3), but it is also connected to +9 V via the two probe resistors (R1 and R2). These resistors have an additional resistance, Rsoil, between them. Together, these four resistances form a voltage divider, which determines the voltage at input B (see the SparkFun reference in the Bibliography to learn more about voltage dividers).
Figure 4. Circuit diagram for the soil moisture sensor. Numbers by the NAND gate correspond to pin numbers on the 4011 chip.
When the resistance of the soil is very high, the resistance between input B and ground is lower than between input B and +9 V, so the voltage is "pulled down" to 0. When the resistance of the soil is very low, the reverse is true, so the voltage is "pulled up" to +9V. This means that the voltage at input B changes between high and low, depending on whether the soil is wet or dry, respectively. As you can see from the truth table, this changes whether the output is low or high, which turns the LED on and off. See Figure 5.
Figure 5. (Top) When the soil is dry, Rsoil is very high. Input A is high, input B is low, so the output is high and the LED turns on. (Bottom) When the soil is wet, Rsoil is very low. Both inputs are high, the output is low, and the LED turns off.
If you like this project, you might enjoy exploring these related careers:
Contact UsIf you have purchased a kit for this project from Science Buddies, we are pleased to answer any question not addressed by the FAQ above.
In your email, please follow these instructions:
- What is your Science Buddies kit order number?
- Please describe how you need help as thoroughly as possible:
Good Question I'm trying to do Experimental Procedure step #5, "Scrape the insulation from the wire. . ." How do I know when I've scraped enough?
Good Question I'm at Experimental Procedure step #7, "Move the magnet back and forth . . ." and the LED is not lighting up.
Bad Question I don't understand the instructions. Help!
Good Question I am purchasing my materials. Can I substitute a 1N34 diode for the 1N25 diode called for in the material list?
Bad Question Can I use a different part?
- Science Fair Project Guide
- Other Ideas Like This
- Electricity & Electronics Project Ideas
- Environmental Engineering Project Ideas
- Agricultural Technology Project Ideas
- My Favorites
- Engineering Design Process