Incoming Storm: A Lightning Detector from ams

By Bryon Moyer

Contributed By Convergence Promotions LLC

“The chances of being struck by lightning” is a phrase used to indicate that something is unlikely. Nonetheless, according to the US National Weather Service¹, an average of 54 fatalities reported in the US each year (1982 to 2010) are due to lightning strikes, and that only ten percent of people struck actually die. History suggests that an individual’s lifetime chance of being affected by someone who was struck by lightning is roughly 1 in 1000.

Many of these deaths and injuries can be avoided. A typical cause is simply being in an unsafe place during a storm. That might mean being caught on Pike’s Peak when the typical afternoon storm hits, or swimming in a serene valley lake and not noticing an incoming storm.

Such situations can be avoided if there is enough warning of an approaching storm. While the rule of thumb involving counting seconds between lightning and thunder gives one a sense of safety, one cannot always see the lightning (especially if it is cloud-to-cloud), and some people simply are not paying attention. By the time one figures it out, for instance, if a class of kids swimming at the lake needs to seek shelter, it might be too late.

Austriamicrosystems (now ams) developed a sensor to make storm prediction more reliable called the Franklin Lightning Sensor, the AS3935. It is a single-chip circuit that detects and provides a distance estimate to the “leading edge” of an incoming storm.

The phrase “leading edge” is a bit misleading, since it suggests that one is in the direct path of the storm. In fact, for the purposes of this sensor, the leading edge is simply the closest edge of the storm, which may never actually arrive if the storm delivers a glancing blow nearby. However, its distance away from you – regardless of where it is heading – is the most relevant information.

The algorithms used to estimate the distance are hard-coded in circuitry; there is no software involved. Various pins and registers can be set to configure different settings, but the fundamental calculations remain opaque to the user. This simplifies the use of the device dramatically. It would typically be connected to a microcontroller or some other external circuit. The AS3935 will generate distance estimates, but it is up to the rest of the system to do something with that information, such as issuing some sort of warning.

Basic operation

The internal algorithms consist of two key fundamental tasks: analyzing an electrical impulse to decide whether it is a lightning strike and, if it is, estimating the storm distance. Note that the distance given is not the distance of an actual detected lightning strike, but the distance to the leading edge of the storm, determined through statistical analysis of the pattern of recent detected strikes. The block diagram for the AS3935 is shown in Figure 1, with the main operational blocks surrounded in red.

ams AS3935 block diagram

Figure 1: AS3935 block diagram, with main functional units indicated by the red boundary. (Courtesy of ams.)

A lightning strike creates an electromagnetic pulse that can be detected using an external antenna (see Figure 2) tuned to 500 kHz, with a bandwidth of 33 kHz. An analog front-end (AFE) demodulates and amplifies the antenna signal, and a watchdog circuit alerts the lightning detector once an event crosses its threshold. However, numerous other electromagnetic events create high-energy events. It is important that such non-lightning “disturbers” not be misinterpreted as lightning – and vice versa.

ams AS3935

Figure 2: External antenna connection for the AS3935. (Courtesy of ams.)

For this reason, the first step in the detection process is to decide whether the event has the characteristics of a lightning strike. If not, it is rejected as being the result of a disturber. If it decides that it is lightning, the energy of the event is calculated and stored, and then the storm distance is calculated based on that and prior events. An interrupt is then raised so that the microcontroller (or other external device) can retrieve the information and take action.

This process gives rise to two of the device’s three operating modes. The first is “listening mode”, which represents the time when the device is on, but no events have been detected. Once an event is detected, the device changes to “signal verification” mode. Once signal verification is complete, the device returns to listening mode.

The modes have an impact on the power consumption of the device. In fact, there is also a third “power-down” mode that can be used to minimize power consumption while taking the device out of active operation. The current consumption for the different modes is shown in Figure 3. (The meaning of VREG will be discussed below.)

Current Consumption
Symbol Parameter Typ Max Units
IPWDROFF Power-down current when VREG is OFF 1 2 μA
IPWDRON Power-down current when VREG is ON 8 15 μA
ILSMROFF Current consumption in listening mode 60 80 μA
ISVM Current Consumption in signal 350   μA

Figure 3: Current consumption for the different operating modes. (Courtesy of ams.)

Communication with a microcontroller

Event notification is managed by issuing interrupts to an external device. The external device then interrogates registers in the AS3935 to get the necessary information. There are three different possible interrupts, all indicated by the same INT pin, but discriminated by the value in register REG0x03[3:0]:

  • One to indicate a lightning strike – INT_L (1000);
  • One to indicate a disturber event – INT_D (0100);
  • One to indicate too much noise – INT_NH (0001) – more on this later.

Note that the external device must wait 2 ms between the time when the IRQ signal goes active and the actual reading of the register value. The disturber interrupt can be masked using the MASK_DIST option (REG0x03[5]=1) if those events are not of interest. Communication can be done with either I²C or SPI, selected by tying the SI pin high for I²C or low for SPI.

