I have attempted to connect two sensors to a WT32-ETH01 using the GPIO14 and GPIO15 pins, as well as GPIO33 and GPIO32. When only one sensor is connected, it works perfectly fine. However, when I connect the other sensor, only one of them is detected. Both sensors have the same address. Could it be possible that these pins run on the same bus, making this configuration not possible?
I2c config:
i2c:
- id: wasser
sda: GPIO14
scl: GPIO15
scan: true
frequency: 200kHz
- id: gas
sda: GPIO33
scl: GPIO32
scan: true
frequency: 200kHz
My understanding is if they are on separate busses they can use the same address. I’ve done that before with sensors which can’t have their address changed.
Could you show the config for the sensors please (and you should format your code like this btw)…
Use this formatting icon or put three back ticks before and after “```”
</>
type or paste code here
It could also possibly be a power issue.
1 Like
Is it possible that the pins on the WT32-ETH01 are internely connectet to the same bus?
Here is my code
i2c:
- id: wasser
sda: GPIO14
scl: GPIO15
scan: true
frequency: 200kHz
- id: gas
sda: GPIO33
scl: GPIO32
scan: true
frequency: 200kHz
#GAS-----------------------------------------------------
sensor:
- platform: qmc5883l
i2c_id: gas
address: 0x0D
field_strength_z:
name: "QMC5883L Field Strength Z"
id: mag
internal: true
range: 200uT
oversampling: 512x
update_interval: 5s
- platform: template
name: "Gas"
device_class: gas
unit_of_measurement: "m³"
state_class: "total_increasing"
icon: "mdi:fire"
accuracy_decimals: 1
lambda: |-
return id(gas_calibrate).state;
- platform: template
name: "Gas kWh"
device_class: energy
unit_of_measurement: "kWh"
state_class: "total_increasing"
icon: "mdi:fire"
accuracy_decimals: 3
lambda: |-
return id(gas_calibrate).state;
filters:
- multiply: 10.912272
#Wasser------------------------------------------------------
- platform: qmc5883l
i2c_id: wasser
address: 0x0D
field_strength_x:
name: "Wasser Strength X"
field_strength_y:
name: "Wasser Strength Y"
field_strength_z:
name: "Wasser Strength Z"
range: 200uT
oversampling: 512x
update_interval: 2s
#GAS----------------------------------------------------------
- platform: homeassistant
name: "gas_calibrate"
entity_id: input_number.gas_calibrate
id: gas_calibrate
binary_sensor:
- platform: template
name: "Sensor count"
id: sensor_count
internal: true
filters:
- delayed_on_off: 100ms
lambda: |
if (id(mag).state > 272) {
return {sensor_count: 1};
} else {
return {sensor_count: 0};
}
on_press:
then:
- homeassistant.service:
service: input_number.increment
data:
entity_id: input_number.gas_calibrate
and here is the log output
INFO Starting log output from 192.168.15.7 using esphome API
INFO Successfully connected to 192.168.15.7
[15:27:11][I][app:102]: ESPHome version 2023.5.5 compiled on Jun 1 2023, 20:45:41
[15:27:11][C][logger:301]: Logger:
[15:27:11][C][logger:302]: Level: DEBUG
[15:27:11][C][logger:303]: Log Baud Rate: 0
[15:27:11][C][logger:305]: Hardware UART: UART0
[15:27:11][C][i2c.arduino:053]: I2C Bus:
[15:27:11][C][i2c.arduino:054]: SDA Pin: GPIO14
[15:27:11][C][i2c.arduino:055]: SCL Pin: GPIO15
[15:27:11][C][i2c.arduino:056]: Frequency: 200000 Hz
[15:27:11][C][i2c.arduino:059]: Recovery: bus successfully recovered
[15:27:11][I][i2c.arduino:069]: Results from i2c bus scan:
[15:27:11][I][i2c.arduino:071]: Found no i2c devices!
[15:27:11][C][i2c.arduino:053]: I2C Bus:
[15:27:11][C][i2c.arduino:054]: SDA Pin: GPIO33
[15:27:11][C][i2c.arduino:055]: SCL Pin: GPIO32
[15:27:11][C][i2c.arduino:056]: Frequency: 200000 Hz
[15:27:11][C][i2c.arduino:059]: Recovery: bus successfully recovered
[15:27:11][I][i2c.arduino:069]: Results from i2c bus scan:
[15:27:11][I][i2c.arduino:075]: Found i2c device at address 0x0D
[15:27:12][C][template.sensor:022]: Template Sensor 'Gas'
[15:27:12][C][template.sensor:022]: Device Class: 'gas'
[15:27:12][C][template.sensor:022]: State Class: 'total_increasing'
[15:27:12][C][template.sensor:022]: Unit of Measurement: 'm³'
[15:27:12][C][template.sensor:022]: Accuracy Decimals: 1
[15:27:12][C][template.sensor:022]: Icon: 'mdi:fire'
[15:27:12][C][template.sensor:023]: Update Interval: 60.0s
[15:27:12][C][template.sensor:022]: Template Sensor 'Gas kWh'
[15:27:12][C][template.sensor:022]: Device Class: 'energy'
[15:27:12][C][template.sensor:022]: State Class: 'total_increasing'
[15:27:12][C][template.sensor:022]: Unit of Measurement: 'kWh'
[15:27:12][C][template.sensor:022]: Accuracy Decimals: 3
[15:27:12][C][template.sensor:022]: Icon: 'mdi:fire'
[15:27:12][C][template.sensor:023]: Update Interval: 60.0s
[15:27:12][C][template.binary_sensor:018]: Template Binary Sensor 'Sensor count'
[15:27:12][C][qmc5883l:064]: QMC5883L:
[15:27:12][C][qmc5883l:065]: Address: 0x0D
[15:27:12][C][qmc5883l:069]: Update Interval: 5.0s
[15:27:12][C][qmc5883l:073]: Z Axis 'QMC5883L Field Strength Z'
[15:27:12][C][qmc5883l:073]: State Class: 'measurement'
[15:27:12][C][qmc5883l:073]: Unit of Measurement: 'µT'
[15:27:12][C][qmc5883l:073]: Accuracy Decimals: 1
[15:27:12][C][qmc5883l:073]: Icon: 'mdi:magnet'
[15:27:12][C][qmc5883l:064]: QMC5883L:
[15:27:12][C][qmc5883l:065]: Address: 0x0D
[15:27:12][E][qmc5883l:067]: Communication with QMC5883L failed!
[15:27:12][C][qmc5883l:069]: Update Interval: 2.0s
[15:27:12][C][qmc5883l:071]: X Axis 'Wasser Strength X'
[15:27:12][C][qmc5883l:071]: State Class: 'measurement'
[15:27:12][C][qmc5883l:071]: Unit of Measurement: 'µT'
[15:27:12][C][qmc5883l:071]: Accuracy Decimals: 1
[15:27:12][C][qmc5883l:071]: Icon: 'mdi:magnet'
[15:27:12][C][qmc5883l:072]: Y Axis 'Wasser Strength Y'
[15:27:12][C][qmc5883l:072]: State Class: 'measurement'
[15:27:12][C][qmc5883l:072]: Unit of Measurement: 'µT'
[15:27:12][C][qmc5883l:072]: Accuracy Decimals: 1
[15:27:12][C][qmc5883l:072]: Icon: 'mdi:magnet'
[15:27:12][C][qmc5883l:073]: Z Axis 'Wasser Strength Z'
[15:27:12][C][qmc5883l:073]: State Class: 'measurement'
[15:27:12][C][qmc5883l:073]: Unit of Measurement: 'µT'
[15:27:12][C][qmc5883l:073]: Accuracy Decimals: 1
[15:27:12][C][qmc5883l:073]: Icon: 'mdi:magnet'
[15:27:12][C][ethernet:179]: Ethernet:
[15:27:12][C][ethernet:306]: IP Address: 192.168.15.7
[15:27:12][C][ethernet:307]: Hostname: 'zaehler'
[15:27:12][C][ethernet:308]: Subnet: 255.255.240.0
[15:27:12][C][ethernet:309]: Gateway: 192.168.0.1
[15:27:12][C][ethernet:315]: DNS1: 0.0.0.0
[15:27:12][C][ethernet:316]: DNS2: 0.0.0.0
[15:27:12][C][ethernet:327]: MAC Address: C4:DE:E2:DA:0C:47
[15:27:12][C][ethernet:332]: Is Full Duplex: YES
[15:27:12][C][ethernet:337]: Link Speed: 100
[15:27:12][C][ethernet:182]: Power Pin: 16
[15:27:12][C][ethernet:184]: MDC Pin: 23
[15:27:12][C][ethernet:185]: MDIO Pin: 18
[15:27:12][C][ethernet:186]: Type: LAN8720
[15:27:12][C][ethernet:187]: PHY addr: 1
[15:27:12][C][mdns:108]: mDNS:
[15:27:12][C][mdns:109]: Hostname: zaehler
[15:27:12][C][ota:093]: Over-The-Air Updates:
[15:27:12][C][ota:094]: Address: 192.168.15.7:3232
[15:27:12][C][ota:097]: Using Password.
[15:27:12][C][api:138]: API Server:
[15:27:12][C][api:139]: Address: 192.168.15.7:6053
[15:27:12][C][api:141]: Using noise encryption: YES
[15:27:12][C][homeassistant.sensor:030]: Homeassistant Sensor 'gas_calibrate'
[15:27:12][C][homeassistant.sensor:030]: State Class: ''
[15:27:12][C][homeassistant.sensor:030]: Unit of Measurement: ''
[15:27:12][C][homeassistant.sensor:030]: Accuracy Decimals: 1
[15:27:12][C][homeassistant.sensor:031]: Entity ID: 'input_number.gas_calibrate'