Jump to main content

Green Technology: Build an Electronic Soil Moisture Sensor to Conserve Water

406 reviews


Water 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.


Areas of Science
Time Required
Short (2-5 days)
Familiarity with using a solderless breadboard, or willingness to learn.
Material Availability
Specialty electronics items are required. A kit is available from our partner Home Science Tools. See the Materials section for details.
Average ($50 - $100)
Short circuits can get very hot. Double-check all of your wiring before you connect the 9 V battery.
Ben Finio, PhD, Science Buddies
Simple Soil Moisture Sensor Circuit


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.

Photo of sprinklers watering a lawn
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

Advanced students who want to understand how the circuit works should also research these terms:



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:

The background sections of these projects are good resources for students who want to learn the basics about circuits:

If you are not familiar with the engineering design process and how it differs from the scientific method, you should review these resources.

These resources will be useful for advanced students who want to learn more about how the circuit works:

Materials and Equipment Buy Kit

Recommended Project Supplies

Get the right supplies — selected and tested to work with this project.

View Kit

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 scibuddy@sciencebuddies.org.

Experimental Procedure

Note: This engineering project is best described by the engineering design process, as opposed to the scientific method. You might want to ask your teacher whether it's acceptable to follow the engineering design process for your project before you begin. You can learn more about the engineering design process in the Science Buddies Engineering Design Process Guide.

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.

Completed board. Connect snap connector to battery. Red lead to (+) bus, black lead to (-) bus. LED should turn on.

Slideshow with step-by-step instructions viewable online.

Part PictureBreadboard Symbol Location
4011 NAND gate
Photo of a 4011 NAND gate
Circuit diagram symbol for a 4011 NAND gate
Rows 1–7, straddling the middle of the breadboard, with semicircular notch facing up
10 MΩ resistor
A ten mega ohm resistor
Circuit diagram symbol for a ten mega ohm resistor
B2 to (-) bus
470 Ω resistor
A four hundred and seventy ohm resistor
Circuit diagram symbol for a four hundred and seventy ohm resistor
B3 to B11
A red LED
Circuit diagram symbol for a red LED
Long lead to A11
Short lead to (-) bus
100 kΩ resistor
A one hundred thousand ohm resistor
Circuit diagram symbol for a one hundred thousand ohm resistor
C2, other lead free
100 kΩ resistor
A one hundred thousand ohm resistor
Circuit diagram symbol for a one hundred thousand ohm resistor
D1, other lead free
9 V battery and snap connector
An Energizer nine volt battery
Circuit diagram symbol for a nine volt battery
Red lead to (+) bus
Black lead to (-) bus
Jumper wires (4)
A red jumper wire
Circuit diagram for a red jumper wire
B1 to (+) bus
J1 to (+) bus
A7 to (-) bus
Left (+) bus to right (+) bus
Table 1. List of circuit components and their locations.

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:

  1. 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).
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. If you cannot get your circuit to work, see the Help section for troubleshooting information.
Two leads from a moisture sensor are inserted into a pile of dry soil and a pile of wet soil
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!

Alligator clips connect two leads from a moisture sensor to sticks of foil that are inserted through the center of a sponge
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.

  1. 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."
  2. 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).
  3. 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.
  4. 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?
  5. 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.
  6. 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.
  7. 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.
  8. 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.

icon scientific method

Ask an Expert

Do you have specific questions about your science project? Our team of volunteer scientists can help. Our Experts won't do the work for you, but they will make suggestions, offer guidance, and help you troubleshoot.

Global Connections

The United Nation's Sustainable Development Goals (UNSDGs) are a blueprint to achieve a better and more sustainable future for all.
This project explores topics key to Responsible Consumption and Production: Ensure sustainable consumption and production patterns.


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)

