Cmtelesann
Published

Monitoring Temperature Remotely with Blynk for Dummies

Monitor your living room temperature remotely using DHT-11, ESP8266 WiFi module, and Blynk.

BeginnerWork in progress1 hour23,619
Monitoring Temperature Remotely with Blynk for Dummies

Things used in this project

Hardware components

ESP8266 ESP-01
Espressif ESP8266 ESP-01
×1
DHT11 Temperature & Humidity Sensor (4 pins)
DHT11 Temperature & Humidity Sensor (4 pins)
×1
Breadboard (generic)
Breadboard (generic)
×1
Arduino UNO
Arduino UNO
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Blynk
Blynk
Arduino IDE
Arduino IDE
Fritzing

Story

Read more

Schematics

Upload Setup

Stand alone setup schematics

Code

ESP8266 code

Arduino
Upload this code to your ESP8266 module
/* This sketch send data to Blynk server and back to mobile phone.
   The DHT11 data is not working. Some issues with the data aquisition.
*/

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleDHT.h>

char auth[]= "YourAuthToken"; // Your Auth token
char ssid[]= "YourNetworkSSID";
char pass[]= "Yourpassword";

const int pinDHT11 = 2; // GPIO2 on your ESP8266 Wifi Module
SimpleDHT11 dht11;
BlynkTimer timer;

void sendSensor()
{
  // start working...
  Serial.println("=================================");
  Serial.println("Sample DHT11...");
  
  // read without samples.
  byte temperature = 0;
  byte humidity = 0;
  int err = SimpleDHTErrSuccess;
  if ((err = dht11.read(pinDHT11, &temperature, &humidity, NULL)) != SimpleDHTErrSuccess) {
    Serial.print("Read DHT11 failed, err="); Serial.println(err);delay(1000);
    return;
  }
  // for debug purposes.
  Serial.print("Sample OK: ");
  Serial.print((int)temperature); Serial.print(" *C, "); 
  Serial.print((int)humidity); Serial.println(" H");
  // DHT11 sampling rate is 1HZ.
  delay(1000);
  Blynk.virtualWrite(V5, temperature);

}

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

  // Sending authentication token to blynk. Getting access to your WiFi with SSID and password
  Blynk.begin(auth, ssid, pass);

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

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

Credits

Cmtelesann

Cmtelesann

5 projects • 15 followers
Keeping my head busy! Looking for challenges! Trying to keep up with evolution! IoT is the future!
Thanks to Hackster.io, Youtube, Google, and Instructables.

Comments