WebServer with AM2302 Sensor #2570
Replies: 10 comments
-
The response from DHT sensors is "time coded": the signal stays high for different times to indicate a 0 or a 1. The AM3202-Sensor library measure these times using a loop and delays, so it will be sensitive to interrupts. I observed similar problems with CircuitPython and a Adafruit library. The RP2040 has ways to do this more efficiently, by doing the reading in the other core or using the PIO. |
Beta Was this translation helpful? Give feedback.
-
See this issue on Arduino core and on pico SDK. I will check this at ESP8266 but expectation is, this does not occur. |
Beta Was this translation helpful? Give feedback.
-
@dquadros have you examples shifting to other core? |
Beta Was this translation helpful? Give feedback.
-
Run your sensor update in As @dquadros said, we may have more interrupts than the 8266 especially since the IP stack runs without needing |
Beta Was this translation helpful? Give feedback.
-
Great Thanks for your feedback @earlephilhower + @dquadros . |
Beta Was this translation helpful? Give feedback.
-
Moved to a discussion since it's not a core issue. The PIO is a simple FSM that you can program with its own small assembly language. See the datasheet where they show examples of things like Manchester decoding. That said, it looks like you have a max of 80 bit times, each being ~100us on average. So 8ms total during reception. You might really want to try disabling interrupts around your readout process (no |
Beta Was this translation helpful? Give feedback.
-
I have an example of PIO code, but for using with the SDK: https://github.com/dquadros/PicoSensors/tree/main/SDK/Temperature/dht |
Beta Was this translation helpful? Give feedback.
-
@dquadros |
Beta Was this translation helpful? Give feedback.
-
I wrote the pio code. To use it it has to be "assembled" by pioasm, this generates an include (.h) file, that is included in the cpp source. Some adjustments need to be done to use this under Arduino. |
Beta Was this translation helpful? Give feedback.
-
Hi Guy, checked wirh two cores, but issue exists. Not so much as with obly one core but is there. |
Beta Was this translation helpful? Give feedback.
-
Dear @earlephilhower,
thank you for providing this library.
I checked this with the RaspberryPi PicoW in the following way, and observed a not expected behaviour.
When you use the sensor lib alone on the Pico/PicoW everything is fine:
sensor.read() ==> returns always Status == OK.
But when you use the Sensor lib in combination with the Webserver the
sensor.read() ==> returns mostly not Status == OK.
What means Webserver + Sensor readings is too much for the PicoW, my assumption.
But it is difficult to believe for me.
Wanted to analyse more in detail.
Can you give some hints to this issue?
AM2302 Lib: AM2302-Sensor
Beta Was this translation helpful? Give feedback.
All reactions