DHT21 humidity sensor doesnt work

Discuss development of drivers for external hardware and components, such as LCD screens, sensors, motor drivers, etc.
Target audience: Users and developers of drivers.
Post Reply
VladVons
Posts: 19
Joined: Sun Feb 12, 2017 6:49 pm
Location: Ukraine

DHT21 humidity sensor doesnt work

Post by VladVons » Sat Jun 09, 2018 5:08 am

I have DHT21 sensor, 3 wires, 4,7 k resistor.
It causes exception ETIMEOUT

Code: Select all

import dht
import time

aPin = 14
#Pin = machine.Pin(aPin, machine.Pin.IN, machine.Pin.PULL_UP)
Pin = machine.Pin(aPin)
Obj = dht.DHT22(Pin)
time.sleep_ms(250)
Obj.measure()
-> exception : ETIMEOUT
 
native GitHub micropython driver source here:
https://github.com/micropython/micropyt ... /dht/dht.c
However this driver works good on micropython wirh DHT22 sensor

It seems that DHT21 and DHT22 are similar. Or not?
On a raspberry i use another python driver from Adafruit_DHT and both DHT21 and DHT21 are working good

how to solve this problem using micropython on ESP8266 chip?

Post Reply