Top Logo Sp Logo
Use Arduino UNO to Measure Your Soil Moisture and Up-Level Your Gardening Projects

Use Arduino UNO to Measure Your Soil Moisture and Up-Level Your Gardening Projects

Use Arduino UNO to Measure Your Soil Moisture and Up-Level Your Gardening Projects

It’s finally Springtime for gardening season to begin! However, although many would-be gardeners start off the season with good intentions to water all their plants, sometimes it can be easy to forget. And even if you’re a seasoned gardener who’s always thinking about your plants, sometimes it can be difficult to know when your plants are indeed thirsty for more water.

For these reasons, our team here at Vilros loves this Soil Moisture Sensor project inspired by Patel Darshil that will show you how to use Arduino Uno to control a soil moisture sensor with an LCD display, so that you’ll always know when your plants need more water.

Here are the required parts you’ll need for this project:
• Arduino UNO + Genuino UNO
• A Soil Moisture Sensor (Patel recommends this model by SparkFun, which comes with screw terminals)
• Adafruit Standard 16 X2 LCD (Patel recommends this provider)
• Generic Breadboard
• Generic Soldering Iron

You’ll also need to make sure have Arduino Software (IDE) installed and the circuito.io app. Now you’re ready to build!

1. Connect Your Moisture Sensor to Arduino

First, you need to connect up the moisture sensor to Arduino as follows:

• Moisture Sensor 0 X Arduino GND
• Moisture Sensor Sig X Arduino A3
• Moisture Sensor Vin X Arduino 5V

Moisture Sensor

2. Connect Your LCD to Arduino

Next, you need to connect the LCD to Arduino as follows:

• LCD GND X Arduino GND
• LCD SDA X Arduino A4
• LCD SCL X Arduino A5
• LCD VCC X Arduino 5V
You’ll also want to follow these pin assignments:
1 – VSS
2 – VDD
3 – VO
4 – RS
5 – RW
6 – E
7 – D80
8 – D81
9 – D82
10 – D83
11 – D84
12 – D85
13 – D86
14 – D87
15 – LED+
16 – Red
17 – Green
18 – Blue

3. The Code You’ll Need

Here is the bit of code you will need:

#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(5, 4);
// These constants won't change. They're used to give names
// to the pins used:
const int analogInPin = A5; // Analog input pin that the Sensor is attached to
int sensorValue = 0; // value read from the Soil Moisture
void setup() {
// set up the LCD's number of columns and rows:

lcd.begin(16, 2);
delay(100);
}
void loop() {
lcd.clear();
lcd.print("Soil Moisture:");// print the results to the LCD Display:
sensorValue = analogRead(analogInPin);// read the analog in value:
lcd.setCursor(0, 1);
lcd.print(sensorValue);
// wait 300 milliseconds before the next loop for the
//analog-to-digital converter to settle after the last reading:
delay(300);}

4. Schematics

You’ll also want to make sure you have your set-up correct. Check the schematics, which can be found here.

You’re all set! Now you should be ready to monitor the soil moisture for your plants using Arduino UNO. If you want even more details about this project, you can find additional resources here.

All of us here at Vilros hopes your garden is blooming with this Arduino UNO project. If you’re interested in more project ideas using Arduino or Raspberry Pi, don’t forget to bookmark our Vilros Projects blog so you can find lots of fun new projects to try!

Shop the story