androidthings / contrib-drivers

Open source peripheral drivers
Apache License 2.0
560 stars 174 forks source link

Please add support DHT22 Sensor #12

Open Nizomjon1994 opened 7 years ago

Nizomjon1994 commented 7 years ago

Please add DHT22 temperature sensor in this driver.

SergiyKorotun commented 7 years ago

+1

gmarat13 commented 7 years ago

+1

emmynet commented 7 years ago

+1

emmynet commented 7 years ago

I think it is not possible to implement a driver for this sensor for the GPIO speed transmission constraints.


from: androidthings.rocks

In the Native SDK the GPIO speed is 0.15ms , which is still 150μs and nowhere near the 20-40μs required by the sensor.

Android Things and the fact it uses Linux, which is not a real-time operating system. A conversation with a member of the Android Things team suggested the following:

Your not likely to get consistent sub-1ms timing at the application layer. If the data on the wire is timed the same as a UART, you might be able to write/read using a custom baud rate (thats ~25K baud). Otherwise you’ll probably have to implement it on an MCU.


I tried to do a porting of rasbian c++ code but the Gpio::setValue(..)/Gpio::getValue() speed is high (150μs).

I think that if we use Native PIO, we have the same result.