Automated reptile vivarium - project

Hello all,

Thought I’d share my use of esphome and home assistant. And I’m after some ideas how to tackle an issue.

I have built wemos d1 mini with 2 dht22’s, and 1 led strip. Then using node red I have set up automations so that the warm part of the vivarium is regulated using a lamp and heat mat controlled by tasmota so off basic at day time and using the heat mat only at night for a lower temperature.

The problem I have is that the temperature sometimes stops updating. Causing the heaters to stay on. The only way I can fix this is by powering off the wemos d1 mini.

So the question is, should I

A) control the power supply to this d1 mini and if the dht22 doesn’t update say within half an hour then to power off, wait 5 seconds then power on again.

B) is there a code to carry out a hard reset for d1 mini within esphome.

Your thoughts, ideas and suggestions would be appreciated.

Rob. Oh example of the dht22 falling over

When this happens try using ESPhome to view the device log to see why it has stopped updating.

1 Like
INFO Reading configuration /config/esphome/viv.yaml...
INFO Starting log output from viv.local using esphome API
INFO Connecting to viv.local:6053 (192.168.0.133)
INFO Successfully connected to viv.local
[15:44:12][I][app:101]: esphome version 1.14.0-dev compiled on Jul 14 2019, 21:23:04
[15:44:12][C][wifi:399]: WiFi:
[15:44:12][C][wifi:267]:   SSID: 

[redacted]
[15:44:12][C][wifi:268]:   IP Address: 192.168.0.133
[15:44:12][C][wifi:270]:   BSSID: 

