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 500 kHz500\text{ kHz} LC antenna coil, it analyzes radio frequency (RF) electromagnetic emissions generated by electrical discharges in clouds.

Capable of estimating storm front distances from 1 km1\text{ km} to 40 km40\text{ km} 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 I2CI^2C 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)
InterfaceI2CI^2C (up to 400 kHz) & SPI (up to 2 MHz)
Default I2CI^2C address0x03 (ADD0 / SI pin High)
Alternate I2CI^2C address0x00 (ADD0 / SI pin Low to GND)
Distance estimation range1 km to 40 km (in 14 steps: 40, 37, 34, 31, 27, 24, 20, 17, 14, 12, 10, 7, 5, 1 km)
RF center frequency500 kHz (LC tank antenna tuned with internal tuning caps)
False noise rejectionBuilt-in algorithm rejects man-made electrical noise spikes
Operating current60 μA60\ \mu\text{A} active listening / 2 μA2\ \mu\text{A} power-down

Pinout

Breakout module header:

PinNameTypeDescription
1VCCPowerSupply input (+2.4 V to +5.5 V DC)
2GNDPowerGround reference (0 V)
3SCL / SCKDigital InputI2CI^2C Serial Clock / SPI Clock
4SDA / MOSIDigital Input / OutputI2CI^2C Serial Data / SPI Data In
5MISO / ADD0Digital OutputSPI Data Out / I2CI^2C Address Bit 0
6CSDigital InputChip Select (High = I2CI^2C mode, Low = SPI mode)
7SIDigital InputInterface Select (High = I2CI^2C mode, Low = SPI mode)
8IRQDigital OutputActive-High interrupt output (triggers on lightning / noise event)

Specifications

ParameterSymbolMinTypMaxUnitConditions
Supply VoltageVCCV_{CC}2.43.35.5VDC
Active Supply CurrentICCI_{CC}60100µAListening for RF signals
Power-Down CurrentIpdI_{pd}2.05.0µAPower-down state
Antenna Resonance Freqfresonancef_{resonance}490500510kHzTuned via internal 0120 pF0\dots 120\text{ pF} caps
Detection RangeDistDist140kmStorm front distance
Interrupt Pulse WidthtIRQt_{IRQ}2msActive-High pulse duration

Operating Principle & Internal Antenna Tuning

  1. RF Sensing: Thunderstorm electrical arcs produce strong VLF/LF electromagnetic bursts. The onboard 500 kHz500\text{ kHz} LC inductor coil picks up the magnetic component of these waves.
  2. Internal Antenna Tuning (Register 0x08): Manufacturing tolerances alter LC coil inductance. The AS3935 features internal switchable tuning capacitors (0 to 120 pF0\text{ to }120\text{ pF} in 8 pF8\text{ pF} steps) to trim the antenna resonance accurately to 500 kHz±3.5%500\text{ kHz} \pm 3.5\%.
  3. Interrupt Handling: When an RF burst occurs, IRQ goes High. The host MCU reads Register 0x03 (Interrupt Status):
    • 0x01: Noise level too high (Man-made disturber detected).
    • 0x04: Disturber detected.
    • 0x08: Lightning strike detected! Read Register 0x07 for estimated distance in km.

Wiring

AS3935 PinArduino / MCUESP32Notes
VCC3.3V / 5V3.3VPower rail
GNDGNDGNDSystem ground
SCLA5GPIO 22I2CI^2C Clock
SDAA4GPIO 21I2CI^2C Data
SI3.3V / 5V3.3VPull High for I2CI^2C mode
CS3.3V / 5V3.3VPull High for I2CI^2C mode
IRQDigital D2 (INT0)GPIO 4Active-High interrupt pin

Example (SparkFun AS3935 Library)

cpp
#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 SI or CS floating in I2CI^2C mode: Both SI and CS must be tied High to 3.3V for I2CI^2C communication.
  • Placing near switching power supplies or Wi-Fi antennas: High-frequency switching regulators, Wi-Fi routers, and laptop screens generate strong 500 kHz500\text{ kHz} magnetic noise, causing constant DISTURBER interrupts. Keep the sensor at least 1 meter1\text{ meter} away from switching electronics.

Notes

  • AS3935 Indoor vs Outdoor Mode: Setting INDOOR increases low-noise gain; setting OUTDOOR lowers gain to prevent false triggers under open-sky noise.

Assets & downloads