BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Data issues with DHT22


#1

Good day. There is a problem when removing data from a DHT22 sensor connected to the Raspberry Pi 3B,
Correct data alternates with incomprehensible values of “1.0 or 0.0” in the Value Display display, in temperature and humidity.
Доброго времени суток. Имеется проблема при выведении данных с датчика DHT22 подключеноого к Raspberry Pi 3B,
правильные данные чередуются не понятными значениями “1.0 или 0.0” на виджите Value Display , в температуре и влажности.
Code example used:

var blynkLib = require('blynk-library');
var sensorLib = require('node-dht-sensor');

var AUTH = 'YOUR_AUTH_TOKEN';

// Setup Blynk
var blynk = new blynkLib.Blynk(AUTH);

// Setup sensor, exit if failed
var sensorType = 11; // 11 for DHT11, 22 for DHT22 and AM2302
var sensorPin  = 4;  // The GPIO pin number for sensor signal
if (!sensorLib.initialize(sensorType, sensorPin)) {
    console.warn('Failed to initialize sensor');
    process.exit(1);
}

// Automatically update sensor value every 2 seconds
setInterval(function() {
    var readout = sensorLib.read();
    blynk.virtualWrite(3, readout.temperature.toFixed(1));
    blynk.virtualWrite(4, readout.humidity.toFixed(1));
    
    console.log('Temperature:', readout.temperature.toFixed(1) + 'C');
    console.log('Humidity:   ', readout.humidity.toFixed(1)    + '%');
}, 2000);

#2

Is the console displayed data correct?

What does the App display look like? Like this? %3f

If so, then searching this forum would have shown that recent espressif changes require the latest ESP Arduino Core, currently 2.4.2