[redacted]
[15:44:12][C][wifi:271]:   Hostname: 'viv'
[15:44:12][C][wifi:275]:   Signal strength: -63 dB ▂▄▆█
[15:44:12][C][wifi:279]:   Channel: 1
[15:44:12][C][wifi:280]:   Subnet: 255.255.255.0
[15:44:12][C][wifi:281]:   Gateway: 192.168.0.1
[15:44:12][C][wifi:282]:   DNS1: 194.168.4.100
[15:44:12][C][wifi:283]:   DNS2: 194.168.8.100
[15:44:12][C][logger:175]: Logger:
[15:44:12][C][logger:176]:   Level: DEBUG
[15:44:12][C][logger:177]:   Log Baud Rate: 115200
[15:44:12][C][logger:178]:   Hardware UART: UART0
[15:44:12][C][light:174]: Light 'Vivarium LED'
[15:44:12][C][light:176]:   Default Transition Length: 1.0s
[15:44:12][C][light:177]:   Gamma Correct: 2.80
[15:44:12][C][dht:017]: DHT:
[15:44:12][C][dht:018]:   Pin: GPIO4 (Mode: INPUT)
[15:44:12][C][dht:024]:   Model: DHT22 (or equivalent)
[15:44:12][C][dht:027]:   Update Interval: 10.0s
[15:44:12][C][dht:029]:   Temperature 'Cool Side Temp'
[15:44:12][C][dht:029]:     Unit of Measurement: '°C'
[15:44:12][C][dht:029]:     Accuracy Decimals: 1
[15:44:12][C][dht:029]:     Icon: 'mdi:thermometer'
[15:44:12][C][dht:030]:   Humidity 'Cool Side Humidity'
[15:44:12][C][dht:030]:     Unit of Measurement: '%'
[15:44:12][C][dht:030]:     Accuracy Decimals: 0
[15:44:12][C][dht:030]:     Icon: 'mdi:water-percent'
[15:44:12][C][dht:017]: DHT:
[15:44:12][C][dht:018]:   Pin: GPIO0 (Mode: INPUT)
[15:44:12][C][dht:024]:   Model: DHT22 (or equivalent)
[15:44:12][C][dht:027]:   Update Interval: 10.0s
[15:44:12][C][dht:029]:   Temperature 'Warm Side Temp'
[15:44:12][C][dht:029]:     Unit of Measurement: '°C'
[15:44:12][C][dht:029]:     Accuracy Decimals: 1
[15:44:12][C][dht:029]:     Icon: 'mdi:thermometer'
[15:44:12][C][dht:030]:   Humidity 'Warm Side Humidity'
[15:44:12][C][dht:030]:     Unit of Measurement: '%'
[15:44:12][C][dht:030]:     Accuracy Decimals: 0
[15:44:12][C][dht:030]:     Icon: 'mdi:water-percent'
[15:44:12][C][ota:029]: Over-The-Air Updates:
[15:44:12][C][ota:030]:   Address: viv.local:8266
[15:44:13][C][api:095]: API Server:
[15:44:13][C][api:096]:   Address: viv.local:6053
[15:44:15][W][dht:120]: Requesting data from DHT failed!
[15:44:15][W][dht:058]: Invalid readings! Please check your wiring (pull-up resistor, pin number).
[15:44:16][D][dht:048]: Got Temperature=30.1°C Humidity=49.2%
[15:44:16][D][sensor:092]: 'Cool Side Temp': Sending state 30.10000 °C with 1 decimals of accuracy
[15:44:16][D][sensor:092]: 'Cool Side Humidity': Sending state 49.20000 % with 0 decimals of accuracy
[15:44:25][W][dht:120]: Requesting data from DHT failed!
[15:44:25][W][dht:058]: Invalid readings! Please check your wiring (pull-up resistor, pin number).
[15:44:26][D][dht:048]: Got Temperature=30.1°C Humidity=49.3%
[15:44:26][D][sensor:092]: 'Cool Side Temp': Sending state 30.10000 °C with 1 decimals of accuracy
[15:44:26][D][sensor:092]: 'Cool Side Humidity': Sending state 49.30000 % with 0 decimals of accuracy
[15:44:35][W][dht:120]: Requesting data from DHT failed!
[15:44:35][W][dht:058]: Invalid readings! Please check your wiring (pull-up resistor, pin number).
[15:44:36][D][dht:048]: Got Temperature=30.1°C Humidity=49.3%
[15:44:36][D][sensor:092]: 'Cool Side Temp': Sending state 30.10000 °C with 1 decimals of accuracy
[15:44:36][D][sensor:092]: 'Cool Side Humidity': Sending state 49.30000 % with 0 decimals of accuracy
[15:44:45][W][dht:120]: Requesting data from DHT failed!
[15:44:45][W][dht:058]: Invalid readings! Please check your wiring (pull-up resistor, pin number).
[15:44:46][D][dht:048]: Got Temperature=30.1°C Humidity=49.3%
[15:44:46][D][sensor:092]: 'Cool Side Temp': Sending state 30.10000 °C with 1 decimals of accuracy
[15:44:46][D][sensor:092]: 'Cool Side Humidity': Sending state 49.30000 % with 0 decimals of accuracy
[15:44:55][W][dht:120]: Requesting data from DHT failed!
[15:44:55][W][dht:058]: Invalid readings! Please check your wiring (pull-up resistor, pin number).
[15:44:56][D][dht:048]: Got Temperature=30.2°C Humidity=49.4%
[15:44:56][D][sensor:092]: 'Cool Side Temp': Sending state 30.20000 °C with 1 decimals of accuracy
[15:44:56][D][sensor:092]: 'Cool Side Humidity': Sending state 49.40000 % with 0 decimals of accuracy
[15:45:05][W][dht:120]: Requesting data from DHT failed!
[15:45:05][W][dht:058]: Invalid readings! Please check your wiring (pull-up resistor, pin number).
[15:45:06][D][dht:048]: Got Temperature=30.1°C Humidity=49.3%
[15:45:06][D][sensor:092]: 'Cool Side Temp': Sending state 30.10000 °C with 1 decimals of accuracy
[15:45:06][D][sensor:092]: 'Cool Side Humidity': Sending state 49.30000 % with 0 decimals of accuracy
[15:45:15][W][dht:120]: Requesting data from DHT failed!
[15:45:15][W][dht:058]: Invalid readings! Please check your wiring (pull-up resistor, pin number).
[15:45:16][D][dht:048]: Got Temperature=30.2°C Humidity=49.3%
[15:45:16][D][sensor:092]: 'Cool Side Temp': Sending state 30.20000 °C with 1 decimals of accuracy
[15:45:16][D][sensor:092]: 'Cool Side Humidity': Sending state 49.30000 % with 0 decimals of accuracy
[15:45:25][W][dht:120]: Requesting data from DHT failed!
[15:45:25][W][dht:058]: Invalid readings! Please check your wiring (pull-up resistor, pin number).
[15:45:26][D][dht:048]: Got Temperature=30.1°C Humidity=49.3%
[15:45:26][D][sensor:092]: 'Cool Side Temp': Sending state 30.10000 °C with 1 decimals of accuracy
[15:45:26][D][sensor:092]: 'Cool Side Humidity': Sending state 49.30000 % with 0 decimals of accuracy
[15:45:35][W][dht:120]: Requesting data from DHT failed!
[15:45:35][W][dht:058]: Invalid readings! Please check your wiring (pull-up resistor, pin number).
[15:45:36][D][dht:048]: Got Temperature=30.1°C Humidity=49.3%
[15:45:36][D][sensor:092]: 'Cool Side Temp': Sending state 30.10000 °C with 1 decimals of accuracy
[15:45:36][D][sensor:092]: 'Cool Side Humidity': Sending state 49.30000 % with 0 decimals of accuracy
[15:45:45][W][dht:120]: Requesting data from DHT failed!
[15:45:45][W][dht:058]: Invalid readings! Please check your wiring (pull-up resistor, pin number).
[15:45:46][D][dht:048]: Got Temperature=30.1°C Humidity=49.3%
[15:45:46][D][sensor:092]: 'Cool Side Temp': Sending state 30.10000 °C with 1 decimals of accuracy
[15:45:46][D][sensor:092]: 'Cool Side Humidity': Sending state 49.30000 % with 0 decimals of accuracy
[15:45:55][W][dht:120]: Requesting data from DHT failed!
[15:45:55][W][dht:058]: Invalid readings! Please check your wiring (pull-up resistor, pin number).
[15:45:56][D][dht:048]: Got Temperature=30.1°C Humidity=49.3%
[15:45:56][D][sensor:092]: 'Cool Side Temp': Sending state 30.10000 °C with 1 decimals of accuracy
[15:45:56][D][sensor:092]: 'Cool Side Humidity': Sending state 49.30000 % with 0 decimals of accuracy