If you are having trouble with this project, please read the FAQ below. You may find the answer to your question.
Q: My LED always stays on/never turns on. What is wrong?
A: It is very easy to misplace a component, especially if it is your first time using a breadboard. Just one misplaced lead can prevent the entire circuit from working properly. Go back to the slideshow in the Procedure and double-check your circuit, part by part. Be especially careful to count the rows of the breadboard properly. Also make sure that you inserted your LED and 4011 chip correctly. The LED had two leads of slightly different lengths. The long lead should go in hole A11 and the short lead should go in the ground bus. If you put the LED in backwards, it will never light up. The 4011 chip has a small semi-circular notch on one end. This notch should face up, toward row 1. If you put the chip in upside-down, your circuit will not work.
Q: My LED does not turn on when I touch the resistor leads to dry soil. What is wrong?
A: Make sure the soil is completely dry. Even if the soil looks dry to you, it might have enough moisture to have a low resistance. Try leaving a pan of soil out in the sunlight or heating it in an oven at 220 °F (105 °C) for a few hours.
Q: I smelled smoke and now my circuit does not work. What happened?
A: You probably caused a short circuit by incorrectly connecting something on your breadboard. This can happen, for example, if you accidentally connect the LED's leads directly to power (9 V) and ground, which will burn out the LED. Your kit comes with 10 LEDs, so you can just replace it if that happens.
Q: My circuit was working for a while, but now it has stopped. What happened?
A: The battery will drain slowly if you leave the circuit on continuously. If you leave the circuit on for several days straight and it no longer works, try a fresh 9 V battery.
Q: How does the circuit actually work? What is the circuit diagram?
A: The circuit relies on digital logic, or "high" and "low" signals (also referred to as "true" and "false" or "1" and "0" respectively). Digital logic is much too broad of a topic to cover completely in this FAQ, so interested students should refer to the SparkFun Electronics resource in the Bibliography to learn more about it, in general. Specifically, the circuit uses a type of logic gate called a NAND gate ("NAND" stands for "not and"). Table 2 shows the truth table for a NAND gate. You can learn more about the NAND gate used in this project from its datasheet in the Bibliography.

Input A Input B Output J
1 1 0
1 0 1
0 1 1
0 0 1
Table 1. Truth table for a NAND gate.

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).

Circuit diagram for a soil moisture sensor
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.

Circuit diagram for a soil moisture sensor with an LED indicator for dry soil
Circuit diagram for a soil moisture meter with the LED powered off
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:

Career Profile
Soil and water are two of Earth's most important natural resources. Earth would not be able to sustain life without nutritive soil to grow food and clean water to drink. Soil and water conservationists foster the science and art of natural resource conservation. The scientists work to discover, develop, implement, and constantly improve ways to use land that sustains its productive capacity, and enhances the environment at the same time. Soil and water conservationists are involved in improving… Read more
Career Profile
Just as a potter forms clay, or a steel worker molds molten steel, electrical and electronics engineers gather and shape electricity and use it to make products that transmit power or transmit information. Electrical and electronics engineers may specialize in one of the millions of products that make or use electricity, like cell phones, electric motors, microwaves, medical instruments, airline navigation system, or handheld games. Read more
Career Profile
With a growing world population, making sure that there is enough food for everyone is critical. Plant scientists work to ensure that agricultural practices result in an abundance of nutritious food in a sustainable and environmentally friendly manner. Read more
Career Profile
Environmental engineers plan projects around their city or state—like municipal water systems, landfills, recycling centers, or sanitation facilities—that are essential to the health of the people who live there. Environmental engineers also work to minimize the impact of human developments, like new roads or dams, on environments and habitats, and they strive to improve the quality of our air, land, and water. Read more

Contact Us

If 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:
  1. What is your Science Buddies kit order number?
  2. 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?

Contact Us

News Feed on This Topic

, ,

Cite This Page

General citation information is provided here. Be sure to check the formatting, including capitalization, for the method you are using and update your citation, as needed.

MLA Style

Finio, Ben. "Green Technology: Build an Electronic Soil Moisture Sensor to Conserve Water." Science Buddies, 8 Sep. 2023, https://www.sciencebuddies.org/science-fair-projects/project-ideas/Elec_p066/electricity-electronics/build-an-electronic-soil-moisture-sensor-to-conserve-water?from=Blog. Accessed 29 Sep. 2023.

APA Style

Finio, B. (2023, September 8). Green Technology: Build an Electronic Soil Moisture Sensor to Conserve Water. Retrieved from https://www.sciencebuddies.org/science-fair-projects/project-ideas/Elec_p066/electricity-electronics/build-an-electronic-soil-moisture-sensor-to-conserve-water?from=Blog

Last edit date: 2023-09-08
Free science fair projects.