I read real funny numbers on Blynk from DHT11 connected to my ESP8266. It switches back and forth from normal readings to null, and unrealistic values like -13 degrees and 156 humidty. Please see captured video below:
Until now I’ve tried,
- Changing the code several times
- Changing several sensors
- Changing power source and cables
• Device is: ESP8266 thru wifi
• Smartphone is Samsung Note 8
• Blynk server
• Latest Blynk Library version
#ifdef __AVR__
#include <avr/power.h>
#endif
#define PIN 14 //D5
#define NUMPIXELS 2
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SPI.h>
#include <DHT.h>
#define DHTPIN 12 //D6
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
float humidity, temp_f;
int sensor_light = 13; //D7
int value_light;
int sensor_water = A0; //A0 analog input
int value_water;
char auth[] = "XXXXX"; //enter blynk auth token
#include <SimpleTimer.h>
SimpleTimer timer;
void temp_humid(){
float h = dht.readHumidity();
float t = dht.readTemperature();
Blynk.virtualWrite(1, t); //V1
Blynk.virtualWrite(2, h); //V2
}
void setup() {
//Serial.begin(9600); //delete serial comments when troubleshoot is necessary
Blynk.begin(auth, "YYYYY", "ZZZZ"); //enter pot2 location wifi name & password
pinMode(sensor_light, INPUT);
strip.begin();
timer.setInterval(1000, temp_humid); //for more than 3times/day, each time about 60seconds. wake up just to get readings from all sensors
} //3 times, 20seconds apart. go to deep sleep, wake up8hrs later, do the same for 60seconds...
void loop() {
Blynk.run();
timer.run();
}