In the case of a lightning interrupt, register REG0x07[5:0] will be loaded with a value indicating the estimated distance to the storm. The value will range from 000001, which indicates that the storm is overhead, to 101000, which indicates the maximum distance reliably detectable, that being 40 km. A value of 111111 indicates that the storm is out of range. Intermediate values are available in the device datasheet.

Adjustments and tuning

While the lightning detection algorithm is fixed, adjustments that can be made to optimize the performance of the device for a variety of situations.

By default, the device will be optimized for indoor operation. This means that the AFE gain will be higher. The gain can be lowered for outdoor operation by changing the value of register REG0x00[5:1]; value 10010 is used for indoor operation and value 01110 is used for outdoor operation.

Sensitivity can also be adjusted. Greater sensitivity means that lightning can be detected farther away, but it also increases the chances that a disturber event may be misinterpreted as lightning. There are two ways of tuning the responsiveness of the device.

The first is by adjusting the threshold of the watchdog using register WDTH (REG0x01[3:0]). This determines the level at which the watchdog will trigger validation. The impact on detection efficiency is shown in Figure 4. The graph indicates that suppressing disturber events also reduces the ability to detect distant lightning strikes.

ams watchdog threshold and detection efficiency

Figure 4: The relationship between watchdog threshold and detection efficiency (assumes SREJ=0000). (Courtesy of ams.)

The second adjustment relates to the validation circuit. This circuit works by examining the shape of the detected event. In particular, it is set to reject spurious spikes, but the spike rejection can be tuned using register SREJ (REG0x02[3:0]). This also affects detection efficiency, as shown in Figure 5. By default, the SREJ setting is 0010.

ams spike rejection and detection efficiency

Figure 5: The relationship between spike rejection and detection efficiency (assumes WDTH=0001). (Courtesy of ams.)

The device is also affected by the amount of ambient electrical noise; the noisier the environment, the more difficult it is to discriminate a lightning event. The AS3935 samples the ambient noise to determine an overall noise floor. If the noise level rises to an excessive level, then the INT_NH interrupt is issued and maintained until the noise abates. Lightning detection pauses when the noise is too high, and resumes when the noise drops back to acceptable levels.

The threshold at which operation is suspended due to noise can be adjusted by setting values in register REG0x01[6:4]. The default value is 010, corresponding to 860 µV (rms) outdoors or 62 µV (rms) indoors.

Another way of ignoring disturber events that are mistaken as lightning is to require a certain number of events within a 17-minute interval before the device will raise an interrupt. Using register REG0x02[5:4], the minimum number of events can be set to 1, 5, 9, or 16.

Power regulation

The AS3935 has an internal power regulator that can be used, if desired. This selection is made using the EN_VREG pin, tying it high to enable the internal regulator, and tying it low to disable it. When used, raw power is applied to the VDD pin, and the regulated value appears on the VREG pin, where an additional bypass capacitor is required. If the internal regulator is not used, then VREG is connected to VDD, and the extra capacitor is not needed. The two configurations are shown in Figure 6.

ams a) indicates no internal voltage regulation and b) shows internal regulation enabled

Figure 6: Configuring the internal voltage regulator; a) indicates no internal voltage regulation and b) shows internal regulation enabled. (Courtesy of ams.)

The internal regulator does add nominally to the power consumption; this is indicated by the VREG settings in Figure 3.

Evaluation board and lightning emulator

ams has made available an evaluation board that includes an early warning alarm and an LED display that provides information on detected events (see Figure 7).

ams AS3935-DK evaluation board

Figure 7: AS3935-DK evaluation board. (Courtesy of ams.)

Accompanying the evaluation board is a handheld lightning emulator (see Figure 8) that can be used to test and tune the detector on the evaluation board.

ams Lightning emulator

Figure 8: Lightning emulator for use with the AS3935 evaluation board. (Courtesy of ams.)

Both boards are battery-powered; the evaluation board can be connected to a computer via USB cable. Software accompanies the boards for adjusting the settings on the AS3935; the GUI is shown in Figure 9. Many of the settings described previously can be seen in this particular view.

ams AS3935 evaluation board GUI

Figure 9: AS3935 evaluation board GUI. (Courtesy of ams.)


The Franklin Lightning Sensor (AS3935) completely encapsulates the process of detecting lightning strikes from as far away as 40 km, whether cloud-to-cloud or cloud-to-ground. The AS3935 can be integrated into a wide variety of systems, from weather monitoring stations to safety monitors where children are playing or swimming. By detecting incoming storms through a patented algorithm, implemented in silicon, lightning detection becomes as simple as responding to a processor interrupt.



Disclaimer: The opinions, beliefs, and viewpoints expressed by the various authors and/or forum participants on this website do not necessarily reflect the opinions, beliefs, and viewpoints of Digi-Key Electronics or official policies of Digi-Key Electronics.

About this author

Bryon Moyer

About this publisher

Convergence Promotions LLC