Overview
The AS3935 (manufactured by ams OSRAM) is a programmable Franklin lightning sensor IC designed to detect approaching thunderstorm activity. Mounted on a breakout module equipped with a specially tuned LC antenna coil, it analyzes radio frequency (RF) electromagnetic emissions generated by electrical discharges in clouds.
Capable of estimating storm front distances from to across 14 discrete distance steps, the AS3935 distinguishes between true lightning strikes (both cloud-to-ground and intra-cloud strikes) and man-made electrical noise (such as motor commutators, fluorescent light starters, and relays). Communicating over or SPI, it is deployed in personal storm warning devices, golf course weather stations, and ESPHome smart home nodes.
Quick reference
Operating voltage (VCC) | 2.4 V to 5.5 V DC (3.3 V nominal) |
| Interface | (up to 400 kHz) & SPI (up to 2 MHz) |
| Default address | 0x03 (ADD0 / SI pin High) |
| Alternate address | 0x00 (ADD0 / SI pin Low to GND) |
| Distance estimation range | 1 km to 40 km (in 14 steps: 40, 37, 34, 31, 27, 24, 20, 17, 14, 12, 10, 7, 5, 1 km) |
| RF center frequency | 500 kHz (LC tank antenna tuned with internal tuning caps) |
| False noise rejection | Built-in algorithm rejects man-made electrical noise spikes |
| Operating current | active listening / power-down |
Pinout
Breakout module header:
| Pin | Name | Type | Description |
|---|---|---|---|
| 1 | VCC | Power | Supply input (+2.4 V to +5.5 V DC) |
| 2 | GND | Power | Ground reference (0 V) |
| 3 | SCL / SCK | Digital Input | Serial Clock / SPI Clock |
| 4 | SDA / MOSI | Digital Input / Output | Serial Data / SPI Data In |
| 5 | MISO / ADD0 | Digital Output | SPI Data Out / Address Bit 0 |
| 6 | CS | Digital Input | Chip Select (High = mode, Low = SPI mode) |
| 7 | SI | Digital Input | Interface Select (High = mode, Low = SPI mode) |
| 8 | IRQ | Digital Output | Active-High interrupt output (triggers on lightning / noise event) |
Specifications
| Parameter | Symbol | Min | Typ | Max | Unit | Conditions |
|---|---|---|---|---|---|---|
| Supply Voltage | 2.4 | 3.3 | 5.5 | V | DC | |
| Active Supply Current | — | 60 | 100 | µA | Listening for RF signals | |
| Power-Down Current | — | 2.0 | 5.0 | µA | Power-down state | |
| Antenna Resonance Freq | 490 | 500 | 510 | kHz | Tuned via internal caps | |
| Detection Range | 1 | — | 40 | km | Storm front distance | |
| Interrupt Pulse Width | — | 2 | — | ms | Active-High pulse duration |
Operating Principle & Internal Antenna Tuning
- RF Sensing: Thunderstorm electrical arcs produce strong VLF/LF electromagnetic bursts. The onboard LC inductor coil picks up the magnetic component of these waves.
- Internal Antenna Tuning (Register
0x08): Manufacturing tolerances alter LC coil inductance. The AS3935 features internal switchable tuning capacitors ( in steps) to trim the antenna resonance accurately to . - Interrupt Handling: When an RF burst occurs,
IRQgoes High. The host MCU reads Register0x03(Interrupt Status):0x01: Noise level too high (Man-made disturber detected).0x04: Disturber detected.0x08: Lightning strike detected! Read Register0x07for estimated distance in km.
Wiring
| AS3935 Pin | → | Arduino / MCU | ESP32 | Notes |
|---|---|---|---|---|
VCC | 3.3V / 5V | 3.3V | Power rail | |
GND | GND | GND | System ground | |
SCL | A5 | GPIO 22 | Clock | |
SDA | A4 | GPIO 21 | Data | |
SI | 3.3V / 5V | 3.3V | Pull High for mode | |
CS | 3.3V / 5V | 3.3V | Pull High for mode | |
IRQ | Digital D2 (INT0) | GPIO 4 | Active-High interrupt pin |
Example (SparkFun AS3935 Library)
#include <Wire.h>
#include "SparkFun_AS3935_I2C.h"
#define AS3935_ADDR 0x03
#define IRQ_PIN 2
SparkFun_AS3935_I2C lightning(AS3935_ADDR);
volatile bool lightningInt = false;
void lightningISR() {
lightningInt = true;
}
void setup() {
Serial.begin(115200);
Wire.begin();
pinMode(IRQ_PIN, INPUT);
attachInterrupt(digitalPinToInterrupt(IRQ_PIN), lightningISR, RISING);
if (!lightning.begin()) {
Serial.println("AS3935 Lightning Sensor not found!");
while (1);
}
// Set environment: INDOOR or OUTDOOR
lightning.setIndoorOutdoor(INDOOR);
// Tune internal antenna capacitors to 500 kHz (e.g. 96 pF)
lightning.tuneCapacitor(0x0C);
Serial.println("AS3935 Lightning Detector active and listening...");
}
void loop() {
if (lightningInt) {
lightningInt = false;
// Read interrupt source
int intVal = lightning.readInterruptReg();
if (intVal == LIGHTNING) {
byte distance = lightning.distanceToStorm();
Serial.print("LIGHTNING STRIKE DETECTED! Estimated Distance: ");
Serial.print(distance); Serial.println(" km");
} else if (intVal == DISTURBER) {
Serial.println("Electrical noise / disturber detected.");
} else if (intVal == NOISE) {
Serial.println("Noise floor too high.");
}
}
}
Common mistakes
- Leaving
SIorCSfloating in mode: BothSIandCSmust be tied High to 3.3V for communication. - Placing near switching power supplies or Wi-Fi antennas: High-frequency switching regulators, Wi-Fi routers, and laptop screens generate strong magnetic noise, causing constant
DISTURBERinterrupts. Keep the sensor at least away from switching electronics.
Notes
- AS3935 Indoor vs Outdoor Mode: Setting
INDOORincreases low-noise gain; settingOUTDOORlowers gain to prevent false triggers under open-sky noise.
Assets & downloads
- datasheetdatasheet
- product-pagereference