SparkFun Lightning Detector - AS3935

The SparkFun Lightning Detector adds lightning detection to your next weather station to make sure you are aware of any potential hazardous weather heading your way. The AS3935 is capable of detecting lightning up to 40km away with an accuracy of 1km to the storm front with a sensitive antenna tuned to pick up lightning events in the 500kHz band.

There are a number of sources that can cause false positives but the lightning detector itself can reliably filter these out by default. If not, we've made sure to include settings you can configure using the lightning detector library to increase the chip's robustness to noise and false positives. The lightning detector library also gives you access to settings such as storm sensing sensitivity when detecting indoors vs outdoors, or the number of lightning strikes needed to trigger an interrupt.

  • Lightning Sensing
    • 40km Range with accuracy of 1km in 14 steps
  • Features
    • Programmable Detection Levels
    • Distance to storm estimation
    • "Disturber" (false event) rejection algorithm
    • Indoor and Outdoor Settings
    • SPI Interface
  • Operating Range
    • Supply Voltage: 2.4V - 5.5V

SparkFun Lightning Detector - AS3935 Product Help and Resources

New!

SparkFun AS3935 Lightning Detector Hookup Guide (v20)

July 25, 2019

Are you worried about the looming clouds in the distance, how far away is that storm exactly? Add lightning detection with the AS3935 to your next weather station or your next bike ride!

Core Skill: Soldering

This skill defines how difficult the soldering is on a particular product. It might be a couple simple solder joints, or require special reflow tools.

1 Soldering

Skill Level: Noob - Some basic soldering is required, but it is limited to a just a few pins, basic through-hole soldering, and couple (if any) polarized components. A basic soldering iron is all you should need.
See all skill levels


Core Skill: Programming

If a board needs code or communicates somehow, you're going to need to know how to program or interface with it. The programming skill is all about communication and code.

2 Programming

Skill Level: Rookie - You will need a better fundamental understand of what code is, and how it works. You will be using beginner-level software and development tools like Arduino. You will be dealing directly with code, but numerous examples and libraries are available. Sensors or shields will communicate with serial or TTL.
See all skill levels


Core Skill: Electrical Prototyping

If it requires power, you need to know how much, what all the pins do, and how to hook it up. You may need to reference datasheets, schematics, and know the ins and outs of electronics.

2 Electrical Prototyping

Skill Level: Rookie - You may be required to know a bit more about the component, such as orientation, or how to hook it up, in addition to power requirements. You will need to understand polarized components.
See all skill levels


Comments

Looking for answers to technical questions?

