Intro
Hello and welcome to a new project from Aero Arduino! today, we’re delving into the fascinating world of soil moisture monitoring using Arduino and an LCD display. If you haven’t subscribed to our newsletter yet, please do so to stay updated with our latest projects.
Understanding the Components:
The setup for this project involves three main components:
- Arduino Uno Board: The heart of our project.
- Soil Moisture Sensor: This sensor is vital for gauging the moisture content in the soil.
- 16×2 LCD Display: To visually represent the soil moisture readings.
You may Also like This Arduino Clock Project
Circuit Connections:
The circuit connections are surprisingly simple. Here’s a quick breakdown:
- Power Connection: The soil moisture sensor’s power is connected to A0 on the Arduino. However, it’s crucial to note that we don’t connect it directly to 5 volts. Instead, we control the power to minimize metal corrosion since the sensor is always in contact with the soil.
- Ground Connection: The ground of the soil moisture sensor is connected to the ground pin on the Arduino.
- Signal Connection: The sensor’s signal pin is connected to analog input A1 on the Arduino board. This pin reads the analog signals from the soil moisture sensor.
- LCD Connection: The LCD is connected to the Arduino using four data pins and two control pins (enable and register select). Additionally, there’s a connection for backlight LED, appropriately regulated to avoid overpowering.
The Code
In the Arduino code, we initialize the LCD and read the soil moisture data from the sensor. The moisture level is then displayed on the LCD in real-time. By manipulating the moisture sensor’s readings, you can use this setup for various applications, including controlling irrigation systems.
#include <LiquidCrystal.h>
int moisture = 0;
LiquidCrystal lcd_1(7, 8, 9, 10, 11, 12);
void setup()
{
lcd_1.begin(16, 2); // Set up the number of columns and rows on the LCD.
pinMode(A0, OUTPUT);
pinMode(A1, INPUT);
}
void loop()
{
delay(1); // Wait for 1 millisecond(s)
// Apply power to the soil moisture sensor
digitalWrite(A0, HIGH);
delay(10); // Wait for 10 millisecond(s)
moisture = analogRead(A1);
// Turn off the sensor to reduce metal corrosion for long time
digitalWrite(A0, LOW);
lcd_1.setCursor(0, 0);
lcd_1.print("Moisture : " );
lcd_1.print(moisture);
delay(1000); // Wait for 1000 millisecond(s)
lcd_1.clear();
}
Circuit Simulation:
Press Start Simulation on Tinkercad Model to see how the circuit is working in action.
This project showcases a simple yet effective way to monitor soil moisture, providing valuable data for agricultural or gardening applications. By combining the power of Arduino with sensors like the soil moisture sensor, the possibilities for creating smart, responsive systems are virtually endless.
Final
For a detailed tutorial, including the circuit diagram and code samples, you can access the Tinkercad model and the complete code here If you found this post helpful, please like, share, and subscribe for more exciting projects. Thank you for joining us, and until next time, happy experimenting!