I have a Raspberry pi 3 with a dht22 sensor and use the blynk server. It works good but i have the problem that after 1 day or 2 it shows me you raspberry is offline then i reboot the pi and it work again 1 or 2 days and it goes again offline. Can say me anyone what is the problem??
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);
I have test it and after 2 days it shows me again „device is offline“ can you show me maybe your code in c++ because maybe i use this methode when its run better. Or is it not possible?
You can’t run C++ on a Pi without some sort of emulator software.
The only one that I’m aware of was WiringPi, and that is now deprecated.
Are you 100% tied to using the Pi as your board?
As I said earlier, I think Pis are great as servers, but they are far too expensive, cumbersome to set-up and slow to boot for use as a board to use as an interface for a DHT sensor.