eliteio / PietteTech_DHT

DHT Sensor Library for Spark Core
Other
9 stars 6 forks source link

2 DHT devices, 2nd device returns valid results less than 50% of the time #3

Open sheetsg77 opened 4 years ago

sheetsg77 commented 4 years ago

Using two DHT22 devices (one ASAIR AM2302 and one DHT22) connected to a Particle Argon, it was noted that the second device (Device “B”), returned a valid result (i.e. without checksum error), less than 50% of the time.

Argon Jitter WriteUp.pdf

notanative commented 4 years ago

Interesting analysis. I'm looking at a project that would use multiple DHT sensors, so this is concerning. Might this issue you found be specific to Argon? Can you try to replicate with Photon or Xenon?

sheetsg77 commented 4 years ago

@notanative : I've got those devices and I will try them too.

More analysis was accomplished measuring the timing in and around the interrupt routine using an Argon OS 1.4.2. Using pinSetFast(D7) upon entry to the isrCallback and several pinResetFast(D7) placed at the potential exit points of the ISR and an oscilloscope, the measured time from falling edge to beginning of the ISR was between 8us to 44us. The time within the ISR was approx. 12us.

Additionally, acquiring both devices simultaneously produced valid results less than 50% of the time. However, acquiring in a sequential fashion (i.e. start device B after device A has returned), produced valid results better than 96% of the time.

Conclusion: Argon, and maybe all Mesh Particle devices, can't be used to measure kHz speed signals (8 - 14 kHz, "1" pulse width and "0" pulse width respectively).

sheetsg77 commented 4 years ago

@notanative I tested PietteTech_DHT using a Photon OS 1.4.4, and found the routine works as expected. Measuring time from falling edge of DHT signal to beginning of ISR was approx 1.6us. Hence, a few microseconds of variation is small compared to the 80 or 127us signal from DHT device, and as such nearly every reading produces a valid checksum verification.

However, the 8 to 44us measured in the Argon device, is a significant portion of the 80 or 127us signal, and hence the reason for the over 50% non-valid readings.

ScruffR commented 4 years ago

This response in the forum may be of interest here too.

ScruffR commented 4 years ago

@rickkas7 has just created a I2S based library to read DHT22 sensors on Gen3. Have a look there https://github.com/rickkas7/DHT22Gen3_RK