top of page

TECHNOLOGY

A capacitive moisture sensor measures the ratio of ions dissolved in the soil. Typically, if dirt is dry, the ions are relatively stable and don’t move around. When water is added, the ions move about more freely. When the sensor is hooked up to a microcontroller, like an Arduino, and some code is written, the sensor outputs the percentage of water content in the soil based on the dissolved ion ratio.

cap_soil_moisture_sensor_in_soil_edited.jpg
Technology: Welcome

HOW THE MOISTURE SENSORS WORK

RESISTIVE SENSOR

A resistance moisture sensor is a sensor that measures the resistance of the soil via a DC current passing through its 2 (metal) probes, a cathode and an anode. The more water there is, the more electricity the soil will conduct , the less resistance there will be, which means the output will be higher. The less water there is, the less electricity the soil will conduct, the more resistance there will be, which means the output will be lower. So the sensor doesn’t actually measure the moisture content, but rather how well the dirt conducts electricity.

CAPACITIVE SENSOR

A capacitive moisture sensor is made up of a dielectric material (poor conductor) placed between a pair of electrodes, an anode (positive electrode), and a cathode (negative electrode). This sensor does not measure conductivity at all. In fact, it doesn’t even measure moisture. The capacitive moisture sensor is a sensor that measures the ratio of ions dissolved in the water. That can be a little tricky to grasp, but basically, all dirt has a certain number of ions and that number is dependent upon what that dirt is made up of. Some dirt naturally has more ions than other dirt and if the dirt is dry, the ions are relatively stable and don’t move around. When water is introduced to dirt, water allows those ions to move around more freely. The sensor is able to track the ion movement: 


The more water there is, the lower the ratio of dissolved ions, meaning the output will be smaller. The less water there is, the ratio of dissolved ions in the water will be bigger, meaning the output will be bigger. 


That seems a little backwards. You might think that more water would give you a higher output, but it might help to think of the output value like this: imagine you have a half cup of water in one glass and a gallon in another. If you add a tablespoon of salt, the half cup will be more salty and show a higher output. The gallon, because there is more liquid, will be less salty and have a lower output.

WHICH ONE IS BETTER?

While each sensor has its advantages and disadvantages, the capacitive sensor is better for my project. The readings are much more accurate than the resistive one. Also, because the resistive sensor has two metal probes that will be in contact with water, the two metal probes will corrode due to electrolysis. 

Technology: List

WHAT IS AN ARDUINO?

An Arduino is a microcontroller. A microcontroller is an electronic component that is like the brain of an appliance. This includes appliances like microwaves, refrigerators, washing machines, etc. use microcontrollers. The Arduino is what allows us to see the output from the sensor and determine the soil's moisture content.


In the future, I hope to add additional inputs, like Bluetooth, solar charging, and even pH sensors, which all can be hooked up to the Arduino.

Technology: Text

THE CODE

Here is a copy of the code.

  • First, the Arduino looks for information to gather from pin A0.

  • Next, the variable sensorValue comes in to be used later. It must be assigned 0 or it will not output the right numbers.

  • Lastly, there is a for loop on line 9. The loop allows the Arduino to constantly gather information and output numbers.

  • Inside the for loop, there is logic. The logic is what makes the Arduino output the correct numbers. The logic consists of a math formula that takes the sensor's readings and displays them as percentages from a range of 0 to 100.

image (1).png
Technology: About the Project
bottom of page