Lightning Sensor Arduino Shield

How cool would it be to have a sensor that warns you of lightning strikes within a 40km radius?  Maybe you need to be alerted to unplug an antenna or sensitive electrical equipment.  Maybe you want to know when to bring the kids/pets inside.  The possibilities are really endless.  My goal was to connect it to my arduino powered weather station, and that is what I did.

Parts Needed:


The pinout mappings depend on what arduino board you are using and if you are using I2C or SPI.  You should match the pins accordingly to your board’s specs.

MOD-1016Uno R3Leonardo
IRQ2 or 33, 2, 0, 1, or 7

Wire-up the sensor module to the proto shield and solder it all together.  You can do the wiring however you want but I ran the wires on the bottom.  Then solder the headers onto the proto shield.  It should look something like this:



I’m utilizing the AS3935 arduino library HERE written by raivisr.  Keep in mind that technically this library was written for a different AS3935 breakout board, but since it’s the same chip it should be fine.  Also, they are using a Mega so their documentation has different pinouts.  Use the example included with the library to get started.  You will need to change the following bits of code to get it to work:


AS3935 AS3935(SPItransfer,SS,2);


int PIN_IRQ = 2;  // Your IRQ pin, mine is 2
int PIN_CS  = 10; // Your sensor's CS pin, mine is 10
AS3935 AS3935(SPItransfer,PIN_CS,PIN_IRQ);

The attachInterrupt() function requires the interrupt ID for the pin you are using.  This table identifies the interrupt value and the associated Arduino pins:

Uno R3, Ethernet23----





int myIRQ = 0 // You need to change this to your IRQ

Comment out the calibration function and add our custom tune function instead:

// Serial.println("Tuning out of range, check your wiring, ...");

AS3935.tune(4);  // The number I used here (4) came on the packaging

Add the following function to the AS3935.cpp library file:

void AS3935::tune(int tuneValue)

And add the following to the “public” class in the AS3935.h library file:

void tune(int tuneValue);


It’s time to begin testing the serial output from the sensor.  Open your serial console window in the arduino IDE and see what’s going on.  You should see this:


Extending Use:

Some other ideas for how to extend the use of this shield…

  • Hook it in to your personal weather station
  • Connect an LCD screen or LED matrix
  • Send a tweet



My Tips for Sparkfun’s Wireless Weather Station

If you haven’t seen it already, check out Sparkfun’s guide on how to build your own weather station that reports statistics to Weather Underground ( here:

In this and my next few posts I will show how I built my station along with some extra tips and tricks that are not included in Sparkfun’s tutorial.  I will also be adding posts in the near future to expand the capability of the weather station with additional sensors.

Tip #1: It’s either the red enclosure OR the radiation shield, not both!

The full red enclosure will NOT fit inside the Ambient Weather solar radiation shield.  I would not recommend building a weather station without the solar shield because you WILL have incorrect temperature readings.  I was, however, able to utilize the cover of the red enclosure to house the components safely inside of the solar shield using some of the upcoming tips!

Tip #2: Install the male headers onto the weather sensor shield backwards

This will allow you to put the sensors outside of your enclosure to get the most accurate readings.  The photo below shows the top of the Sparkfun weather shield prior to soldering in the male headers.  I’ve used a spare proto shield on the bottom to temporarily hold everything in place while I solder.



Tip #3: Cut a hole into the red enclosure lid so the male headers of the weather sheild can attach to the rest of the components inside

Use the Sparkfun weather shield as a stencil to mark out the areas on the enclosure to remove.



Then take your time and remove the plastic so the headers and the nubs of the RJ-11 jacks fit through.  This will allow your weather shield to sit flush up against the enclosure.  Notice that I did not take my time so it looks a bit sloppy.  Use hot glue to hold it in place and create a nice seal to prevent moisture from entering the enclosure.


Tip #4: Mount a right-angle female JST to the Wireless IMP shield

This step is not specifically mentioned in the Sparkfun tutorial, however it is shown in their photos.  I made the mistake of connecting the load output of the Solar Buddy MPPT shield to the barrel jack of the Arduino because it wasn’t specifically mentioned not to.  The barrel jack expects at least 4.something volts, which the 3.7 volt LiPo battery will only produce when there is over 85% battery capacity.  Once it gets below this threshold, your wireless IMP and weather sensors will not receive enough power.  So, instead solder the right-angle female JST connector to the wireless IMP shield as shown.


Tip #5: Make blink programming easier with components mounted in the enclosure lid

As you can see, the wireless IMP sits almost flush with the edge of the enclosure, so to reprogram wireless settings you would need to remove it.  This causes unnecessary wear and tear on the components and is kind of a pain in the butt.  Instead, drill a hole directly above the center of the wireless IMP’s photo sensor, and then insert a small piece of the plastic light tube.  This allows you to re-blink the IMP from outside the case.  Note that in my photo, the hole is not directly centered.  You can ignore that.



Tip #6:  Use a 2.5mm screw terminal instead of soldering wires directly to the Sunny Buddy’s load

This step makes it easy if you need to temporarily disconnect or rewire something for testing.


Tip #7:  Use a voltage step-up module

This tip builds on Tip #4.  The 3.7 volt LiPo battery supplied will output about 4.2 volts when fully charged but as time goes on, if it’s not being recharged by the solar panel, the voltage will drop.  Once it gets below about 3.26 volts, there is not enough power to run the weather station.  I found a 5v step-up module (MOD-1017-5V) from Embedded Adventures that can take anything from 0.9v and bump it up to 5v at 1 Amp.  Simply wire the module between the Sunny Buddy load output (module’s input) and the JST connector (module’s output) on the IMP shield and you are good to go.  Or, if you are feeling ambitious, you can solder the step-up module right to the IMP shield.  If you do that you’ll also have to cut some of the traces on the back of the shield.


Tip #8:  Add a lightning sensor!

See my post on creating a Lightning Sensor Arduino Shield for instructions on how to build the shield.  Adding this shield does introduce some complexities to your weather station, so I would only recommend doing it if you are experienced with re-coding the base application.  I will be putting together full instructions on how to incorporate this shield into the weather station soon.


Thanks for viewing!  Check back later for more tips and build progress!

Achievement Unlocked: JNCIA Certification

After having a few Cisco certifications under my belt, I felt it would be wise to start diversifying my skills. When I received a free exam voucher it pushed me to go for it. As far as exam content goes, 65 multiple choice questions with a few multiple choice/multiple answer questions was it. No simulations or interactive questions. I passed with minimal studying. If you do not have your JNCIA certification and you are thinking of going for it, I would recommend taking a shot at it. As long as you have some basic networking skills, can do some binary math, and have used JunOS, you will probably pass. One downside is that it is only valid for 2 years, instead of 3 like Cisco.


Florence Sightseeing

I was lucky enough to have the opportunity to go to Florence for a business trip.  During my time here I have had some of the best food ever.  More pictures and updates will be posted when I get back, but for now here are a few shots of the city.

IMGP6400 (2)IMGP6378 (2)IMGP6361 (2)

Moving to N Scale

After starting out with HO scale, I began to realize how much space it occupied.  August’s issue of “Model Railroader Magazine” had an article on space saving.  Then I discovered that with N scale, I could fit a complete oval of track on a 2′ x 4′ board, rather than 4′ x 8′.  Since space is a premium in our house (I have too much stuff) we made the executive decision to switch to N scale even though I had already made a small investment in HO scale.  All of the HO paraphernalia has been packed up and stored in the basement.  Here is a picture of my first N scale building, and to give you a sense of scale, that is a quarter next to it: