This is the AS3935 Sensor a programmable and fully integrated lightning sensor IC that detects the presence and approach of potential hazardous lightning activity in the area and provides an estimation on the distance to the head of the storm. The AS3935 algorithm will verify the incoming signal pattern to reject the potential man-made disturbances. AS395 can be also provide an information at the noise level and inform the Microcontroller in case of high noise conditions, with the noise ground generator and noise ground evaluation blocks.

This device can be programmed via SPI or i2C via 4 different address, 2 clocks are internally generated by two different RC OSCILLATORS TRCO and SRCO an automatic procedure can increase the precision of the oscillators. AS3935 can detect distance estimation to the head of the storm down to 1 kilometer in 14 steps on lightning storm activity can detects at radius of 40 Kilometer, and detects both cloud-to-ground and intra-cloud (cloud to cloud) flashes. This device is ideal for Weather Stations, Clocks, Sports Equipment’s, Smart UPS, Pool Safety Devices, and Smart Portable Devices, GPS (Global Positioning System, Cellular Phones, and Watches. Etc. For further information see the datasheet below.

Required Components

  • Arduino Microcontroller, NodeMCU, Teensy Board, TeensyDuino, ESP8266 12, 12E, ESP8266 NodeMCU, ESPDuino, ATMEGA328 16/12, ATMEGA32u4 16/8/ MHz, ESP8266, ATMEGA250 16 MHz, ATSAM3x8E, ATSAM21D, ATTINY85 16/8 MHz (Note: The Diagram below is using NANO. (please refer to the respective pin-outs)
  • AS3935 IC / AS3935 Module
  • Capacitors (See the diagram below for soldering manually)
  • Resistors (See the diagram below for soldering manually)
  • Jumper Wires / DuPont Wires
  • Prototyping PCB board (for soldering manually)

Wiring Guide

Wiring on i2C

Wiring on SPI

Source Code for i2C

Source Code for SPI

Source Code for I2C Address Finder / Scanner


  • AS3935 Lightning Sensor Datasheet | PDF
  • Download I2C.h Library | Zip
  • Download SPI.h Library | Zip
  • Download AS3935 Code Library for i2C | Zip
  • Download AS3935 Code Library for SPI | Zip
Wiring the Franklin AS3935 i2C / SPI Storm / Lightning Detection Sensor on Microcontroller
Tagged on:             

2 thoughts on “Wiring the Franklin AS3935 i2C / SPI Storm / Lightning Detection Sensor on Microcontroller

  • at

    The example code above doesn’t work an a ESP8266.

    • at

      See your TWI protocol pin configuration which is assigned in your ESP board, be aware of the logic control. if your building a custom board see the ESP8266 chip pinout / you can also use SC18IS600 for SPI to TWI conversion.


Leave a Reply

Your email address will not be published. Required fields are marked *