ESP32 Smart Automatic Fire Extinguiser with DHT11

An ESP32 Smart Automatic Fire Extinguisher with DHT11 is a project that combines the capabilities of the ESP32 microcontroller, a DHT11 temp

BeginnerFull instructions provided174
ESP32 Smart Automatic Fire Extinguiser with DHT11

Things used in this project

Hardware components

DHT11 Temperature & Humidity Sensor (4 pins)
DHT11 Temperature & Humidity Sensor (4 pins)
DHT11 functions as a temperature and room temperature detector which is useful for detecting excessive heat caused by fire
×1
ESP32
Espressif ESP32
ESP32 functions as a versatile microcontroller that can be used to control electronic system devices and IoT (Internet of Things)
×1
4-CHANNEL RELAY CONTROLLER FOR I2C
ControlEverything.com 4-CHANNEL RELAY CONTROLLER FOR I2C
Relays are used to control the electrical current in a circuit, allowing large currents or devices that require high power to be activated or deactivated by smaller currents
×1
AC/DC Power Supply, 12 V
AC/DC Power Supply, 12 V
Power Supply is used as the main power source for various electronic devices, including microcontrollers, sensors, and circuits that require a voltage of 12 volts.
×1
Jumper wires (generic)
Jumper wires (generic)
×1
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
×1

Software apps and online services

Arduino IDE
Arduino IDE
Blynk
Blynk

Story

Read more

Schematics

Circuit Diagram

Circuit Diagram Smart Automatic Fire Extinguiser

Code

Codes

Arduino
coding for the application of the ESP32 Smart Automatic Fire Extinguiser with DHT11
/*************************************************************

  This example shows how value can be pushed from Arduino to
  the Blynk App.

  WARNING :
  For this example you'll need Adafruit DHT sensor libraries:
    https://github.com/adafruit/Adafruit_Sensor
    https://github.com/adafruit/DHT-sensor-library

  App dashboard setup:
    Value Display widget attached to V5
    Value Display widget attached to V6
 *************************************************************/
//SMART AUTOMATIC FIRE EXTINGUISHER WITH ESP32, MONITORING BY BLYNK//

/* Fill-in information from Blynk Device Info here */
#define BLYNK_TEMPLATE_ID           "TMPL66HbHKbZ_"
#define BLYNK_TEMPLATE_NAME         "Water pump"
#define BLYNK_AUTH_TOKEN            "QgwfNDI7YaATqO68o28oe8vpNX-dC-rN"

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial


#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <DHT.h>

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

#define DHTPIN 4          // What digital pin we're connected to
int autoo;
#define relaypin 2
// Uncomment whatever type you're using!
#define DHTTYPE DHT11     // DHT 11
//#define DHTTYPE DHT22   // DHT 22, AM2302, AM2321
//#define DHTTYPE DHT21   // DHT 21, AM2301

DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;

// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
BLYNK_WRITE(V1)
{
  int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable
  // You can also use:
  // String i = param.asStr();
  // double d = param.asDouble();
  Serial.print("V1 Slider value is: ");
  autoo = pinValue;
  Serial.println(pinValue);
}
BLYNK_WRITE(V0)
{
  int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable
  // You can also use:
  // String i = param.asStr();
  // double d = param.asDouble();
  Serial.print("V1 Slider value is: ");
  Serial.println(pinValue);
  if (autoo == 1)
  { if (pinValue == 1) {
      digitalWrite(relaypin, HIGH);
    } else {
      digitalWrite(relaypin, LOW);
    }
  }
}
void sendSensor()
{
  float h = dht.readHumidity();
  float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit

  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }

  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Serial.print(h);
  Blynk.virtualWrite(V5, h);
  Blynk.virtualWrite(V6, t);
  if (autoo == 0)
  { if (t >= 33)
    {
      digitalWrite(relaypin, HIGH);
    } else {
      digitalWrite(relaypin, LOW);
    }
  }
}

void setup()
{
  // Debug console
  Serial.begin(115200);

  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
  // You can also specify server:
  //Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, "blynk.cloud", 80);
  //Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, IPAddress(192,168,1,100), 8080);

  dht.begin();
  pinMode(relaypin, OUTPUT);

  // Setup a function to be called every second
  timer.setInterval(1000L, sendSensor);
}

void loop()
{
  Blynk.run();
  timer.run();
}

Credits

H43212191 Wayan Agus Wirawan

H43212191 Wayan Agus Wirawan

1 project • 0 followers
Mechatronic Engineering
H43211256 Galang Orlando

H43211256 Galang Orlando

1 project • 0 followers
Mechatronic Engineering

Comments