DHT22 + Pietttetech library + Photon = 😢


#1

I went into class today, extolling the virtues of the DHT22, only to have it fail spectacularly when I started demoing it.

It was connected to a Photon, with the DHT_simple.ino example (from the Piettetech_DHT library). It hangs at DHT.acquireAndWait(1000), and then reboots after making the RGB led flash red repeatedly. For the record, the temperature/humidity in the room was within the limits of the DHT22 :smirk:

I’m running deviceOS@1.2.1, and, at least in Visual Studio Code, Serial.available() doesn’t seem to work (pressing a key doesn’t get me out of the while() loop in setup().

Any ideas? Should I try a library other than PietteTech_DHT? Thanks in advance for any help…


#2

Check your pull-up (1k to 3v3) on the data pin.


#3

That is a known issue caused by some “enhanced” memory leak prevention introduced in one of the more recent device OS updates

Currently the only workarounds are to either downgrad the device OS to 1.2.0 or apply this patch to the library


#4

Thanks, ScruffR, this fixed my problem. I was using 1.4.0; still had the problem with 1.2.0-rc1; but it did work with 1.1.1. I’d recommend they mention this in the comment that pops up when you search for this in Particle Workbench, or a note in the README.md.


#5

I tried the modified library files from rgiese but still got the SOS. Anyone else have luck with that patch? In the meantime I’ve downgraded to 1.1.1 and DHT is working as expected.

Was also considering switching to the Adafruit library, assuming it doesn’t cause this problem. Is the only benefit of PietteTech that it uses interrupts? Sorry if I’m misunderstanding some details. If I don’t have a timing-critical situation, just polling the DHT every few mins among some other sensor reads, is Adafruit as good as PT?

Thanks!


#6

Which version of the PietteTech_DHT library have you tried?
Try 0.0.11


#7

Last week I flashed library version 0.0.12 with firmware 1.4.3 and got no errors or SOS. It’s been running for several days polling the sensor every minute, so I’d say it’s fixed.


#8

Can you post a link to the 0.0.12 library?


#9

It’s exactly there where all the previous versions were :wink:
https://build.particle.io/libs/PietteTech_DHT/0.0.12/tab/PietteTech_DHT.cpp

And there you can also find a link to the GitHub repo