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:
- MISO (Master Input Slave Output) which is to breakout boards output used to send data related to detected lightnings to Arduino;
- MOSI (Master Output Slave Input) which is the data output of Arduino used to communicate setting message or confirmation message to the breakout board;
- CS (Chip Select) which is the line of Arduino enabling the breakout board to interact on the SPI bus; CS is useful because several devices can use the SPI and in order to avoid data collegians we need every communication session to enable just one device per time.
- SCL (clock) corresponding to the signal synchronizing bus communication.
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 SPI mode if being at 9 is at logic zero;
- in I²C mode if Select Interface is at VDD.
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...Read more »