Attiny85 does not read DHT11, Fuse bits in Bootloader?

I have been trying to build a Thermometer with an ATtiny85 a LM1637 (4 Digit Display) and a DHT11. I used an arduino nano in a protoboard as a reference. I am aware that there are dedicated DHT libraries for the Attiny.

I am facing the same issue as some guys had in the past, i tried the past recommendations but i have not being successful. My display still shows 0 and 255 while reading the Temperature and Humidity from the DHT11. There were several recommendations for newer or special libraries (one from Adafruit tinyDHT and the latest from Rob Tillart but my issue persists.

What I tried:

  • using other ATtiny pins,
  • changing DHT11 sensors,
  • using Pullup (10k, 27k, 100k...) between VCC and Data
  • different voltage supplies (through Nano, through USB, through Voltage source...)
  • different ATtiny85 and protoboards
  • using ATTiny84 (just tried with the first 3 digital pins, PB0, PB1, PB2)
  • i tried changing types to store the temperature/Humidity in the different libraries (using floats as in the examples, or int/int16_t, int8_t) -
  • I changed a #define Timeout (varied to 1000, 10000 and several other values,

for the latest Library from Rob Tillart i get following the following DHTLIB_ERROR_TIMEOUT ( i debugged through my sketch).

So, if not simple issue by finding the right library, is it because i need to burn the bootloader in the ATtiny? I have checked in the osicilloscope and the DigitalPort connected to the data pin of the DHT is not sending /receiving anything, if i compare it with what i see in my setup with the nano.

i found this DIY Funk-Wetterstation mit DHT22, ATtiny85 und RadioHead | cryCode.de (in german), but related to my issue, so my question is
-where and how should I set the LOW Fuse Presets? how to set the Byte lfuse auf 0xE2 ??

At the beginning (a while ago) i uploaded the ArduinoISP sketch into my nano. Now i just select the ATtiny board and MHz and use the nano as a programmer (Arduino as ISP). I do not burn the bootloader in my ATTinys when i upload sketches into them.

sorry guys if my description is quite chaotic, i will refine my observations with the oscilloscope (now i bought a digital one) and would like to try that with the bootloader,

thanks in Advance!

while burning bootloader will fusses be set. you can overwrite bootloader then with your sketch.

But do I have to use the command line AVRDUDE for that? I dont find where are the settings for the bootloader

изображение

1 Like

Ok, thanks, and I see in this post (in german) that the boards.txt need maybe new values from the Fuse Calculator ](AVR® Fuse Calculator – The Engbedded Blog)

oh yes, 2018...

I am really stucked, so here again my problem description,

here is my code, i am using the DHTStable library from Rob Tillaard, it is supossed to work with ATtiny85.


#include "DHTStable.h"
#include <TM1637Display.h>
#include <TinyDHT.h>        // lightweit DHT sensor library

#define TEMPTYPE 0        // Use Fahrenheit (0 for celsius)
#define DHTTYPE DHT11     // DHT 22  (AM2302)
#define DHT11_PIN       2
#define CLK 0
#define DIO 1

#define DHTTYPE DHT11
#define DHTLIB_TIMEOUT 10000

TM1637Display display = TM1637Display(CLK, DIO);
DHTStable DHT;

int period = 1000;
unsigned long time_now = 0;

void setup() 
{
    display.setBrightness(7);
} 
  
void loop() 
{
  time_now = millis();
  display.clear();
  int chk = DHT.read11(DHT11_PIN);
  int h = DHT.getHumidity();               // Read humidity
  int t = DHT.getTemperature();   // read temperature

  while(millis() < time_now + period)
    {
      display.showNumberDec(h, false,2,0); 
      display.showNumberDec(t, false);
    }  
}

my settings to programm the Attiny are

and here is the weird part, in the Nano the signal from the DHT is really neat

but in the Attiny85 the signal from the DHT is chaotic, Chopped, saw like and not really periodic.

so i still assume there is an issue with the Attiny85 (the fuse?) Although i was not able to find any Attiny85 listed in the boards.txt

i am using this core ATTinyCore . Previously i used

I am having the same behaviour with several Attiny85 chips, so it is not related to a single chip being fried.

and I forgot, now i am getting random values in my display, it changes for example, 0, 78, 29, 12..., at least now i am not getting only 999

what should this do? actually it is pointless, spaming whole second with one Hum and Temp and again spaming with next numbers, and again,.. ,..

i wanted to display the results every 2 seconds, how could be a better way without delay()?

i found my bug, the 4 Digit Display is causing a lot of disturbances on the ATTiny, if I supply both from different voltage supplies, then it works. I might have to add capacitors between supply of display and Attiny+DHT?

with this code and using the bootloader the issue was solved :unamused:

#include "DHTStable.h"
#include <TM1637Display.h>

#define TEMPTYPE 0        // Use Fahrenheit (0 for celsius)
#define DHTTYPE DHT11     // DHT 22  (AM2302)
#define DHT11_PIN       2
#define CLK 0
#define DIO 1

#define DHTTYPE DHT11

TM1637Display display = TM1637Display(CLK, DIO);
DHTStable DHT;


void setup() 
{
    display.setBrightness(7);
} 
  
void loop() 
{
  int chk = DHT.read11(DHT11_PIN);
  int humid = DHT.getHumidity();               // Read humidity
  int temp = DHT.getTemperature();   // read temperature
  display.clear();
  display.showNumberDec(humid, false,2,0); // Expect: ___0
  delay(2000);
  display.clear();
  display.showNumberDec(temp, false); // Expect: ___0
  delay(2000);
}

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.