Hi everybody,
I have an AMS AS3935
(esphome docs) sensor that I am trying to connect via i²c
. I am not sure if it works, but just doesn’t provide any values, or if something is wrong. Can you please help me figure this out?
Relevant parts of my configuration:
sensor:
- platform: as3935
lightning_energy:
name: "Lightning Energy"
distance:
name: "Distance Storm"
i2c:
sda: 21
scl: 22
scan: true
id: myi2c
# Example configuration for I²C (decide for one!)
as3935_i2c:
irq_pin: GPIO27
# Example shared configuration
binary_sensor:
- platform: as3935
name: "Storm Alert"
As you can see, I didn’t use most optional configuration options; I always do this at the beginning of setting up a new ESPHome, then gradually improve my configuration. So far, this hasn’t caused any issues.
I am powering the ESP32 via USB from mains via USB to plug adapter, not via USB from PC (mentioning this because sometimes, things would not work when powered from PC USB port, but would then work when powered via mobile phone charger from mains).
It is connected like this (tested both 3V3 and 5V, which should both be supported by AS3935)
AS3935 | ESP32 |
---|---|
VDD | VDD |
GND | GND |
SCL | GPIO22 |
MOSI | GPIO21 |
CS | VDD |
SI | VDD |
IRQ | GPIO27 |
A1 | VDD |
A0 | VDD |
I tried pulling A0
and A1
high as well as not connecting those pins to anything.
Why am I not sure whether it is working or not? Well, as you can see in the logs below, there is an i²c bus scan
, which returns Found no i²c devices!
. Then a bit further down the log, you can see [as3935_i2c:040]: Address: 0x03
.
Since I did not specify an address
, I would assume that 0x03
is either correctly detected by ESPHome, or it just states this, because, according to docs, that is the default value for this sensor.
Docs also say that A0/A1
should be pulled high for the address to be 0x03
, that’s why I tried this. But the logs are the same whether or not these pins are connected to VCC or not connected at all.
address (Optional, int): Manually specify the I²C address of the sensor. Defaults to
0x03
(A0
andA1
pins pulled high).
We had lightning and a storm this morning, which lead me to finally trying to set up this sensor. But by the time I did, the storm was over. So I am not sure if Unbekannt
(=unknown
, or perhaps unavailable
in this context) just means there isn’t any detectable storm nor lightning, or if something is wrong with my configuration and/or the sensor.
logs:
[11:52:04][C][logger:301]: Logger:
[11:52:04][C][logger:302]: Level: DEBUG
[11:52:04][C][logger:303]: Log Baud Rate: 115200
[11:52:04][C][logger:305]: Hardware UART: UART0
[11:52:04][C][i2c.arduino:053]: I2C Bus:
[11:52:04][C][i2c.arduino:054]: SDA Pin: GPIO21
[11:52:04][C][i2c.arduino:055]: SCL Pin: GPIO22
[11:52:04][C][i2c.arduino:056]: Frequency: 50000 Hz
[11:52:04][C][i2c.arduino:059]: Recovery: bus successfully recovered
[11:52:04][I][i2c.arduino:069]: Results from i2c bus scan:
[11:52:04][I][i2c.arduino:071]: Found no i2c devices!
[11:52:04][C][restart:068]: Restart Switch 'Test/ESP32/Einfahrtstor Restart (Normal)'
[11:52:04][C][restart:070]: Icon: 'mdi:restart'
[11:52:04][C][restart:091]: Restore Mode: always OFF
[11:52:04][C][safe_mode_switch:068]: Safe Mode Switch 'Test/ESP32/Einfahrtstor Restart (Safe Mode)'
[11:52:04][C][safe_mode_switch:070]: Icon: 'mdi:restart-alert'
[11:52:04][C][safe_mode_switch:091]: Restore Mode: always OFF
[11:52:04][C][as3935:027]: AS3935:
[11:52:04][C][as3935:028]: Interrupt Pin: GPIO27
[11:52:04][C][as3935:030]: Thunder alert 'Storm Alert'
[11:52:04][C][as3935:033]: Distance 'Distance Storm'
[11:52:04][C][as3935:033]: State Class: ''
[11:52:04][C][as3935:033]: Unit of Measurement: 'km'
[11:52:04][C][as3935:033]: Accuracy Decimals: 1
[11:52:04][C][as3935:033]: Icon: 'mdi:signal'
[11:52:04][C][as3935:034]: Lightning energy 'Lightning Energy'
[11:52:04][C][as3935:034]: State Class: ''
[11:52:04][C][as3935:034]: Unit of Measurement: ''
[11:52:04][C][as3935:034]: Accuracy Decimals: 1
[11:52:04][C][as3935:034]: Icon: 'mdi:flash'
[11:52:04][C][as3935_i2c:040]: Address: 0x03
[11:52:04][C][captive_portal:088]: Captive Portal:
[11:52:04][C][web_server:161]: Web Server:
[11:52:04][C][web_server:162]: Address: 10.0.20.157:4711
[11:52:04][C][mdns:112]: mDNS:
[11:52:04][C][mdns:113]: Hostname: einfahrtstor
[11:52:04][C][ota:093]: Over-The-Air Updates:
[11:52:04][C][ota:094]: Address: 10.0.20.157:3232
[11:52:04][C][ota:097]: Using Password.
[11:52:04][C][api:138]: API Server:
[11:52:04][C][api:139]: Address: 10.0.20.157:6053
[11:52:04][C][api:141]: Using noise encryption: YES
Are you using this sensor? What state does it display when there isn’t a storm or lightning? Did I make any mistake setting this up, and if so, what do you suggest I change?
Thank you in advance for your help