NodeMcu to DHT Interface in Blynk app
Hello Visitors, Today i show you how to interface DHT sensor Value in Blynk Apps use ESP8266 .
Things used in this project
- ESP8266 Board
- DHT11 Temperature & Humidity Sensor
- Breadboard
- Male/Female Jumper Wires
- Arduino IDE
- Blynk
DHT11 sensor measures and provides humidity and temperature values serially over a single wire. First read this article and prepare arduino for ESP8266 Arduino Support for ESP8266 with simple test code
PIN Connection:
Create a Project use Blynk apps Following Instruction First LogIn your Blynk App Then Flow the Step By Step
NOTE – You got your AUTH TOKEN it send to your email address.
Now Flash this code in ESP8266. Here Replace SSID, SSID PASSWORD and Auth TOKEN. You need to Some library.
So Download by this link https://github.com/blynkkk/blynk-library/archive/master.zip
Adafruit DHT sensor libraries:
https://github.com/adafruit/Adafruit_Sensor
https://github.com/adafruit/DHT-sensor-library
Download these library and extract it. Now open Arduino and go to File>Properties. Here you find path of Arduino.
Now go to Arduino path and paste all extracted libraries folder in Libraries Folder. Select Board “Nodemcu 1.0” in Tool tab of Arduino IDE and Select right Port for Nodemcu. Now Flash this code given below.
Code
/*************************************************************
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 project setup:
Value Display widget attached to V5
Value Display widget attached to V6
*************************************************************/
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <DHT.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = “AUTH TOKEN”; // replace with your auth token, You got your AUTH TOKEN it send to your email.
// Your WiFi credentials.
// Set password to “” for open networks.
char ssid[] = “YOUR SSID”; // replace with your SSID
char pass[] = “SSID PASSWORD”; // SSID Password
#define DHTPIN 2 // What digital pin we’re connected to
// 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.
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.
Blynk.virtualWrite(V5, h);
Blynk.virtualWrite(V6, t);
}
void setup()
{
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, “blynk-cloud.com”, 80);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
dht.begin();
// Setup a function to be called every second
timer.setInterval(1000L, sendSensor);
}
void loop()
{
Blynk.run();
timer.run();
}
Pingback: MQTT Broker on Android | How To Run MQTT Broker in Android
Pingback: How to Use I2C LCD with ESP32 Using Arduino IDE
Pingback: IoT OS and RTOS for Internet of Things devices - IoTbyHVM
Pingback: ESP32 BLE Tutorials | How to use ESP32 with BLE
Pingback: ESP8266 Static IP Address Using Arduino Example - ESP
Pingback: InfluxDB | Installation | How To Use | Time Series Database ?
Pingback: Managing Files with NodeMCU | NodeMCU Examples
Pingback: ATOMIC Pi - A high power alternative to RPi - IoTbyHVM
Pingback: Arduino SPI Tutorial - IoTbyHVM - Bits & Bytes of IoT
Pingback: NodeMCU ESP8266 OTA (Over-the-Air) using Arduino IDE
Pingback: Symphony Link LPWAN IoT Network - IoTbyHVM - Bits & Bytes of IoT
Pingback: ArduinoJSON - Efficient JSON serialization for embedded C++
Pingback: Blynk IoT Platform - IoTbyHVM - Bits & Bytes of IoT
Pingback: LED using Blynk and ESP8266 (Node MCU) - IoTbyHVM
Pingback: NodeMCU ESP8266 with DHT11 and Firebase Real-Time Database
Pingback: Log Temperature Sensor Data to Google Sheet using NodeMCU ESP8266
Pingback: GPIO Pins of ESP32 | ESP32 Tutorials - IoTbyHVM - Bits & Bytes of IoT
Pingback: Interface MQ135 (Gas Sensor) with NodeMCU - IoTbyHVM
Pingback: Top 10 IoT Cloud Platforms - CompileIoT
Pingback: DHT11 vs DHT22: Overview - IoTbyHVM - Bits & Bytes of IoT
Pingback: Interface LDR module with NodeMCU - IoTbyHVM - Bits & Bytes of IoT
Pingback: InfluxDB | Time Series Database ? | TickStack | Tickscript ?