[Arduino] Soil Moisture

Hi,

after tested it with raspberry i tried to do the same with Arduino Uno.

With Arduino Uno is simple obtain the value of how dry/wet is soil of your plants.

What we need is:

  • Arduino Uno
  • Soil Moisture sensor (check it on amazon)
  • Some cables


The connection schema is this:

  • 5V (Arduino) --> VCC (Sensor)
  • GND (Arduino) --> GND (Sensor)
  • A0 (Arduino) --> D0 (SGNL of sensor)








This is the code:



#define SensorPin A0 
float sensorValue = 0
void setup() { 
  Serial.begin(9600); 
void loop() { 
 for (int i = 0i <= 100i++) 
 { 
    sensorValue = sensorValue + analogRead(SensorPin); 
    delay(1); 
 } 
 sensorValue = sensorValue/100.0
 if(sensorValue <= 50)
 {
    Serial.println("Water detected: " + String(sensorValue));  
 }else{
    Serial.println("Low Water level detected: " + String(sensorValue));  
 }
 
 delay(5000); 

and this is the output:



Have fun!!

Commenti