TAUFIQ IKROM JAMILAisyah Rohmawati
Published

Rain notification using esp32 and blynk

Rain notifications use the Blynk application, where when the sensor detects rain, a notification will appear in the Blynk and Gmail applicat

BeginnerFull instructions provided2 days308
Rain notification using esp32 and blynk

Things used in this project

Hardware components

FireBeetle ESP32 IOT Microcontroller (Supports Wi-Fi & Bluetooth)
DFRobot FireBeetle ESP32 IOT Microcontroller (Supports Wi-Fi & Bluetooth)
×1
kabel jumper male to female
×1
Raindrops rain
×1
Buzzer
Buzzer
×1

Software apps and online services

Arduino IDE
Arduino IDE
Blynk
Blynk

Hand tools and fabrication machines

Plier, Long Nose
Plier, Long Nose

Story

Read more

Custom parts and enclosures

Rain notification using esp32 and blynk

Schematics

Rain notification using esp32 and blynk

Code

Rain notification using esp32 and blynk

C/C++
#define BLYNK_TEMPLATE_ID "TMPL6I5vSmQTt"
#define BLYNK_TEMPLATE_NAME "NOTIFIKASI HUJAN"
#define BLYNK_AUTH_TOKEN "Co718u70V31kGp4laKJHRneO2NRN9rLd"

#define BLYNK_PRINT Serial
#include <WiFi.h>
#include "time.h"
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

// Masukkan Auth token yang sudah dibuat
char auth[] = "Co718u70V31kGp4laKJHRneO2NRN9rLd";

//Masukkan WIFI SSID dan password
char ssid[] = "Wifiku ";
char pass[] = "PargoyDong";


int buzzerPin = 13;
int read_hujan = 0;
//int buttonState = 0;
//const int buttonPin = 21;

#define sensor_hujan 4



BlynkTimer timer;
int hold=0;


void hujanNotify()
{
   read_hujan = digitalRead(sensor_hujan);

 if (read_hujan==0 && hold==0) {
     Serial.println("Hujan");
     Blynk.logEvent("hujan","Awas Hujan !!!");
    hold=1;
     Blynk.virtualWrite(V2, "Awas Hujan !!!");
    
  }
  else if (read_hujan==1 && hold==1)
  {
     Serial.println("Cerah");
     Blynk.logEvent("cerah","Cuaca Cerah");
    hold=0;
      Blynk.virtualWrite(V2,"Cuaca Cerah");
  } 
}

void setup(){
  pinMode(sensor_hujan,INPUT);
  pinMode(buzzerPin, OUTPUT);
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass, "blynk.cloud", 80);
  timer.setInterval(2500L, hujanNotify);
  
 
  
 
}


void loop(){
int kondisi_sensor = digitalRead(sensor_hujan);

      if (kondisi_sensor == 0)               
        tone(buzzerPin,500,500);
        
          else{
          digitalWrite(buzzerPin,LOW);
          }
          

  delay(1000);
  Blynk.run();
  timer.run();
  

    
}

Credits

TAUFIQ IKROM JAMIL

TAUFIQ IKROM JAMIL

1 project • 0 followers
Aisyah Rohmawati

Aisyah Rohmawati

1 project • 0 followers

Comments