Hello! I have some problems with MLX90614. It was working perfectly fine on it’s own being an only device on the I2C. That MLX90614 breakout board has internal 10k pull ups
i2c:
- scan: True
frequency: 100kHz
sensor:
- platform: mlx90614
update_interval: 20s
object:
name: Object
[17:30:53][I][i2c.arduino:096]: Results from i2c bus scan:
[17:30:53][I][i2c.arduino:102]: Found i2c device at address 0x5A
[17:30:56][VV][scheduler:226]: Running interval 'update' with interval=20000 last_execution=74490 (now=94491)
[17:30:56][VV][i2c.arduino:176]: 0x5A TX 24
[17:30:56][VV][i2c.arduino:148]: 0x5A RX FFFFD6
[17:30:56][VV][i2c.arduino:176]: 0x5A TX 07
[17:30:56][VV][i2c.arduino:148]: 0x5A RX 5739CE
[17:30:56][VV][i2c.arduino:176]: 0x5A TX 06
[17:30:56][VV][i2c.arduino:148]: 0x5A RX 3B39D1
[17:30:56][D][mlx90614:112]: Got Temperature=20.4°C Ambient=19.9°C
[17:30:56][V][sensor:043]: 'Object': Received new state 20.430000
[17:30:56][D][sensor:094]: 'Object': Sending state 20.43000 °C with 1 decimals of accuracy
[17:30:56][VV][api.service:140]: send_sensor_state_response: SensorStateResponse {
key: 3055412916
state: 20.43
missing_state: NO
}
I added VL53L0X and AHT25 on another separate I2C just to be safe since everything has gone wrong with my I2C bus projects in the past. Things started happening. When I added VL53L0X to the captive portal the MLX90614 started give out errors on reading and VL53L0X gave out component failed. AHT25 worked just fine
captive_portal:
i2c:
- id: bus_a
sda: GPIO21
scl: GPIO22
scan: True
frequency: 100kHz
- id: bus_b
sda: GPIO25
scl: GPIO26
scan: True
frequency: 100kHz
sensor:
- platform: mlx90614
update_interval: 20s
i2c_id: bus_a
object:
name: Object
- platform: aht10
i2c_id: bus_b
variant: aht20
temperature:
name: temperature
humidity:
name: humidity
update_interval: 25s
- platform: vl53l0x
name: VL53L0X
i2c_id: bus_b
update_interval: 30s
[20:10:40][C][i2c.arduino:071]: I2C Bus:
[20:10:40][C][i2c.arduino:072]: SDA Pin: GPIO21
[20:10:40][C][i2c.arduino:073]: SCL Pin: GPIO22
[20:10:40][C][i2c.arduino:074]: Frequency: 100000 Hz
[20:10:40][C][i2c.arduino:086]: Recovery: bus successfully recovered
[20:10:40][I][i2c.arduino:096]: Results from i2c bus scan:
[20:10:40][I][i2c.arduino:102]: Found i2c device at address 0x5A
[20:10:40][C][i2c.arduino:071]: I2C Bus:
[20:10:40][C][i2c.arduino:072]: SDA Pin: GPIO25
[20:10:40][C][i2c.arduino:073]: SCL Pin: GPIO26
[20:10:40][C][i2c.arduino:074]: Frequency: 100000 Hz
[20:10:40][C][i2c.arduino:086]: Recovery: bus successfully recovered
[20:10:40][I][i2c.arduino:096]: Results from i2c bus scan:
[20:10:40][I][i2c.arduino:102]: Found i2c device at address 0x29
[20:10:40][I][i2c.arduino:102]: Found i2c device at address 0x38
[20:54:37][VV][scheduler:225]: Running interval 'update' with interval=20000 last_execution=14188 (now=34188)
[20:54:37][VV][i2c.idf:197]: 0x5A TX 24
[20:54:37][VV][i2c.idf:173]: 0x5A RX FFFFD6
[20:54:37][VV][i2c.idf:197]: 0x5A TX 07
[20:54:37][VV][i2c.idf:173]: 0x5A RX BB2139
[20:54:37][VV][i2c.idf:197]: 0x5A TX 06
[20:54:37][VV][i2c.idf:173]: 0x5A RX A1B93B
[20:54:37][D][mlx90614:112]: Got Temperature=-100.4°C Ambient=nan°C
[20:54:37][V][sensor:043]: 'Object': Received new state -100.449997
[20:54:37][D][sensor:093]: 'Object': Sending state -100.45000 °C with 1 decimals of accuracy
[20:54:37][VV][api.service:140]: send_sensor_state_response: SensorStateResponse {
key: 3055412916
state: -100.45
missing_state: NO
I tried to get the VL53L0X to work and got it to work with a custom component BUT MLX90614 never gets a reading read.
esphome:
name: snow-depth-meter-tof
friendly_name: Snow depth meter ToF
includes:
- tof_vl53l1x.h
libraries:
- "Wire"
- "VL53L1x"
.
.
.
captive_portal:
i2c:
sda: GPIO21
scl: GPIO22
scan: True
frequency: 100kHz
sensor:
- platform: bh1750
name: "lux1_test"
address: 0x23
update_interval: 60s
- platform: aht10
variant: AHT20
address: 0x38
temperature:
name: "temp test"
humidity:
name: "humid test"
update_interval: 60s
- platform: custom
lambda: |-
auto my_sensor = new MyCustomSensor();
App.register_component(my_sensor);
return {my_sensor};
sensors:
- name: "Distance"
id: distance_raw
accuracy_decimals: 0
unit_of_measurement: "mm"
MLX90614
[22:19:44][VV][scheduler:226]: Running interval 'update' with interval=20000 last_execution=37494 (now=57495)
[22:19:44][VV][i2c.arduino:176]: 0x5A TX 24
[22:19:44][VV][i2c.arduino:148]: 0x5A RX 0909FF
[22:19:44][VV][i2c.arduino:176]: 0x5A TX 07
[22:19:45][VV][i2c.arduino:127]: RX 3 from 5A failed with error 0
[22:19:45][W][component:237]: Component mlx90614.sensor took a long time for an operation (1029 ms).
[22:19:45][W][component:238]: Components should block for at most 30 ms.
VL53L0X
[22:19:41][VV][scheduler:226]: Running interval 'update' with interval=15000 last_execution=39500 (now=54501)
[22:19:41][V][sensor:043]: 'Distance': Received new state 23.000000
[22:19:41][D][sensor:094]: 'Distance': Sending state 23.00000 mm with 0 decimals of accuracy
[22:19:41][VV][api.service:140]: send_sensor_state_response: SensorStateResponse {
key: 1240670792
state: 23
missing_state: NO
}
After removing AHT25 ja VL53L0X components from the code, it shows different kind of error readings
[13:53:58][VV][scheduler:226]: Running interval 'update' with interval=20000 last_execution=1615739 (now=1635744)
[13:53:58][VV][i2c.arduino:176]: 0x5A TX 24
[13:53:58][VV][i2c.arduino:148]: 0x5A RX 0000F2
[13:53:58][VV][i2c.arduino:176]: 0x5A TX 07
[13:53:58][VV][i2c.arduino:148]: 0x5A RX A06A0F
[13:53:58][VV][i2c.arduino:176]: 0x5A TX 06
[13:53:58][VV][i2c.arduino:148]: 0x5A RX A06A19
[13:53:58][D][mlx90614:112]: Got Temperature=272.8°C Ambient=272.8°C
[13:53:58][V][sensor:043]: 'Object': Received new state 272.769989
[13:53:58][D][sensor:094]: 'Object': Sending state 272.76999 °C with 1 decimals of accuracy
[13:53:58][VV][api.service:140]: send_sensor_state_response: SensorStateResponse {
key: 3055412916
state: 272.77
missing_state: NO
}
I have tried different cables, short and long. Different ESP32 devboards, different pins for I2C, different I2C devices but everything always goes south. Something might work on it’s own but when adding another device everything gets broken. At least with BH1750 and VL53L0X.
I have this project box which is going to measure the depth of snow coverage outside with VL53L0X, ground/snow surface temperature with MLX90614, lightness with BH1750 and AHT25 is going to measure temperature and humidity inside the device enclosure.
I have been on this project for over a month and I never get multiple devices to work properly. Or they might work for a while and they just randomly stop working or might stop working when I reboot the ESP32.
I am in the verge of forgetting about I2C completely. But the plug and play nature of I2C I get the feeling that there might be some kind of internal conflict with all of those. They might work just fine when all of the devices are connected to the ESP32 but the breaking happens when I add them in to the code. Sometimes it works for 5 minutes and then never. Sometimes it never boots and goes to a bootloop after listing every possible 7bit address on the i2c_scan.