I recently used esphome.io to create a washing machine and dryer monitoring system and it worked very well. So well, I thought I’m going to build a bunch of stuff! I ordered temp/humidity sensors, motion sensors, distance sensors, some relays and some other stuff to play around building things. Anyway, I started to get some of the components and for a quick and easy test I decided to wire up the PIR AM312 and the DHT22/AM2302 to my NodeMCU and program it with EspHome quickly to watch it work.
To my amazement, I’ve spent half the day trying to get it to work and it’s still just spitting out messages like this:
[20:26:26][W][dht:120]: Requesting data from DHT failed!
[20:26:26][W][dht:058]: Invalid readings! Please check your wiring (pull-up resistor, pin number).
[20:26:56][W][dht:120]: Requesting data from DHT failed!
[20:26:56][W][dht:058]: Invalid readings! Please check your wiring (pull-up resistor, pin number).
[20:27:26][W][dht:120]: Requesting data from DHT failed!
[20:27:26][W][dht:058]: Invalid readings! Please check your wiring (pull-up resistor, pin number).
[20:27:56][W][dht:120]: Requesting data from DHT failed!
[20:27:56][W][dht:058]: Invalid readings! Please check your wiring (pull-up resistor, pin number).
[20:28:01][I][ota:046]: Boot seems successful, resetting boot loop counter.
[20:28:26][W][dht:120]: Requesting data from DHT failed!
[20:28:26][W][dht:058]: Invalid readings! Please check your wiring (pull-up resistor, pin number).
[20:28:56][W][dht:120]: Requesting data from DHT failed!
My esphome config file currently looks like this:
esphome:
name: testing
platform: ESP8266
board: nodemcuv2
wifi:
ssid: "MySSID"
password: "MyPW"
domain: "MyNet"
logger:
level: DEBUG
api:
password: 'testing'
ota:
password: 'testing'
sensor:
- platform: dht
pin: D1
model: AM2302
temperature:
name: "Office Temperature"
humidity:
name: "Office Humidity"
update_interval: 30s
binary_sensor:
- platform: gpio
pin: D2
device_class: motion
name: "Office Motion"
For the temperature/humidity sensor, I tried moving the input pins around, I tried using the DHT22 model instead of the AM2302. I tried powering the sensor from the 5V line instead of the 3V line. It seems to always say those two messages, every thirty seconds.
For the PIR motion sensor (AM312), if I comment out the temperature/humidity sensor when I upload the config and the NodeMCU reboots, absolutely nothing comes out. It’s like I programmed an empty config file to the thing or something.
I’m not sure why neither of these are working, can someone please let me know where I’m going wrong?
The DHT22 sensor I’m using looks exactly like this one:
Here’s a picture of one of my AM312 sensors:
As you can see, there are no clear markings of which pin is which, so maybe I’m hooking it up wrong?