We welcome your comments and suggestions below. However, if you are looking for solutions to technical questions please see our Technical Assistance page.

  • Is anyone else having issues seeing images in the tutorial?

    • Thanks for saying something! We had some issues with our servers and lost a few images but it wasn't clear which ones were lost. I'll get those updated as soon as possible.

  • I just received two of these units and got them running. I checked the antenna tuning and they seem to be running right at 500 kHz. We just had a lightning storm roll over our place but all I got were disturbers with over 100 incidents.
    I trying the example code with this heading: By: Elias Santistevan SparkFun Electronics Date: July, 2019 License: This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license). Example 2 These are the settings that come up when I boot: 18:16:34.781 -> AS3935 Franklin Lightning Detector 18:16:34.781 -> Schmow-ZoW, Lightning Detector Ready! 18:16:34.781 -> 18:16:34.781 -> Are disturbers being masked: YES 18:16:34.781 -> Are we set for indoor or outdoor: Indoor. 18:16:34.781 -> Noise Level is set at: 2 18:16:34.781 -> Watchdog Threshold is set to: 2 18:16:34.781 -> Spike Rejection is set to: 2 18:16:34.816 -> The number of strikes before interrupt is triggerd: 1 18:16:35.125 -> Disturber.

    • That is odd. This is a question better suited to our forums: forums.sparkfun.com. However, I do have a suggestion: try changing your setting to OUTDOOR to see if you have better results. Clearly it's detecting lightning but is not registering it as lightning which leads me to suspect that the INDOOR setting may be too robust in your case.

  • I purchased a very similar breakout board from a different vendors years ago. I am trying to protect a fairly significant investment in computer gear by power it all down and disconnecting from power when a storm comes by. I found this chip (not the break out board implementation) to be much less than satisfactory. First if the detector is keep inside, every time some motor kicks on in the house (AC units, furnace blower, dishwasher, disposal, ...) I would get a false alarm. If I reduced the sensitivity (via registers) then I would miss storms. I never did try this outdoors away from the house because of the difficulty in getting power to it.

    The second problem is again with the chip (not the breakout board). They provide an "interrupt" pin to tell you of events. The problem is that when the interrupt pin is asserted, the interrupt service register (tells you why you got the interrupt) can't be read right away. You have to wait an ungodly amount of time before it becomes valid. If memory served me right something like a few milliseconds. Makes having an interrupt pin pretty idiotic. When the interrupt happens, you need to kick off a timer in you interrupt service routine. When that timer expires, then you can read the service register. Why you could not have held off the interrupt till the register was valid is beyond me. It is a huge bone headed error.

    After several months of screwing around with the chip, it went into the junk drawer and I built a much more reliable detector from an old AM radio.

    Again, I am sure the Sparkfun board is just fine (although I have not purchased one). It is the chip itself that has the issues.

    • The datasheet gives a nice tip about a way of reducing false triggers: "In consumer weather stations power can be saved and false triggers avoided by powering down the AS3935 based on humidity and pressure information." - Page 36 of v1.04 datasheet.

      About the interrupt routine: it's documented in the datasheet that a wait of 2 ms is required before reading the relevant part of the register. "Whenever events happen, the AS3935 pulls the IRQ high and displays the interrupt in the REG0x03[3:0]. Figure 44 shows the interrupt register. After the signal IRQ goes high the external unit should wait 2ms before reading the interrupt register. The interrupt bus IRQ is set back to low whenever the interrupt register is read out." - Page 34 of v1.04 datasheet.

      • I did not mean to indicate that chip did not document the issue with the delay. Even the datasheet from 5 years ago had this documented. What I found aggrevating was having to wait the 2ms before getting to read the in service register. Of all the chips I have used in 25 years of electronic design, this is the first time I have seen an interrupt pin requires a delay before reading the ISR. In my opinion it is a terrible design. Yes, you can work around it.Just make sure you do not wait the 2ms in the interrupt service routine. You need to set a flag or a timer in the ISR and check it in the main loop. This "feature" made it tough to use in a very limited resource micro like an MSP430.

        I am glad to hear the Sparkfun's library accounts for this issue.

        Interesting that they recommend gating the events with other sensors. That I think must be new in the datasheet. I did not see that in the original version.

      • That is correct! The Arduino Library that we've written for this already accounts for this delay and is included in the "readInterrupt" function. There's no need to add your own 2ms delay. This is just an FYI for anyone using the library.

    • Thanks for the heads up, I'll let our TS team know about this quirk in case any other customers run into this issue.

  • This is awesome... I was going to build something like this using analog components. I've got a couple of questions: your example shows using it with a SparkFun Arduino clone, but it looks like it would work fine with a genuine Arduino Uno R3. Is that correct? I want it to be directional (for photography). Would it be possible to either shield it to provide directionality, or attach a home-made antenna that would do the same? Thanks!

    • That is correct, our clone is functionally comparable to the Arduino Uno, and so you're Uno would work just fine. Unfortunately, you could not get directionality with a single lightning detector. To your first question, a shield would only hinder the ability of the Lightning Detector to detect lightning. As to your second question, the antenna on the Lightning Detector and its' passive components were chosen so that they resonate at a specific frequency: 500kHz. In addition the components give the antenna a specific "Q-factor" or quality factor. This is also vital to its' ability to detect lightning. I have wondered if it would be possible to get direction with triangulation but I'm not familiar enough with the specifics of triangulation. Sorry about that, hopefully you can still find a way to integrate it into a project!

  • Can this be used to trigger a camera to take a photo of the lightning?

    • It does have a trigger (an "interrupt") to do such a thing, however my gut is telling me "no". The time for the signal from the lightning has to travel to the Lightning Detector's antenna, then the Lightning Detector has to determine if it sensed lightning (which takes 2 milliseconds), and then the camera has to be alerted and then take a picture. All of that BEFORE the lightning strike disappears.

      • It could be tricky with the timing for a photo but you could possibly use a Raspberry Pi with a USB webcam. There was a project that I recently saw that "films the past" using a Pi and a USB camera. Basically the camera is constantly on and saves the last 7 seconds of video when the button is pressed. I would think the resolution and focus for the photo would be pretty bad when using a USB webcam as opposed to a DSLR though.

      • I'm sure there are similar projects, but check out the CameraAxe Arduino based camera controller. If I buy one of these my plan is to interface it with an older CameraAxe that I built. They provide a lightning sensor, but it's just a light sensor that detects the preliminary flash and fires the camera to capture subsequent flashes. I've wanted to experiment with something like this because I think the static RF interference precedes the initial flash and could trigger the camera. After that it would be a matter of determining the length of exposure to capture the entire event. Keep in mind, this is speculation on my part as I haven't tested the build yet.

Customer Reviews

No reviews yet.