Plant Water Level Checker + Indicator
by AbiOnInstruct in Circuits > Arduino
120 Views, 2 Favorites, 0 Comments
Plant Water Level Checker + Indicator
The purpose of this project is to condition the user to be more likely to water their plant when it is low on water. This is because many users forget to water their plant on a daily basis, to solve this problem I provided a buzzer and a knight rider chaser to visually and audibly alert the user to water their plant. When they go to check their plant, they are able to see on the LCD that the plant is not watered. NOTE: In the tinkerCAD the buzzer is not added. It is optional to add a buzzer if you would like to although may might be annoying to others.
Supplies
- Soil Moisture Sensor - 1
- Liquid Crystal Display I2C - 1
- CD4017 - 1
- 555 Timer - 1
- Slide Switch - 1
- LEDs - 6
- Wires
- 10 uF Polarized Capacitor - 1
- 1K Ohm Resistor - 9
- 10K Ohm Resistor - 2
- 330 Ohm Resistor - 1
- Arduino UNO R3 - 1
- Buzzer - 1
- Plant in soil - 1
- Water
Create the Rider Circuit
This circuit will be used as an indicator of when the plant is under-watered. Wire this circuit from the schematic on the breadboard. Make sure the wire that powers the Rider Circuit is connected to one of the pins of the circuit. NOTE: Power to R1 or the first resistor that is a 1k Ohm resistor and will need to be changed to have it connected to one of the Arduino Pins. R3 or the third resistor does not have a 1k Ohm resistor for this project, but instead has a 330 Ohm resistor.
Wire the Liquid Crystal Display
The Liquid Crystal Display I2C displays if the plant is watered, over-watered, under watered. This is used to help the user visually understand what they need to do to turn off the indicator. The Liquid Crystal Display has 4 pins. GND which requires ground. VCC which requires power. SDA and SDL which will need to be wired by a wire connected to the Arduino.
Wire the Capacitive Soil Moisture Sensor V1.2
The Capacitive Soil Moisture Sensor is used to check for enough water in the soil the sensor is placed in. The sensor has 3 pins. GND which requires ground. VCC which requires power. AOUT which will need to be wired depending on the wire connected to the pin used specifically for the Capacitive Soil Moisture Sensor in the Arduino.
Wire the Switch
The Switch is used to turn on and off the circuit. The switch has 3 pins. The middle pin is the common pin which will be connected to the Arduino. The other two pins will have one pin connected to ground and the other pin connected to power.
Wire the Buzzer
The buzzer is optional for this project, but I added this in for additional functionality. The buzzer is used as an indicator as well. The buzzer has a negative and positive pin. The positive pin is longer. Connect the negative pin to the ground and the positive pin to the Arduino.
Download LCD I2C Library
Go to the link provided above, and scroll down to releases. Press 1.1.2 and wait for it to download a zip file. Now extract the zip file and place the extracted folder into the libraries folder, which can be found in the Arduino folder.
The Code
// Library for LCD functionality
#include <LiquidCrystal_I2C.h>
// Initialize LCD
LiquidCrystal_I2C lcd(0x27, 16, 2);
// Define pin numbers for the components
int riderCircuit = 8; // Pin connected to the riderCircuit
int slideSwitch = 11; // Pin connected to the slide switch
int buzzer = 7; // Pin connected to buzzer
void setup()
{
// Start serial monitor
Serial.begin(9600);
// Initialize LCD
lcd.init();
lcd.backlight();
// Set pin modes
pinMode(slideSwitch, INPUT);
pinMode(riderCircuit, OUTPUT);
pinMode(buzzer, OUTPUT);
}
//Function for buzzer tone to be set
void buzzerTone(){
tone(buzzer, 1000);
}
// Function to update the LCD depending on soil moisture sensor value
void setLCD()
{
// Reads the value from soil moisture sensor
int sensorVal = analogRead(A0);
// Checks if the system is turned ON
if (digitalRead(slideSwitch) == HIGH)
{
// Prints soil moisture sensor value
Serial.println(sensorVal);
// Displays a certain message on the LCD depending on the soil moisture sensor value
if (sensorVal <=250)
{
lcd.clear();
lcd.print("Plant is");
lcd.setCursor(0, 1);
lcd.print("over watered!");
delay(2000);
lcd.clear();
delay(2000);
}
else if (sensorVal >= 425)
{
lcd.clear();
lcd.print("Plant needs to");
lcd.setCursor(0, 1);
lcd.print("be watered!");
delay(2000);
lcd.clear();
delay(2000);
}
else
{
lcd.clear();
lcd.print("Plant is watered!");
delay(2000);
lcd.clear();
delay(2000);
}
}
else
{
// Displays a message when the system is switched OFF
Serial.println("Circuit is OFF");
lcd.clear();
delay(2000);
}
}
// Function to control the rider circuit
void setRiderCircuit()
{
// Reads the value from soil moisture sensor
int sensorVal = analogRead(A0);
// Check if the system is switched ON
if (digitalRead(slideSwitch) == HIGH)
{
// Control the rider circuit based on soil moisture level
if (sensorVal <= 300)
{
// If soil is overwatered, turn off the riderCircuit
digitalWrite(riderCircuit, LOW);
noTone(buzzer);
}
else if (sensorVal >= 425)
{
// If soil is under watered, turn on the riderCircuit
digitalWrite(riderCircuit, HIGH);
buzzerTone();
}
else
{
// If soil moisture sensor is water, keep riderCircuit off
digitalWrite(riderCircuit, LOW);
noTone(buzzer);
}
}
else
{
// If slide switch is set to be switched OFF, keep riderCircuit off
digitalWrite(riderCircuit, LOW);
noTone(buzzer);
}
}
void loop()
{
// Call functions to update LCD and the riderCircuit
setLCD();
setRiderCircuit();
}
//NOTE THAT YOU MUST DOWNLOAD THE ZIP FILE OF THE LCD I2C LIBRARY AND PUT IT IN YOUR LIBRARIES FOLDER IN ORDER FOR THE FUNCTIONS OF THE LCD TO WORK
Demo
This is how the project should look like once it is completed.