Arduino Projects

Interface Capacitive Soil moisture sensor v1.2 with Arduino, LCD and OLED

Learn how to interface a latest capacitive soil moisture sensor with Arduino and display the moisture percentage of soil on LCD display with I2C adapter

Overview

In this quick tutorial you are going to learn how to connect the capacitive soil moisture sensor v1.2 with Arduino and get soil moisture percentage displayed on the 16X2 LCD display with I2C module. and also learn how to calibrate the capacitive moisture sensor to get the correct soil moisture percentage.

You can build an Automatic plant watering system with this project. If you are interested refer the below article link.

Before getting started lets learn in detail about the sensor, its advantages and how it works.

Capacitive Soil Moisture sensor v1.2 and its advantages:

As the name indicates capacitive moisture sensor is a sensor which senses the moisture in the soil, the moisture in the soil can be measured using two methods resistive and capacitive, This v1.2 sensor uses capacitive method instead the resistive method which was used in the previous versions of the sensor.

capacitive soil moisture sensor v1 2

The above image shows an analog capacitive soil moisture sensor which measures the volumetric amount of moisture levels present in soil. unlike other moisture sensors which uses DC current with two metallic electrodes printed on the silicon board which cause the electroplating activity on one electrode and the metals corrode by damaging the sensor permanently with in one month. This capacitive one is the best moisture sensor which has the best build quality made of non-corrosive materials. With capacitive sensor it outputs analog signals and the metallic parts are not exposed to water which tends to long time run of the sensor.

This sensor module has an onboard voltage regulator which made it to work under voltages between 3.3 to 5.5V which makes it compatible with all the major microcontrollers available.

Pinout diagram:

The sensor has 3 pins GND, VCC and Aout.

capacitive soil moisture sensor v1.2 pinout

Features & specifications of Capacitive moisture sensor v1.2

  • Works from 3.3v to 5.5v
  • Output analog Voltage: 0 ~ 3.0 VDC
  • Supports 3-Pin Sensor interface
  • Interface: PH2.0-3P

Working principle of Capacitive moisture sensor:

First let’s learn in a simple way, as we all know a capacitor consists of 3 pieces. A positive plate, a negative plate and the gap between the plates known as di-electric. there are different physical forms of capacitors but all have two metal plates and di-electric between them.

A capacitive moisture sensor works by measuring capacitance changes caused by the changes in the dielectric. It does not measure soil moisture directly (as pure water does not conduct electricity well),  instead it measures the ions that are dissolved in the moisture. Capacitive measuring basically measures the dielectric that is formed by the soil and the water is the most important factor that affects the dielectric.

capacitive soil moisture sensor v1.2 555 timer ic

The capacitance of the sensor is measured with the help of a 555 timer based circuit that creates a voltage which is directly proportional to the capacitor inserted in the soil. We then measure this voltage by use of an Analog to Digital Converter which produces a value that we represent as percentage of soil moisture.

Capacitive Soil Moisture Sensor v1.2 Hardware Schematic

Capacitive Soil Moisture Sensor hardware Schematic

The above schematic image represents the onboard hardware schematic diagram of capacitive soil moisture sensor. where you can see a fixed frequency oscillator which is built using a 8 pin DIL8 555 timer IC (NE555) a square wave pulse generator. The square wave signal made out of 555 timer circuit is connected to the sensor which is capacitor in our case. As we know capacitors has a reactance (storing the extra unwanted energy on the plates and releases it when discharged with out dissipating as heat in the case of resistor) so a voltage divider is created by connecting a 10k ohm resistor from pin 3 to a capacitor.

The concept behind this is “higher the soil moisture in the sensor, the capacitance is higher on the sensor”.¬† So when higher capacitance is observed on the sensor, the smaller the reactance to the square wave. which produces low voltage on signal line. This voltage is measured through the analog inputs on the microcontrollers and moisture levels in the soil are calculated.

Interfacing capacitive soil moisture sensor v1.2 with Arduino and display on serial monitor and LCD display module

After learning the working and principles of sensor above, now lets build the soil moisture meter by connecting the Arduino with Capacitive soil moisture sensor and LCD module with I2C or without I2C to display the soil moisture percentage.

Required components:

  • Arduino UNO R3
  • Capacitive moisture sensor v1.2
  • 16X2 LCD module with I2C
  • Few connecting wires

Circuit Diagram:

Interfacing capacitive soil moisture sensor with arduino and lcdConnect all the required components with connecting wires according to the above schematic diagram. here we connected the signal pin AOUT from sensor to A0 of Arduino, VCC and GND of sensor is connected to 3.3v and GND of Arduino respectively. We connected the 16X2 LCD display module with Arduino through I2C communication as it uses only 4 wires. If you need to connect it with out I2c refer the below link.

Source code:

After connecting all the components upload the below code, also install the required libraries from this libraries link.

Required Libraries:

  • Liquidcrystal_I2C
Calibration values:

to get the airvalue and watervalue use the calibration code at the end of the article.

After uploading the code LCD display outputs as the below image.

Interfacing capacitive moisture sensor with arduino and lcd display

Interfacing capacitive soil moisture sensor v1.2 with Arduino and display on OLED display module

In this method we are going to output the moisture percentage value on OLED display. follow the below instructions step by step.

Required components:

  • Arduino UNO R3
  • Capacitive moisture sensor v1.2
  • 0.96″ I2C OLED display module
  • Few connecting wires

Circuit diagram:

SOIL MOISTURE METER INTERFACING CAPACITIVE SENSOR WITH ARDUINO AND OLED DISPLAY

Connect all the required components with connecting wires according to the above schematic diagram. here we connected the signal pin AOUT from sensor to A0 of Arduino, VCC and GND of sensor is connected to 3.3v and GND of Arduino respectively. We connected the OLED display module with Arduino. For more details on connecting OLED display with Arduino refer the below article link.

Source code:

After connecting all the components upload the below code, also install the required libraries from this libraries link.

Required Libraries:

  • Adafruit_GFX.h
  • Adafruit_SSD1306.h
Calibration values:

To get the airvalue and watervalue use the calibration code which is at the end of the article.

After uploading the code OLED display outputs as the below image.

Interfacing capacitive moisture sensor with arduino and oled display output

Capacitive soil moisture sensor calibration code:

while calibrating follow the rules as shown in the below picture

capacitive soil moisture sensor calibration

Useful ideas:

  • To make the sensor last long apply nail polish enamel on the sides of the open silicon chip to protect from water.
  • Use a silicon glue or some tubing to protect the circuits above the warning line as they are not water proof.

If you find this project helpful please share it with your friends, and if you have any doubts or got any issues regarding this project please feel free to comment below or ask us on facebook community page “Circuit Schools“. Your interest makes us happy and help to add more projects. Thanks and happy creations.

CircuitSchools Staff

We at CircuitSchools publish on basics of electronics and electric components and everything related to evolution of electrical technology with complete analysis of development boards and modules along with latest projects with innovative ideas.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button