Automatic Plant Watering System using Arduino & Soil Moisture Sensor | LCD display [with CODE]
Summary
TLDRThis Arduino tutorial video builds on a previous lesson about soil moisture sensors by integrating an LCD module and a water pump to create an automatic plant watering system. The required components include an Arduino board, soil moisture sensor, LCD module, relay module, a 9-volt water pump, and jumper wires. The script outlines the connections for each part and provides a code example that activates the pump when soil is dry, displaying status on the LCD. The demonstration shows the system in action, automatically watering the plant when needed.
Takeaways
- 😀 The video is an Arduino tutorial focused on creating an automatic plant watering system.
- 🔧 The main components needed are an Arduino board, a soil moisture sensor, an LCD module, a relay module, a water pump, and jumper wires.
- 📐 The LCD module used is a 16x2 I2C model, which simplifies the wiring process.
- 🔌 Connections involve linking the VCC and ground of all components to the Arduino's 5V and ground, with specific pins for the sensor, LCD, and relay.
- 💧 The soil moisture sensor's analog output is connected to Arduino's analog pin A0.
- 🖥 The LCD module's SDA and SCL pins are connected to Arduino's analog A4 and A5 pins, respectively.
- 🔘 The relay module's signal input is connected to a digital pin on the Arduino, in this case, digital pin 7.
- 🌡 The water pump's operation is controlled by the relay module, which is activated when the soil is dry based on sensor readings.
- 📊 The code includes logic to determine soil moisture levels and activate the pump accordingly.
- 💬 The LCD displays the soil moisture status and the motor's (pump's) status.
- 🔧 A demonstration is provided showing the system in action, with the pump turning on when the soil is dry and off when it's wet.
Q & A
What is the main focus of the video tutorial?
-The main focus of the video tutorial is to demonstrate how to add an LCD module and a water pump to an existing soil moisture sensor setup to create an automatic plant watering system using an Arduino board.
What is the purpose of using an LCD module in this project?
-The purpose of using an LCD module is to display the moisture content of the soil, providing a visual representation of the sensor readings.
What type of water pump is used in the tutorial?
-A small 9-volt water pump is used in the tutorial for the automatic plant watering system.
What is the role of the relay module in this setup?
-The relay module is used to control the water pump's operation based on the soil moisture levels read by the sensor.
Which pins on the Arduino board are used for the LCD module connections?
-The LCD module's VCC and ground are connected to the Arduino's 5V and ground. The SDA pin is connected to the Arduino's analog A4 pin, and the SCL pin is connected to the Arduino's analog A5 pin.
How is the soil moisture sensor connected to the Arduino board?
-The soil moisture sensor's VCC and ground are connected to the Arduino's 5V and ground, and the analog output pin is connected to the Arduino's analog pin A0.
What is the significance of the value 950 in the code?
-The value 950 is used as a threshold in the code to determine when the soil is dry and needs watering, triggering the relay to activate the water pump.
How does the code differentiate between dry, medium, and wet soil conditions?
-The code uses if-else statements to evaluate the sensor values. If the value is greater than 950, the soil is considered dry. If the value is between a certain range (not specified in the transcript), the soil is medium. If less than 400, it is considered wet.
What function is used to control the relay pin in the code?
-The `digitalWrite` function is used to control the relay pin, which is connected to digital pin 7, to turn the water pump on or off based on the soil moisture levels.
How is the status of the soil and the motor displayed on the LCD?
-The status of the soil (dry, medium, wet) and the motor status (on or off) are displayed on the LCD using the LCD module's commands, with the soil status on the first row and the motor status on the second row.
What is the purpose of the demonstration at the end of the tutorial?
-The purpose of the demonstration is to show the automatic plant watering system in action, illustrating how the system monitors soil moisture and triggers the water pump when the soil is dry.
Outlines
💧 Building an Automatic Plant Watering System with Arduino
This paragraph introduces an Arduino tutorial focused on creating an automatic plant watering system. The tutorial builds upon a previous video that explained the basic operation of a soil moisture sensor and included basic code for reading moisture values. The project incorporates an LCD module for displaying moisture content and a water pump for automatic watering. The required components include an Arduino board, soil moisture sensor, 16x2 LCD module with an I2C interface, a single-channel relay module, a 9-volt water pump, a power supply, and jumper wires. The paragraph details the connections for each component, starting with the moisture sensor to the Arduino's 5V and GND, and the analog output to pin A0. The LCD module is connected to the same power and ground, with the SDA and SCL pins connected to A4 and A5, respectively. The relay module is also connected to 5V and GND, with its signal input connected to a digital pin (in this case, pin 7). The water pump's negative terminal is connected to the battery's negative terminal, and the positive terminals are connected to the relay module's common and normally open terminals. The paragraph concludes with a reference to a separate tutorial on relay basics and a link to the circuit diagram in the description box.
🔧 Implementing the Watering System Logic and LCD Display
In this paragraph, the script outlines the coding process for the automatic plant watering system. It begins with a review of the existing code from a previous tutorial, which reads sensor values and evaluates them using if-else statements to determine soil moisture levels. The code is then expanded to include logic for activating a pump when the soil is dry, indicated by a sensor value greater than 950. The script explains the use of a digital pin (pin 7) to control the relay, which in turn controls the water pump. The code also includes logic to handle different soil moisture conditions, ensuring the pump is off when the soil is medium or wet. Additionally, the paragraph describes the integration of an LCD module to display information about the soil's moisture status and the pump's operation. It references previous tutorials for understanding the basics of LCD coding and mentions the use of a 16x2 LCD. The script provides a brief overview of the LCD's setup, including initialization functions and displaying messages on the LCD based on the soil moisture condition. The paragraph concludes with a demonstration of the system in action, showing how the motor starts when the soil is dry and stops once the soil is wet, after adding water to the soil.
Mindmap
Keywords
💡Arduino
💡Soil Moisture Sensor
💡LCD Module
💡i2c Interface
💡Relay Module
💡Water Pump
💡Jumper Wires
💡Analog Pin
💡Digital Pin
💡Circuit
💡Code
Highlights
Introduction to the tutorial on adding an LCD module and a water pump to an Arduino project for an automatic plant watering system.
Explanation of the components needed including an Arduino board, soil moisture sensor, LCD module, relay module, water pump, and jumper wires.
Emphasis on using an I2C module for easier LCD connection.
Description of the connections starting with the Arduino 5V and ground for all components.
Connection details for the soil moisture sensor to the Arduino analog pin A0.
Instructions for connecting the LCD module to the Arduino, including the SDA and SCL pins.
Relay module connection to the Arduino and the significance of the signal input pin.
Water pump connection details, including the connection to the relay module.
Brief mention of a separate tutorial on the basics of relays.
Code review from a previous tutorial and the addition of logic for the water pump activation.
Explanation of the if-else statements used to evaluate soil moisture levels and activate the pump when dry.
Declaration of the relay pin and setting it as an output for pump control.
Demonstration of the pump activation when soil moisture is below a certain threshold.
Logic for keeping the pump off when soil is medium or wet.
Introduction of LCD logic to display soil and motor status.
Details on LCD initialization and status display for different soil conditions.
Demonstration of the system in action, showing the LCD updates and motor activation.
Final remarks on the system's ability to monitor moisture and trigger the motor automatically.
Invitation for viewers to ask questions in the comments and a prompt to visit the provided links for code and circuit details.
Transcripts
[Music]
foreign
[Music]
part of the Arduino tutorials
in my previous video
I have already explained the basic
working of the soil moisture sensor and
also we have done some basic code to
read the moisture values from the soil
so in continuation to that video
we'll be additionally adding an LCD
module to display the moisture content
and also
a small water pump to make an automatic
plant watering system
[Music]
the components needed for this tutorial
are Arduino board
soil moisture sensor
LCD module
I am using this 16 Cross 2 module
along with this iTunes interface so if
you're planning to buy make sure
you have this i2c module
which makes your connection easier
next we need a single Channel relay
module
a small water pump
here I'll be using this nine volt one
a power supply corresponding to your
water pump
and finally some jumper wires
moving on to the connections
I'll be taking the Arduino 5 volt and
ground
on the breadboard
since we need it for all the components
starting with the moisture sensor
the VCC and ground
goes to Arduino 5 volt and ground
and the analog output pin a0
is connected to Arduino
analog pin a0
on the LCD module
the VCC and ground
again goes to
Arduino 5010 ground
the SDA pin
is connected to Arduino analog A4 pin
and scl
connected to Arduino analog pin A5
moving to the relay module
again the VCC ground
is connected to Arduino 5 volt and
ground
and the signal input pin
can be connected to any digital pin
here I am using the digital pin 7.
and moving to the last component the
water pump
so the negative terminal
of the pump is connected to negative
terminal of the battery
the left out positive terminals
of both
will be connected to the relay module
so one goes to the common terminal
foreign
should be connected to normally open
Terminal
so if you want to understand the basics
of relay I have already made a separate
tutorial you can check out
that's it the connections if you face
any difficulties follow the circuit link
provided in the description box
moving to the code
here I have already opened the code from
my previous tutorial
here we have just read the sensor pin
and using simple if else statements we
have evaluated the values
coming from the sensor
so if it's greater than this value then
there'll be no moisture and soil will be
dry
and if the values from the sensor is
between this range then the soil is the
medium condition and for less than 400
it is wet
so this condition checks remains same
additionally we'll try adding the logic
to activate the pump
so in this three cases we have to just
run the pump when soil is dry so I have
to add
the relay activation here in this first
if statement
before that we'll declare the pin we
have connected the relay using in data
type
relay pin is connected to digital pin 7
and also in the setup
will set the pin mode
as output
so we have to use the digital write
function
when my sensor data is greater than 950
it indicate soil is dry so I am
activating the relay which
indirectly
starts the motor or the pump relay pin
will make it high
and coming to other conditions so here
soil is medium
so we have to
keep our pump Switched Off
same digital right
but pump will be off
also in the last statement it says soil
is wet again we have to switch off the
pump
so same logic goes here as well
that's all the logic for the pump
will also add some logic to print some
information on the LCD
so here I'll not go in depth for the LCD
commands
you can refer to my previous tutorials
to understand basics of LCD coding
just
including the header file
and creating some object for this class
also in the setup we have to call some
initialization functions
so all these Basics I have already
explained in my previous tutorials
I'm using 16 Cross to LCD
so when it comes to this if statement
I'll just show
the status as soil is dry in the first
row of the LCD
in the second row of the LCD
I'll give you information on the motor
status here
my motor will be on
so I'll give motor on
so I'll copy the same
lines for other statements
here
the soil status will be medium
and motor will be off
and the last statement
soil is wet
and the motor will be off
so that's all the logic
for LCD
I'll upload this and see how this works
initially I have kept the battery
disconnected
for the water pump
and I'll insert the sensor module into
the pot
in which the soil is already dry
since the soil is dry on the LCD showing
soil dry and also the motor on
as soon as I connect the battery
the motor started running
[Music]
so just for demonstration I'll add some
water
as soon as there is inner water
the status
shows soil is wet and also motor is off
in this way the system monitors the
moisture and whenever needed it triggers
the motor automatically
so that's all for this video
if you have any doubts let me know in
the comment section below
for code and circuit visit the link in
the description box
thank you for watching and we'll be back
in another interesting tutorial
foreign
تصفح المزيد من مقاطع الفيديو ذات الصلة
New Blynk IOT Smart Plant Monitoring System
Membuat Kipas Otomatis Berdasarkan Suhu Berbasis Arduino || Sensor Suhu DHT-11
Smart Glove for Dumb and Deaf People with Home Automation Project | using Arduino and Flex Sensor
Introduction to Arduino Mega 2560 | Pinout | Features | Proteus Simulation
Bulk Density May 2016
VERY EASY Arduino IR Sensor Tutorial for Beginners | IR Sensor Arduino Tutorial | Infrared Sensor
5.0 / 5 (0 votes)