ah pull up resistor?

Any ideas what value I should use?

Rob

Any value between 4.7K and 10KΩ connected between the Data and VCC pins.

1 Like

hello all again.

I have used a 4.7K resistor between pin D3 (GPIO0) on the Wemos D1 mini.

It failed again

I will tried 2 resistors in series to get nearer to 10K as previous suggestion.

Still failed. Same message.

I read somewhere that the pin I was using was not well suited for the dht22 sensor

I moved it onto pin D0 and now the sensor is failing but with a different message. As per the log below.

I have ordered another DHT22 to check it isn’t a faulty sensor.

Could cable length between the board and the sensor cause this issue? Although it is only about 400mm sane as the other sensor

Any suggestions would be appreciated.

Rob

Hey Rob,

These DHT22 devices are nothing but trouble from my experience, regardless of the length of wire or what resistors you solder in. I have only ever had two work fine, the rest i have thrown out and replaced with the cheaper DHT11 modules. There are thousands of complaints about them reporting a ‘null’ number after a while, in TASMOTA, RPi and Arduino code. Sometimes a few hours, sometimes days. And the only way to fix it, is to power cycle the device which is less than ideal.

I noticed this thread as I just fostered a ‘Beardy’ and 4’ tank for my teenage daughter. She loves it to bits. Anyway, was thinking about building automation around something for the tank and found your post. I was thinking about using:
1x DHT11 on the central back wall of the tank (mainly for humidity sensing)
1x UV a/b sensor at ground level
2x DS18B20 onewire temp sensors buried in the substrate. (for hot/cool side monitoring)
3x Relays to control the heat lamp, mat and UV light. (again time of day)

How did you end up getting on? Do you have any pictures or experiences to share?

I must have a good batch. I’ve got half a dozen of them that have been working faultlessly for 3 years.

I am looking at changing over to the SHT31D for better accuracy though.

1 Like

Im using sonoff minis to turn on the heat mat and the uvb bulb. I have node red in use for the automations as leopard geckos are crepuscular. I have uvb and heat mat to maintain temps during the day, and heat mat only to maintain a reduced temp at night.

I have 2 sensors one for the warmer side and one for the cooler side.

I have recently started to use k type thermo couples using max6675 board and other using hw855 adc analogue digital converter. Have to use lambda in the code to calculate in Celsius/Fahrenheit. It’s been working well.

Still have a dht for humidity but not relying on it for automations.

We also have some LEDs to turn on so we can see the lizards at feeding time etc.

1 Like