-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DHT22 not working with ESP Easy on Wemos D1 #2569
Comments
for this sensor none of libraries calculate with 5V or 3V3 because it is a digital sensor, so you receive value from sensor itself |
OK, so apparently it is suggested to use this DHTesp library I have quickly browsed through the code of that library, and some of the code does look familiar, so maybe that library does have some fixes compared to the version we use. But I don't remember a lot of issues reported with this plugin, so I would also like to know what exact sensor your are running and more info about your board and how it is connected. |
will try to compare it with our implementation |
@TheAppService lets start with debug log from reading your sensor under espeasy please @TD-er I see initial timings are a little bit different, but lest check debug log so. we will know maybe what is realy wrong |
I know there was an issue about it about half a year ago (or maybe longer?) that was about changing the timing of some of the DHT sensors, but not all. |
you have added some error logging, so we can use it now =) |
In the DEBUG log i can only find this: (Maybe you can give me a hint how I can exactly debug the sensor... |
If you are using serial connection, than in advenced settings change log level for serial to debug |
Hmm what version of ESPeasy are you running? |
Booting Build nr:120 (I thought this was the newest...) |
"please update for latest version, R120 is obsolete." -- So i should youse the mega Versions ? Maybe you should clarify, that the "current stable" on this site here https://www.letscontrolit.com/wiki/index.php/ESPEasy is rather old... |
yes, try mega build, mega have some problems and is not rocksolid, but has lots of bugs resolved |
Alright, I updated it but the log still "only" says 40797 : DHT : No Reading |
Use 4,7kOhm resistor |
I can try to "build" one out of the resistors I have but I won´t exactly be able to hit 4,7kOhm. Is this really neccessary ? I have one perfectly working sensor on my raspberry with a 10kOhm resistor... |
I have a DHT22 on a Wemos D1 mini with 4.7kOhm resistor. |
Well @AxelMilb as i tested it with the exact same setup using the sketch you see above, it is generally working... |
Ah, one more question, do you have it connected to 5V or 3,3V? |
You can use 2x10kOhm in parallel connection so it will be about 5kOhm |
Assume DHT22 works for you now =) |
- use delays according to datasheets - set bus high after a request for every type of sensor (this may fix problems with pullup resistors) fixes letscontrolit#2569
A Test build for PR #2571. |
@TheAppService please try this test build and give us debug log, thanks |
@thenightfighter as @TD-er suggests, try on other gpio pins. |
@uzi18 Tried also D1 yesterday and got still "nan" results. I don't have an logic analyzer, sry. |
Tested D0, D3, D4, D5, D6, D7 and D8 with mega-01022018 receiving "0.00" on temperature and humidity. |
Just leave it unpowered for a while (few minutes?) and try again. |
Tested D0, D3, D4, D5, D6, D7 and D8 with mega-01022018 receiving "0.00"
on temperature and humidity.
Tested D4 with mega-20190106 and it works! Got Temperature at 20.70 C°
and Humidity at 49.20%.
So you have been testing a version of ESP-easy from almost 2 years ago and
getting problems, and now you use a recent version and it works.
Erm .. am I missing something here?
…On Mon, 27 Jan 2020 at 17:40, thenightfighter ***@***.***> wrote:
Tested D0, D3, D4, D5, D6, D7 and D8 with mega-01022018 receiving "0.00"
on temperature and humidity.
Tested D4 with mega-20190106 and it works! Got Temperature at 20.70 C° and
Humidity at 49.20%.
Tested D4 with mega-20191208 and it works too... My wifi credentials are
also there, is there any persistent space? I can't reproduce the error
anymore :(.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2569?email_source=notifications&email_token=AANJSKARJ7SPNP77FV77MS3Q74MBFA5CNFSM4IPVFMLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKAMSVY#issuecomment-578865495>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AANJSKBQ5N4SRK4QSL3ERQDQ74MBFANCNFSM4IPVFMLA>
.
|
Flashed mega-20191208 first, before I asked here for some help/ideas. A few min ago I tried mega-01022018 with different pins and seeing 0.00. After that I flashed mega-20190106 and it worked. Then I flashed mega-20191208 and it also works. @TD-er hmm but why does the wemos know my wifi credentials after "flashing" a newer versopm with the esptool? |
If you switch between ESPEasy versions, then the settings will still be there. The flash layout is:
As long as the filesystem area is not erased, the settings will be kept. |
If you are experiencing any problems I would always recommend wiping the
flash completely before flashing a new version.
…On Mon, 27 Jan 2020, 18:00 TD-er, ***@***.***> wrote:
@TD-er <https://github.com/TD-er> hmm but why does the wemos know my wifi
credentials after "flashing" a newer versopm with the esptool?
If you switch between ESPEasy versions, then the settings will still be
there.
The flash layout is:
- sketch + OTA update space
- SPIFFS filesystem.
As long as the filesystem area is not erased, the settings will be kept.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2569?email_source=notifications&email_token=AANJSKF2RK2VF4MFNUPR6ILQ74ONXA5CNFSM4IPVFMLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKAOXLQ#issuecomment-578874286>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AANJSKBFBD7Z4ZH4OBRTJLLQ74ONXANCNFSM4IPVFMLA>
.
|
With Fresh system, never flashed with ESP Easy:
then after pressing reset:
Then remove power, wait, boot and press reset after 3rd successful reading:
This is reproducible! 🙅 |
Hmm, @uzi18 made this change in November 2019: 88c6887#diff-63c481456206c5a2f90a396a7a688f2e That was already some tweak of the category "hmm if it's that timing critical, we will see more reported issues". |
Interesting! @thenightfighter proposed to use https://github.com/RobTillaart/Arduino/tree/master/libraries/DHTstable There https://github.com/RobTillaart/Arduino/blob/2b97b8d4beccf1db29de0fb1c77238ce7e21aa3c/libraries/DHTstable/dht.h#L29 we find const int DHTLIB_DHT_WAKEUP = 1; int rv = _readSensor(pin, DHTLIB_DHT_WAKEUP); delay(wakeupDelay); to wait after setting the pin to low. [88c6887#diff-63c481456206c5a2f90a396a7a688f2e gives case P005_DHT22: delay(2); break; // minimum 1ms to wait after setting the pin to low. So: Perhaps 2 ms here are to long? I would refactor the code to find the constants in The comment on this line made me curious! Let's look what happened: Blame for this line How was the code before this? case P005_DHT11:
case P005_DHT22:
case P005_DHT12: delay(18); break; // FIXME TD-er: Must this be so long? Oops! No delay at all! BTW: The change was made to fix this issue. 😁 I think the 2 ms delay was the again breaking change. Depending on the used pullup the needed time may vary.
What do you think? |
Those case entries just are a fall-through, so they all had the 18 msec delay in that version of the code. |
Right. A bit late in the evening. 😁 |
BTW: Thanks for the late support. In NL it's late too (like in D). Tot ziens. |
Graag gedaan :) |
It is minimum time to wake up sensor from datasheet. I guess something with configuration reading is wrong. |
As the sensor does respond well initially, but starts acting badly after a reboot, I wonder if it could be the sensor is still in another state compared to what we expect in our code? Edit: |
SolvedSolution:
Findings:
A modified DHT22 example sketch (from Arduino DHT library - change baud rate to 74880) reproducible shows after soft reset:
How to find outYou need a logic analyzer (here: Saleae logic clone with PulseView) to examine. Working DHT (klick screenshot to zoom) After soft reset by reset button
How to patch Wemos DHT shield
BTW: Others found this, too. https://blog.zs64.net/2018/02/fixing-the-wemos-d1-mini-dht22-shield/ Proposal
Any other ideas? Thanks for your support! |
Great post explaining your findings and solution and indeed there should be a warning about this on the plugin documentation. |
This issue with burst on Tx when warm boot was also described here for the ESP-01: #2585 (comment) So indeed a warning in the plugin documentation is a good thing to do. |
Here is some information about this problem: adafruit/DHT-sensor-library#116 |
Thanks for the feedback. Fun to work with you. BTW: You never find problems like this without a logic analyzer and its cheap!
|
Just added it to the Wiki to make sure people are not spending lots of hour again. |
Great. Found
there. This should be changed, too. Mentioned here: #2585 (comment) |
As it is now documented, these issues can be closed. |
Hello alltogehter,
I have connected my DHT22 properly to my Wemos D1 but can´t get it to work with ESP Easy. Many "normal" program scripts to output the temperature and humidity to the serial monitor also didn´t work, but this here finally did the trick! : https://chewett.co.uk/blog/1476/using-the-dht22-temperature-sensor-with-a-wemos-d1-mini-esp8266/
There is also a modified library involved, related to the 3,3V limitation of the Wemos D1´s digital GPIOS. The EspEasy displaying me in the webinterface "nan" may be also caused by the "normal" library used by EspEasy, calculating the values with 5V. I´d be very grateful if someone knew how to resolve this problem.
Best regards Daniel
EDIT: I figured out, that "nan" is only displayed when I set the setting "IDX/Variable". Otherwise simply 0.0 is shown.
The text was updated successfully, but these errors were encountered: