Ahmad RIzqi Nanda Baihaqi, Baianjaay
Published

Plant watering system based on IoT (Internet of Things)

This project is useful for people who forget to water their plants properly.

BeginnerProtip313
Plant watering system based on IoT (Internet of Things)

Things used in this project

Hardware components

ESP32
Espressif ESP32
×1
Relay (generic)
×1
SparkFun Soil Moisture Sensor (with Screw Terminals)
SparkFun Soil Moisture Sensor (with Screw Terminals)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
PHPoC Bread Board
PHPoC Bread Board
×1

Software apps and online services

Arduino IDE
Arduino IDE
Blynk
Blynk

Hand tools and fabrication machines

Multitool, Screwdriver
Multitool, Screwdriver
Plier, Cutting
Plier, Cutting

Story

Read more

Schematics

wiring diagram

Code

ariznbai_v3.ino

C/C++
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxx";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "ssidxxx";
char pass[] = "passxxx";


WidgetLED led1(V4);
WidgetLED led2(V3);
int sensor1 = 14;
int sensor2 = 27;
int sensorPin = 2;   // Input pin for the Flame Sensor
int sensorValue = 1;  // Variable to store the value coming from the flame sensor
int relay1       = 23;
int relay2       = 22; //buat buzzer

void setup()
{
  // Debug console
  pinMode(sensor2,INPUT);
  pinMode(sensor1,INPUT);
  pinMode(relay1, OUTPUT);
  pinMode(relay1, HIGH);
  pinMode(relay2, OUTPUT);
  pinMode(relay2, HIGH);
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass, "blynk-cloud.com",8080);
  pinMode(2, INPUT);
  while (Blynk.connect() == false) {
  }
 
}

void loop()
{
  Blynk.run();
  sensorValue = digitalRead(sensorPin);
  if (sensorValue == 1) {
    Blynk.notify("Saya hausssss");
  }

   int sensorval1 = digitalRead(sensor1);
  int sensorval2 = digitalRead(sensor2);
  Serial.println(sensorval1);
  Serial.println(sensorval2);
  delay(1000);
  
    if (sensorval1 == 1)
    {
  led1.on();
  }
    if (sensorval2 == 1)
    {
  led2.on();
  }

    if (sensorval1 == 0)
    {
  led1.off();
  }
    if (sensorval2 == 0)
    {
  led2.off();
}
}

Credits

Ahmad RIzqi Nanda Baihaqi, Baianjaay

Ahmad RIzqi Nanda Baihaqi, Baianjaay

1 project • 0 followers

Comments

Add projectSign up / Login