ESP8266- Blynk Plot Sensor Readings in Live Charts & Export CSV File | DHT22 Sensor

Robotica DIY
Robotica DIY
20.1 هزار بار بازدید - 4 سال پیش - ESP8266- Blynk Plot Sensor Readings
ESP8266- Blynk Plot Sensor Readings in Live Charts & Export CSV File | DHT22 Sensor
Scroll down for code.....

Sensor data is very important in any project to find how system is performing or we just want to monitor a system. Last tutorial where I showed how we can plot sensor data to our local network web page. In this tutorial we can plot sensor data chart from cloud. So we don’t need to be on same wifi network, you can access sensor data from anywhere in the world. We not only see how to plot sensor data but also export this data in CSV file. All this things will be going in Blynk App. Where we also explore various ways to present sensor data like Gauge, H Level, V Level & Display value in Blynk App.

If you want to support my video please buy any product through my amazon affiliate link. I will receive a commission, at no extra cost to you.

LIST OF COMPONENT (affiliate links)

https://amzn.to/2Uo7M93 (NodeMCU ESP8266 12E)
http://amzn.to/2vqIKJP  (DHT22)
http://amzn.to/2wxPmWz  (Breadboard)
http://amzn.to/2vJ3lvo   (Jumper wire)
http://amzn.to/2vmSK8l  (Resistor)

Track: LFZ - Popsicle [NCS Release]
Music provided by NoCopyrightSounds.
Free Download / Stream: http://ncs.io/PopsicleYO

#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include (SPI.h) //instead of parenthesis () put angle bracket as YouTube description does not allow angle bracket
#include (ESP8266WiFi.h)
#include (BlynkSimpleEsp8266.h)
#include (SimpleTimer.h)
#include (DHT.h)

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "";//Enter the Auth code which was send by Blink

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

#define DHTPIN 2 // Digital pin 4

// 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);
SimpleTimer 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); //V5 is for Humidity
Blynk.virtualWrite(V6, t); //V6 is for Temperature
}

void setup()
{
Serial.begin(9600); // See the connection status in Serial Monitor
Blynk.begin(auth, ssid, pass);

dht.begin();

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

void loop()
{
Blynk.run(); // Initiates Blynk
timer.run(); // Initiates SimpleTimer
}
4 سال پیش در تاریخ 1399/01/22 منتشر شده است.
20,135 بـار بازدید شده
... بیشتر