I am using the presoldered version on PCB v3.3 with an additional SGP41 sensor from the airgradient shop. Unfortunately, the I2C bus hangs after a while (I haven’t reliably gotten a reproducable time frame, yet). This leads to the SHT, SGP and SSD1306 to stop working altogether.
So I tried adding a reboot cycle every 24 hours, but that won’t recover the I2C bus once it hangs. Only physical power cycling allows for the I2C bus to be available once again.
I was under the impression that the presoldered kit in combination with the “official” SGP addon would be constructed in a way (line lengths, pullups, clock speeds, voltages) so this won’t happen? Now I’m not so sure anymore, so what could I test in order to make this work consistently?
Those are the relevant parts of my esphome config yaml:
# Airgradient Pro presoldered edition on D1 mini v4.0.0 with usb c port
substitutions:
devicename: "airgradient-pro"
upper_devicename: "Airgradient Pro"
esphome:
name: "${devicename}"
# Automatically add the mac address to the name
# so you can use a single firmware for all devices
# name_add_mac_suffix: true
platform: ESP8266
board: d1_mini
# Enable logging
logger:
#level: INFO
#level: DEBUG
level: VERY_VERBOSE
display:
- platform: ssd1306_i2c
id: oled
address: 0x3c
rotation: 180°
model: "SH1106 128x64"
update_interval: 10s
setup_priority: -100
# contrast: 30%
pages:
- id: display_all
lambda: |-
int i=0;
if(id(temp).state != id(temp).state) {} else {it.printf(0, i, id(opensans), "Temperature: %0.2f C", id(temp).state);i=i+10;}
if(id(hum).state != id(hum).state) {} else {it.printf(0, i, id(opensans), "Humidity: %0.2f %%", id(hum).state);i=i+10;}
if(id(pm10).state != id(pm10).state) {} else {it.printf(0, i, id(opensans), "PM1/2.5/10: %.f/%.f/%.f", id(pm10).state, id(pm25).state, id(pm100).state);i=i+10;}
if(id(co2).state != id(co2).state) {} else {it.printf(0, i, id(opensans), "CO2: %.f ppm", id(co2).state);i=i+10;}
if(id(voc).state != id(voc).state) {} else {it.printf(0, i, id(opensans), "VOC Index: %.f", id(voc).state);i=i+10;}
if(id(nox).state != id(nox).state) {} else {it.printf(0, i, id(opensans), "NOx Index: %.f", id(nox).state);i=i+10;}
time:
- platform: sntp
id: sntp_time
timezone: UTC+1
servers:
- 192.168.0.1
on_time:
- cron: '0 59 3 * * *'
then:
switch.toggle: reboot
interval:
- interval: 10s
then:
- component.update: oled
i2c:
sda: D2
scl: D1
#frequency: 10kHz
setup_priority: -100
sensor:
- platform: sht3xd
temperature:
id: temp
name: ${upper_devicename} Temperature
humidity:
id: hum
name: ${upper_devicename} Humidity
address: 0x44
update_interval: 10s
- platform: sgp4x
voc:
id: voc
name: "VOC Index"
nox:
id: nox
name: "NOx Index"
compensation:
humidity_source: hum
temperature_source: temp
address: 0x59
switch:
- platform: restart
name: "Restart"
id: reboot
font:
- file: "monofont.ttf"
id: opensans
size: 12