Closed ds2k5 closed 6 years ago
The script can't find the sensor on your I2C bus. What dev board are you using? What ports are you using? Are you using I2C pull ups on the SCL+SDA lines?
The script can't find the sensor on your I2C bus.
What dev board are you using?
Board: ESP8266, NodeMcu v3 https://dziadalnfpolx.cloudfront.net/blog/wp-content/uploads/2015/09/esp8266-nodemcu-dev-kit-v3-pins.jpg
D1 (GPIO5)
D1 ---> DHT-22 PIN2 3V ---> DHT-22 PIN1 G ----> DHT-22 PIN4
import am2320 from machine import I2C, Pin i2c = I2C(scl=Pin(5), sda=Pin(4)) sensor = am2320.AM2320(i2c) sensor.measure() print(sensor.temperature()) print(sensor.humidity())
Few problems here. a) This is a driver for the AM2320, not the DHT22. The AM2320 is a newer black version of the DHT22. b) This driver only supports the I2C interface, not 1-wire. c) You need pull-ups on the I2C bus, on pins D1 (GPIO5) and D2 (GPIO4), or switch to pins D3 (GPIO0) and D4 (GPIO2) and use the onboard pull-ups.
Thanks mcauser, i have a white AM2302 - sorry
Hello, tryed to use you am2320.py
Traceback (most recent call last): File "", line 5, in
File "am2320.py", line 22, in measure
OSError: [Errno 19] ENODEV