Fouad_Roboticist
Published

Soil Moisture Monitoring

In This Tutorial i'm going to show you how to setup the serial communication between Arduino and NodeMCU for soil moisture monitoring.

IntermediateFull instructions provided1,263
Soil Moisture Monitoring

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
NodeMCU ESP8266 Breakout Board
NodeMCU ESP8266 Breakout Board
×1
Gravity: Analog Soil Moisture Sensor For Arduino
DFRobot Gravity: Analog Soil Moisture Sensor For Arduino
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Premium Female/Male Extension Jumper Wires, 40 x 6" (150mm)
Premium Female/Male Extension Jumper Wires, 40 x 6" (150mm)

Story

Read more

Custom parts and enclosures

Components Required

Schematics

Connections

Between Arduino & LM393 :

Arduino 5V- LM393 VCC
Arduino GND - LM393 GND
Arduino A0 - LM393 A0 ( analog pins)

Between LM393 & Soil Moisture Sensor :

LM393( +) - Soil Moisture Sensor( +)
LM393 (-) - Soil Moisture (-)

Betweeen NodeMcu & Arduino :

NodeMcu Gnd - Arduino Gnd
NodeMcu TX - Arduino Rx
NodeMcu RX - Arduino TX

Serial Monitoring of Soil Moisture Data

Code

Soil Moisture

Arduino
#define SensorPin A0 
int sensorValue = 0; 
void setup() { 
 Serial.begin(115200); 
} 
void loop() { 
 for (int i = 0; i <= 100; i++) 
 { 
   sensorValue = sensorValue + analogRead(SensorPin); 
   delay(1); 
 } 
 sensorValue = sensorValue/100.0; 
 Serial.println(sensorValue); 
 Serial.print("%");
 delay(1000); 
}
 

Serial Communication Between Arduino & Nodemcu

Arduino
void setup() {
  Serial.begin(115200);
  while (!Serial) {
    ; 
  }
}

void loop() {
  if (Serial.available()) {
    Serial.write(Serial.read());
  }
}

Credits

Fouad_Roboticist

Fouad_Roboticist

1 project • 1 follower

Comments