Hello,
I am turning to make a minimal weather station using a DHT22 + SSD1306 + Attiny85.
So far I manage to make it works but I am facing minor issues I'd like to solve with your help.
I have false readings of the DHT22, it return sometime the temperature and/or the humidity multiplied by a factor of 2 or 3... or even 0 for both values.
I have an 10k resistor between the DHT22 data pin and 5v vcc.
In Tools the Attiny clock is set to 1mhz... with 8mhz I have a very slow screen refresh rate...
What's wrong ?
#include "SSD1306_minimal.h"
#include <avr/pgmspace.h>
#include <dht.h> // AUTHOR: Rob Tillaart VERSION: 0.1.21
#define DHT22PIN 4
#define DEG "\xa7" "C"
SSD1306_Mini oled; // Declare the OLED object
dht DHT22;
float h = 0;
float t = 0;
char buffT[5];
char buffH[5];
void setup() {
oled.init(0x78); // Initializes the display to the specified address
oled.clear(); // Clears the display
delay(1000); // Delay for 1 second
}
void loop() {
int chk = DHT22.read22(DHT22PIN);
dtostrf(DHT22.temperature, 3, 1, buffT);
dtostrf(DHT22.humidity, 3, 1, buffH);
oled.startScreen();
oled.clear(); // Clears the display
oled.cursorTo(0, 0); // x:0, y:0
oled.printString(buffT);
oled.cursorTo(0, 10); // x:0, y:23
oled.printString(buffH);
delay(10000);
}