In order to make the atmospheric discharges sensor more easily usable, i have made a breakout board containing the AS3935 integrated supply. The heart is clearly the IC, and i bring its power, the communication bus with external microcontroller circuits and the major control signals, to the outside. All the lines to connect externally or to be handled externally are brought to a line of pads with 2.54 mm gap on one side, to which we can apply a pinstrip. Data connection with the external world is serial, using an I²C-Bus or SPI bus; in the last case we will make use of the lines:

Note that pin 8 of the AS3935, i.e. the CS is kept at logic level high from its internal pull-up resistor if not specified otherwise, but it can be forced to logic zero by the JCS jumper where external management is not needed. For what concerns serial communication mode, this can be selected on the breakout board using the second jumper, labeled SI, intervening on pin 9 (Select Interface); the integrated AS3935 integrated works:

In my application i chose the first option, so you can see the jumper has been closed. 

I have pin IRQ (10), brought to terminal 3 of the CN1 connector, which communicates the microcontroller when IRQ is an output that AS3935 Brinks logic level high when a lightning is detected and the corresponding value is written in one of the internal registers (REG0x03[3:0]).

The input stage, which is the stage that allows me to detect the radioelectric disturbance corresponding to the lightning; this is related to pins 2 and 3, which are the radio-receiver input of the integrated circuit, which requires an anti-resonant circuit to the input in order to tune a certain bandwidth and exclude low-frequency disturbances which are not relevant to the purpose.


The project i am proposing is essentially made of three elements: lightning detector, available on the breakup board, an Arduino Uno board, which duty is to analyze the signal provided by the sensor, process it and show on serial LCD display (which is the third element of the circuit) the information extracted, i.e. the number of electric discharges detected that can be considered “spawn” of lightning along with estimated distance.

Everything must be connected as we can see in the wiring diagram visible in these pages, where the sensor breakout board interfaces with Arduino through the ISCP connector, since the latter carries the complete, 4-line SPI bus.

In order to manage the serial display, we use a software serial, emulated thanks to the SoftwareSerial.h library, which allows you to free the hardware serial for possible applications that need it. The sensor breakout board is connected, as mentioned, through an SPI bus, from which it receives all the settings and communicates data regarding lightning detection; the onboard chip is enough on itself to measure intensity and detect the course of the electrical discharges detected by the coil mounted on the breakout board, therefore the data provided to not require any special processing by Arduino.

The connection with the breakout board takes advantage of the SPI bus lines reported on the ICSP connector; then we have GND (ground) and Vcc (connected to +5V) used by the board to take power from Arduino.

CS (active at logic level 0) is handled by Arduino’s digital I/O 3, set from the sketch as output and the IRQ of the breakup board is instead interfaced with the digital I/O 2, initialized as input, since, to be specific, IRQ notifies Arduino of a possible microcontroller interfacing with the IC circuit or its breakup board capable of reading the content of the registry.

When IRQ goes back to logic zero there is a pause of at least 2 ms before the registry is read again.

For what concerns the serial LCD display, this is connected to Arduino through 5V and GND terminals for power and digital I/O 5, set as output, serially sending data to the RX terminal on the LCD. Normally, the storm notification is displayed along with the number of detections in less than 60 seconds. If within 60 seconds, there are no other detections, then the notification “No lightning detected” is displayed.

If in the integrated circuit’s registry, detection distance is available, then this piece of information is also displayed in the second line, with a message along the lines of: Disturb Det. x

 Where “x” indicates the number of discharges detected. Below, you can see :

 Distance: n km 

Where “n” is the estimated distance where lightning hit the ground. If a distance is lower than the minimum, the display that shows Storm overhead on the first line and WATCH OUT on the second line!