Can't get an i2c lightning sensor to detect

Hi All, I’m trying to convert a Tasmota based ESP8266 (d1 Mini) over to ESPhome and for some reason it refuses to detect the sensor.

INFO ESPHome 2023.12.9
INFO Reading configuration /config/esphome/lightning-sensor.yaml...
INFO Starting log output from 192.168.5.10 using esphome API
INFO Successfully connected to lightning-sensor @ 192.168.5.10 in 0.093s
INFO Successful handshake with lightning-sensor @ 192.168.5.10 in 19.726s
[19:26:30][I][app:102]: ESPHome version 2023.12.9 compiled on Jan 31 2024, 19:15:02
[19:26:32][C][wifi:573]: WiFi:
[19:26:32][C][wifi:405]:   Local MAC: [redacted]
[19:26:32][C][wifi:410]:   SSID: [redacted]
[19:26:32][C][wifi:411]:   IP Address: 192.168.5.10
[19:26:32][C][wifi:412]:   BSSID: [redacted]
[19:26:32][C][wifi:414]:   Hostname: 'lightning-sensor'
[19:26:32][C][wifi:416]:   Signal strength: -75 dB ▂▄▆█
[19:26:32][C][wifi:420]:   Channel: 6
[19:26:32][C][wifi:421]:   Subnet: 255.255.255.0
[19:26:32][C][wifi:422]:   Gateway: 192.168.5.254
[19:26:32][C][wifi:423]:   DNS1: 192.168.5.254
[19:26:32][C][wifi:424]:   DNS2: 0.0.0.0
[19:26:32][C][logger:439]: Logger:
[19:26:32][C][logger:440]:   Level: DEBUG
[19:26:32][C][logger:441]:   Log Baud Rate: 115200
[19:26:32][C][logger:443]:   Hardware UART: UART0
[19:26:32][C][i2c.arduino:053]: I2C Bus:
[19:26:32][C][i2c.arduino:054]:   SDA Pin: GPIO4
[19:26:32][C][i2c.arduino:055]:   SCL Pin: GPIO5
[19:26:42][C][i2c.arduino:056]:   Frequency: 50000 Hz
[19:26:42][C][i2c.arduino:059]:   Recovery: bus successfully recovered
[19:26:42][I][i2c.arduino:069]: Results from i2c bus scan:
[19:26:42][I][i2c.arduino:071]: Found no i2c devices!
[19:26:42][C][as3935:035]: AS3935:
[19:26:42][C][as3935:036]:   Interrupt Pin: GPIO13
[19:26:42][C][as3935:038]:   Thunder alert 'Storm Alert'
[19:26:42][C][as3935:041]:   Distance 'Distance Storm'
[19:26:42][C][as3935:041]:     State Class: ''
[19:26:42][C][as3935:041]:     Unit of Measurement: 'km'
[19:26:42][C][as3935:041]:     Accuracy Decimals: 1
[19:26:42][C][as3935:041]:     Icon: 'mdi:signal'
[19:26:42][C][as3935:042]:   Lightning energy 'Lightning Energy'
[19:26:42][C][as3935:042]:     State Class: ''
[19:26:42][C][as3935:042]:     Unit of Measurement: ''
[19:26:42][C][as3935:042]:     Accuracy Decimals: 1
[19:26:42][C][as3935:042]:     Icon: 'mdi:flash'

In tasmota, it detected fine. I flashed it with ESPHome:

i2c:
  sda: GPIO4
  scl: GPIO5
  scan: true
  frequency: 50kHz
  id: bus_a

I have confirmed these are the pins in use, as per the previous tasmota config as well as physically and it does not find it on ESPHome firmware.

I flashed a generic arduino ‘scan i2c’ devices over to it, and it detects the device fine.

The frequency and id were both added in hopes it would detect but it has made no difference. Is there something special I need to do?

I recall seeing something about a known issue with changing from tasmota to esphome. I dont recall the details to fix it but you might try a google search.

I dont recall hearing good reviews about these sensors either either, so im not sure what your expectations are.

Does it work if you use the ESPHome supported component (looks like you are using something custom?).

You can also try these i2c tricks.

Yes, I am using the AMS sensor, so it is a fully supported module. Regardless, I would expect the i2c scan to at least find the sensor.

I’ll have a look into the help options provided by both of you.

Thanks for the help.

1 Like

Did you set the what are you doing with pins A0, A1?

Yes, it’s on 0x30 as default for the plugin, and as detected when I run generic arduino code.

I’ve tried adding the delay/wire.begin code as mentioned in the previous linked post but this also has had no impact.

I’ve now also tried 3 other ESP8266’s in D1 Mini style packages and none of them seem to work. I’m at a loss…