ESP and DHT22 LOW MEMORY #7153
Replies: 2 comments
-
Posted at 2019-08-14 by AkosLukacs As always, check you wiring. Loose wire can lead to communication errors. And the DHT22 uses a single wire bit-banged protocol, that's not as robust as for example I2C or SPI. The DHT22 module does retry up to 10 times by default if can't communicate with the DHT22 or there is a CRC error. With 500ms delay between each retry, worst case that's over your 5000ms interval.
And if my theory is right, you will see some corelation in over 5 second communication and memory leak. Then you can either increase the interval to ~10 seconds, or you can pass in a lower retry count. Posted at 2019-08-14 by Linyx I not have analyser... Log:
Posted at 2019-08-14 by Linyx If set >5 sec - return -1 rh. How to fix this?.. Posted at 2019-08-14 by maze1980 Try to add
Posted at 2019-08-14 by Linyx use console.log(global["\xFF"].timers); I see nothing wrong Log:
Posted at 2019-08-14 by AkosLukacs Something is not right, Posted at 2019-08-14 by Linyx memory is ok. but rh and temp -1. why?..
Posted at 2019-08-15 by AkosLukacs Do you have a pullup resistor (4k7 - 10k) between the data and VCC? Posted at 2019-08-16 by AkosLukacs Ok, did some testing, and can confirm @Linyx's findings with the DHT22:
Checked the communication with a logic analyzer, and the DHT22 sends the right response (temperature and humidity valid, checksum ok). It's just the ESP32 can't pick up the response properly. Anybody any idea? Posted at 2019-08-16 by JumJum Hmm, can't test this by myself (no DHT22).
Posted at 2019-08-16 by Linyx This log if call read every 10 secs, setWatch not work:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-08-16 by Linyx this log when call
Posted at 2019-08-16 by Linyx d length >600 symbols and memory low Posted at 2019-08-16 by JumJum Could you add ESP32.getState, to see how heap goes Posted at 2019-08-16 by Linyx all time
Posted at 2019-08-16 by JumJum So, heap runs fine. Posted at 2019-08-16 by Linyx anyway -1 rh... Posted at 2019-08-16 by @MaBecker Issue espruino/Espruino#1687 was created by ApocalypseLinyx Posted at 2019-08-21 by Frida Ok, time to bring the toys back. First test.
On esp8266 there are no problems. Next test.
Here pinMode has been moved to after set_Watch and I can determine pulse length on LED. And now for a workaround, so it works on both esp8266 and esp32 pico4 as I have. Hope this is something you can use?
And some outputs.
Happy coding. Posted at 2019-08-22 by maze1980 What changed from #1 (good temperature readings) to #8 (checksum error)? The length of the raw output changed by one bit. What did you change? The code in #20 looks non-functional, e.g. I copied in the module as reference, with some notes:
From my point of view line 22 is not necessary, or if it is lines 21 and 22 should be swapped. Lines 27 and 28 could be moved to the end and then rewritten. Since the lines will be only executed once everything is set up there's no need to use a setTimer in this case:
Line 29 could read And if your raw data is too long, capturing also the trigger you can add |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2019-08-14 by Linyx
Hi. I'm use esp32-wroom-32 and DHT22 sensor with DHT22.js script.
I call the read function every 5 seconds and every time I get less and less memory, the log below as it was at the beginning of work was 1917, and after a while it was already 1887 and so on until there is an error.
What my problem?
My code:
My logs:
Beta Was this translation helpful? Give feedback.
All reactions