Problem with DHT11 with ATTiny85

I have a simple project that uses a 4 digit seven segment LED display (Serial) and a DHT11 temperature and humidity sensor, it reads the temp and humidity values into variables and then displays temperature, humidity and dew point with delay(5000) between each write to the LED display before reading from the sensor again. Works great with my old Arduino Diecimila.

I changed the library to TinyDHT to save some memory - still works as expected on the Arduino. I then programmed the sketch to a ATtiny85 and runs the display fine. But the values from the DHT11 are always temperature 0, humidty 255 - the same values are shown if the sensor isn't even connected so I don't think its even providing values at all.

I took two wires (one from the DHT11, one serial wire for the display) and swapped them to the Arduino without changing anything else in the circuit and it worked fine.

SO I'm sure its wired correctly, I'm sure the software works on the Diecimila but it does on the ATtiny.

Looking for some advice on this. Here are some thoughts but I'm not sure:

  1. Could it be a memory issue? the TinyDHT library is supposed to be ATtiny friendly but maybe SoftwareSerial is pushing it? I don't know how to measure memory use while a sketch is running on the device, I assume I don't have the equipment for it anyway. I would think it would have other side effects though. The sketch still runs, cycling through the three values, its just they are not correct!

  2. The one-wire interface requires uS level timing and also the sensor provides data be responding to a request from the microcontroller. Maybe the request isn't being sent or timing is off so the sensor isn't responding?

  3. The library uses int16_t and uint8_t values as the readings for temp and humidity, are these handled differently in the ATtiny compared to the arduino?

Just thinking out loud a bit. Does anyone have ideas about this sensor on an ATtiny85? Or general troubleshooting advice for a simple project that works on arduino, only uses two digital pins and doesn't work on the attiny? Things to test or convert or watch out for?


Can you post the tinyDHT lib? (and the original lib - link? maybe there is a bug introduced while trimming the lib...

Its this library here:

I was using this one originally:

Both work on the Arduino and don't work on the ATTiny.

could you check my dhtlib - -

it is confirmed to work on a tiny85 @ 8mhz...

Great thanks, I'll give it a go.

That works great on the Attiny85. Thanks.