Andrew Kanzler
Published

Soil Moisture Sensor for Arduino

Turn your ordinary garden into a smart one with the help of an Arduino and a Soil Moisture Sensor.

BeginnerProtip1 hour150
Soil Moisture Sensor for Arduino

Things used in this project

Hardware components

Arduino UNO R3
×1
Arduino Soil Moisture Sensor
×1

Story

Read more

Code

Arduino Code

C#
#define SensorPin A0 
float sensorValue = 0; 
void setup() { 
 Serial.begin(9600); 
} 
void loop() { 
 for (int i = 0; i <= 100; i++) 
 { 
   sensorValue = sensorValue + analogRead(SensorPin); 
   delay(1); 
 } 
 sensorValue = sensorValue/100.0; 
 Serial.println(sensorValue); 
 delay(30); 
} 

Credits

Andrew Kanzler

Andrew Kanzler

11 projects • 0 followers

Comments