DHT22 or AM2302 Sensor with micro:bit

Questions and discussion about running MicroPython on a micro:bit board.
Target audience: MicroPython users with a micro:bit.
Post Reply
jmo
Posts: 1
Joined: Mon Dec 11, 2017 1:49 pm

DHT22 or AM2302 Sensor with micro:bit

Post by jmo » Mon Dec 11, 2017 1:54 pm

I was trying to connect a temp/humidity sensor that I have used previously with a raspberry pi. From what I have found, there is no library available for the micro:bit. The closest I have found is https://github.com/polygontwist/uPython-DHT22 but this is designed for the pyboard.

Has anyone successfully used this sensor with the micro:bit?

Is there a library available and I have just failed to locate it?

Is anyone able to port the above version so that it will work with the micro:bit?

Thank you.

User avatar
mcauser
Posts: 279
Joined: Mon Jun 15, 2015 8:03 am

Re: DHT22 or AM2302 Sensor with micro:bit

Post by mcauser » Wed Dec 13, 2017 11:42 am

DHT11, DHT22 and AM2302 only support the 1 wire interface.
I haven't tried using one with a micro:bit yet.

If you switch to a DHT12 or AM2320 (roughly same price), you can use their more user friendly I2C interface.
You could try porting these to the micro:bit. You may need to change some method names.
https://github.com/mcauser/micropython- ... /am2320.py
https://github.com/mcauser/micropython- ... r/dht12.py

Post Reply