Aula Jazmati πŸ’‘πŸ•ŠοΈACEBOTT
Published © MIT

ACEBOTT Smart Home: Automatic Watering System

Keep your plants happy and healthy even when you're away – an intelligent automatic watering system for your ACEBOTT smart home.

BeginnerFull instructions provided1 hour80

Things used in this project

Hardware components

https://acebott.com/product/acebott-qe024-esp32-5-in-1-smart-home-education-kit-level-2/
×1

Story

Read more

Code

The code

C/C++
#include <Wire.h>
#include <hd44780.h>
#include <hd44780ioClass/hd44780_I2Cexp.h>
#define moistureSensor 25 
#define relay 33 //declare the number of the Relay Module
const int i2cAddress = 0x27; // I2C address
const int numRows = 2; //Number of rows in LCD1602
const int numCols = 16;//Number of columns in LCD1602
hd44780_I2Cexp lcd(i2cAddress,numRows,numCols);
void setup(){
Wire.begin();//Start I2C communication
lcd.begin(numCols,numRows); // Initialize LCD display
lcd.backlight();//Turn on backlight
delay(500);
lcd.clear();//Clear LCD display characters
pinMode(relay,OUTPUT);//Set relay pin as output
pinMode(moistureSensor,INPUT);//Set moisture sensor as input
Serial.begin(115200);
}
void loop(){ //Read moisture sensor value
int moisture_value = analogRead(moistureSensor);
Serial.println(moisture_value);
lcd.setCursor(0, 0);
lcd.print("H:");
lcd.print(moisture_value);//Display soil moisture value on LCD
lcd.setCursor(0, 1);
lcd.print("Water:");
if(moisture_value<1000){
    lcd.print("Turn on");//Turn on water pump:
    digitalWrite(relay,HIGH);
    delay(500);
    digitalWrite(relay,LOW);
  }
  else{
    lcd.print("Turn off");//Turn off water pump:
    digitalWrite(relay,LOW);
  }
  delay(1000);
  lcd.clear();
}

Credits

Aula Jazmati πŸ’‘πŸ•ŠοΈ
72 projects β€’ 234 followers
Electronic Engineering
ACEBOTT
3 projects β€’ 1 follower
πŸ‘¨β€πŸ«Get kit + code: STEM | robotics | maker 🌐Learn more: acebott.com πŸ“©ALL collabs & quotes here: info@acebott.com

Comments