Detailed Tutorial
1. Introduction:
This tutorial explains how to read soil moisture data using Analog Soil Moisture Sensor on Arduino Platform.
Robo India offers Soil moisture sensor that gives analog signal. So here in this tutorial we are reading data from Analog Moisture Sensor, so we will get reading in the range 0 to 1023. Lesser the value means lesser the moisture in soil.
2. Circuit
Make following connections of Analog Soil Moisture Sensor to Arduino in the following manner.
3. Programming
You may download following code from here.
const int soil_sensor = A0; // Analog input pin that the soil moisture sensor is attached to int sensorValue = 0; // store sensor input value void setup() { // initialize serial communications at 9600 bps: Serial.begin(9600); } void loop() { // read the sensor: sensorValue = analogRead(soil_sensor); // print the sensor results to the serial monitor: Serial.print("Moisture Value = " ); Serial.println(sensorValue); // delay of one second delay(1000); }
6. Output
Run the following code and you will get the following output.
This is how to use analog soil mositure sensors on Arduino