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

Downloads

  • 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
Facebooktwitterredditpinterestmail
Tagged on:             

JLCPCBPCBgogoPCBway4pcb

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

  • at
    Permalink

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

    Reply
    • at
      Permalink

      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.

      Reply
  • at
    Permalink

    May I ask what the significance is in the use of;
    AS3935_DIST_DIS 0
    AS3935_DIST_EN 1
    What affect do these settings have and what setting options are there for the two settings?

    My set up using your code appears to work, but I’ve getting a lot of local noise pick up evident by the number of “IRQ source result not expected” if you put your had anywhere near the PCB;

    20:24:39.295 -> 14CORE | AS3935 Lightning Sensor Test Code
    20:24:39.295 -> Initializing……………………
    20:24:42.295 -> Starting SPI……………………
    20:24:44.264 -> set up for indoor operation
    20:24:44.264 -> disturber detection enabled
    20:24:44.779 -> capacitance set to 8×13
    20:24:44.779 -> AS3935 manual cal complete
    20:24:51.998 -> DISTURBANCE DETECTED >
    20:24:52.185 -> IRQ source result not expected
    20:24:52.232 -> IRQ source result not expected
    20:24:52.232 -> IRQ source result not expected
    20:24:52.232 -> IRQ source result not expected
    20:24:52.279 -> IRQ source result not expected
    20:24:52.279 -> IRQ source result not expected
    20:24:52.326 -> IRQ source result not expected
    20:24:52.326 -> IRQ source result not expected
    20:24:52.326 -> IRQ source result not expected
    20:24:52.373 -> IRQ source result not expected
    20:24:52.373 -> IRQ source result not expected

    Thanks,
    K.

    Reply
    • at
      Permalink

      Franklin AS3935 has embedded lightning algorithm to checks the incoming signal pattern to reject the potential man-made.
      disturbers. #define AS3935_DIST_DIS 0 //Set disturbers (AS3935_DIST_EN:1 / AS3935_DIST_DIS:2) #define AS3935_DIST_EN 1 //Set disturbers (AS3935_DIST_EN:1 / AS3935_DIST_DIS:2),

      Reply
  • at
    Permalink

    Using an Arduino mega and this chip on a board with all the ancillary hardware included.

    Simple enough, but I see nothing.

    Starting with the address finder/scanner that sees nothing – returns “nothing found” every time.

    I notice that in the i2c code above you refer to SI_PIN – but in the circuit diagram you are not connecting SI at all. Is that correct?

    Any help would be appreciated of course!

    Reply
  • at
    Permalink

    Further to my last note: so it’s wired right; the libraries are present, but the code just returns zeros:

    14CPRE | AS3935 Lightning Sensor Test
    Starting……………….
    wrt: 0 Act: 0
    wrt: 20 Act: 0
    wrt: 0 Act: 0
    wrt: 1C Act: 0
    Configured used for outdoor operation
    wrt: 0 Act: 0
    disturber detection enabled
    wrt: 0 Act: 0
    wrt: 9 Act: 0
    capacitance set to 8×0
    AS3935 manual cal complete
    Reg 0x00: 0
    Reg 0x01: 0
    Reg 0x02: 0
    Reg 0x03: 0
    Reg 0x04: 0
    Reg 0x05: 0
    Reg 0x06: 0
    Reg 0x07: 0
    Reg 0x08: 0
    0

    Reply

Leave a Reply

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