Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By Angelo Santagata
#24365
tytower wrote:
Angelo Santagata wrote:tytower, do you know what the correct speed for a DH11 is? 15 doesnt make much difference

I don't it is trial and error at this stage . There is a default rate set in the code I think . You will have to look it up . There is also a thread with a few posts on DHT22 and speeds . If I find it I'll post back. From memory I tried from 6 to about 40 and settled on 15 as did someone else in that thread.

Thanks, I'll try lots of values and report what works best for a DHT11.. However looking at the code it indicates that he 3rd value is no longer used (ignored) as the code "works" out the best timing...

I will investigate later this evening
User avatar
By tytower
#24368
Angelo Santagata wrote: However looking at the code it indicates that he 3rd value is no longer used (ignored) as the code "works" out the best timing...



It is not in Adafruits library I use

Code: Select all/* DHT library

MIT license
written by Adafruit Industries
*/

#include "DHT.h"

DHT::DHT(uint8_t pin, uint8_t type, uint8_t count) {
  _pin = pin;
  _type = type;
  _count = count;
  firstreading = true;
}

void DHT::begin(void) {
  // set up the pins!
  pinMode(_pin, INPUT);
  digitalWrite(_pin, HIGH);
  _lastreadtime = 0;
}


but I see its as you say in the GitHub version you are using which still says written by adafruit

Code: Select all/* DHT library

MIT license
written by Adafruit Industries
*/

#include "DHT.h"

DHT::DHT(uint8_t pin, uint8_t type, uint8_t count) {
  _pin = pin;
  _type = type;
  _firstreading = true;
  _bit = digitalPinToBitMask(pin);
  _port = digitalPinToPort(pin);
  _maxcycles = microsecondsToClockCycles(1000);  // 1 millisecond timeout for
                                                 // reading pulses from DHT sensor.
  // Note that count is now ignored as the DHT reading algorithm adjusts itself
  // basd on the speed of the processor.
}
User avatar
By andywhit
#24372
Angelo Santagata wrote:OK. Im now stumped again...

For some reason I no longer get any readings.. and constantly get Failed to read from DHT Sensor in my code, not always but 80% of the time....

Code is trivial.. and Im now baffled again..
Ive set the 3rd param to 15.. baffling]


What board type are you using in the IDE when uploading the sketch ?

I had intermittent problems reading DHT11 on my 8266 201 running on a Dev board when I used the "Generic 8266" board setting. Changing to one of the esp-12 board settings when uploading the sketch resolved the issue.
User avatar
By Angelo Santagata
#24373 Just to make sure I download the same library, can you send me a link to the one you are using?

When I go to AdaFruit (https://learn.adafruit.com/dht/downloads) and click on the library it points me to the github repo..

Looking at Github, it appears this change occured from 1.0.0-1.1.0 ...

which version do u have?