MisterBotBreak
Published

How to Use a Soil Moisture Sensor

This little project will show you how to use a soil moisture sensor.

BeginnerProtip1 hour46,167
How to Use a Soil Moisture Sensor

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
Soil Moisture Sensor
×1
LED (generic)
LED (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Code

Soil Moisture Sensor

Arduino
int sensorPin = A0; 
int sensorValue;  
int limit = 300; 

void setup() {
 Serial.begin(9600);
 pinMode(13, OUTPUT);
}

void loop() {

 sensorValue = analogRead(sensorPin); 
 Serial.println("Analog Value : ");
 Serial.println(sensorValue);
 
 if (sensorValue<limit) {
 digitalWrite(13, HIGH); 
 }
 else {
 digitalWrite(13, LOW); 
 }
 
 delay(1000); 
}

Credits

MisterBotBreak

MisterBotBreak

40 projects • 81 followers
I love electronic and I make explanatory project on how to control sensors.

Comments