Spectrographic Auroral Indicator - a Northern Lights Warning Device




About: Father of two active toddlers desperately trying to find the time to build every interesting project from Instructables. Slowly training the kids to love building things. The wife? She thinks we are all craz...

3/16/2011 EDIT: The Wing Kp Predicted Geomagnetic Activity Index model is now deployed and operational. Costello is now considered non-operational and will be discontinued on 23 Mar 2011. Comments and questions are welcomed at SWPC.CustomerSupport@noaa.gov

The Wing Kp Predicted Geomagnetic Activity Index model is known to perform well for large geomagnetic storms and includes both a 1 hour and a 4 hour advance prediction of activity. Wing Kp 7-day model output is available in ascii data list format at http://www.swpc.noaa.gov/wingkp/wingkp_list.txt and via Anonymous FTP at ftp://ftp.swpc.noaa.gov/pub/lists/wingkp


Build a visual indicator of the Northern Lights using the Arduino. Know when to go outside and look up, no matter where you live!

For years I have struggled to find a good way of alerting me to Northern Lights activity. I have tried email alerts and real-time monitoring software. Nothing worked well and I would regularly miss good displays.

Enter the Costello Geomagnetic Activity Index. Simply put, this is a prediction of auroral activity. It is pretty reliable and gives about an hour's notice of northern lights activity. The problem is, of course, you have to keep checking the web page to catch any jump in the Index.

What we will build is a visual representation (an LED display) of the current level of auroral activity. The build consists of three main parts: a PHP Web scraping script, a Processing script, and an Arduino script. The LED lights green for low activity, blue for moderate, red for high activity and white for GET OUTSIDE NOW! I have mounted this in an old clock face so it is always visible in my living room. Essentially this is a poor man's Ambient Orb costing under $40 to build compared to the Ambient Orb's $150 + S/H + $6.95/mo for custom monitoring.

Right off the bat I wish to thank Tod E. Kurt for his Spooky Arduino projects and his help getting me through my own stupidity. It is his scripts this project is based on and I strongly recommend checking out his blog for great Arduino projects.

Step 1: The PHP Script

This is my first project using the Arduino outside of the usual "hello world" scripts. I've had to learn the Arduino software, the Processing software, Apache configuration and a bit of PHP to pull this off. There are most likely more elegant ways of doing this, but it works.

The first of the scripts is the PHP Web scraper. The Costello Index is calculated and fed to a FTP server text file(there is http output as well, but the FTP info is more recent.) We need to pull only the most recent Predicted Index from the text file. The PHP script parses out the needed information, converts the Index number into a hexadecimal representation of color in the form #RRGGBB and then writes that to a text file to your server.

Step 2: Set Up the Server - the Easy Way

Unless you have a web host with PHP enabled, follow this awesome Instructable to set up an Apache server in just a few minutes.

How to install a web development environment on localhost

I tried several free web hosting sites that were supposed to be PHP enabled. I never did find one that fit my needs and most were just exercises in frustration. This Instructables showed me how to install Apache, MySQL, and PHP in just a few minutes. This turned out to be far easier than I had expected.

Place your PHP script in the appropriate folder. You will need to forward the appropriate ports if you use a router. If you have a dynamic IP address check out DynDNS to easily keep your server reachable.

Step 3: Processing

Processing language bridges the gap between the Web and the Arduino. This script must be modified to match your setup.

Processing first calls the web scraping PHP script which then updates the hex color text file. Processing grabs the text file and spits the color value to the serial port where the Arduino is listening. This is repeated every 15 minutes.

First, after plugging in your Arduino, find out which port your system assigned to it. In Windows, this is found in Control Panel/ System/ Hardware/ Device Manager/ Ports. Mine was COM13. Change the portstr command on line 7 of the Processing script to match that port.

Next, Set the urlstr variable in the 9th line to the URL of the text file output by the PHP script. Then set the urlstr2 variable in the following line to the URL of your PHP script.

Step 4: Arduino Script

The Arduino is the hardware heart of the project. The Arduino script is the unmodified serial_rgb_led_too script from Tod Kurt's Spooky Arduino. The script is loaded on the Arduino and needs no further attention.

Wire up your LEDs to pins 9,10, and 11 of the Arduino and the Ground pin using resistors appropriate for your LEDs. I recommend breadboarding first to make sure you have everything going to the correct pins and resistor values are correct. I used a single RGB LED from SparkFun.

Check your wiring by starting the Arduino software and opening the serial monitor. Enter #FF0000 and Red should light up, #00FF00 and green should become active, #0000FF and Blue lights. You can now set your PHP script to mix these colors in any way desired.

Step 5: Putting It All Together and Suggested Modifications

Once everything is set in place you will simply need to plug the Arduino into a USB port and start the Processing script. Updates are handled every 15 minutes automatically.

I used the Arduino Diecimila because I'm just getting started. If you are going to build this I would recommend an Arduino varient such as the Adafruit USB Boarduino. This will save you some cash over the standard Arduino board.

Adding more monitors - The Arduino has plenty more I/O pins available. Have it ring a bell or show you the weather(.pdf warning).

Tweak it for your latitude! Adjust the set point triggers in the PHP script. At my latitude, ~47 degrees North, I can see the Northern Lights if the Kp index is over 5 and it is a dark night. If you live further South you should adjust the triggers to higher numbers.

Make it wireless! Hack a Fonera router and hook it to the Arduino. All you would need then is power.

Step 6: A Final Thank You and a Moment of Silence

Thank you, again, to Tod Kurt for his help during a late night brain blockage.

Thank you, also, to my friend belteshazzar for being a fellow geek and for his words of encouragement.

And, finally, a moment of silence for Mark Haun's Aurora Alarm project. I miss the email alerts.

Participated in the
The Instructables Book Contest



    • Paint Challenge

      Paint Challenge
    • Sensors Contest

      Sensors Contest
    • Barbecue Challenge

      Barbecue Challenge

    18 Discussions


    7 years ago on Introduction

    Disregard that:

    Apparently they just have a new index for Kp reporting. It's called the Wing Index and is actually updated every 15 minutes as opposed to every 3 hours.



    7 years ago on Introduction

    I'm working on something similar to this project for my first Arduino project on my own. In the process of looking into the way that the OP did this, I found that unfortunately the Costello Index is no longer being maintained or supported by NOAA. The last entry is from March 23, 2011.

    I went ahead and tried to track down some other source for the data, and found a twitter account that gives Kp forecasts. The rss is already done by twitter and is available here:


    el kabong

    8 years ago on Introduction

    This is great! I plan on tackling this as one of my first arduino projects-- hopefully before Christmas. I have two questions right off the bat.

    How high does the index have to be for one to see the northern lights? I know latitude has a lot to do with it, is there a formula?

    Also, it looks like the NOAA is switching to a new prediction model on November 22nd-- besides tweaking the PHP script, do you think that'll affect the project?

    2 replies
    youevolveel kabong

    Reply 8 years ago on Introduction

    I'm in northern Michigan and I cannot see the lights until the index hits a 5 or better. As far as I know, there is no formula. When things get REAL active the lights have been seen in Mexico....

    My suggestion for this project is to explore using Processing to parse the data rather than using the PHP/server setup that I created. I know it is possible, but just haven't been able to return to the project to work out the code.

    I had not heard NOAA was switching models. Can you provide a link?

    el kabongyouevolve

    Reply 8 years ago on Introduction

    Here's the link:

    I don't really code (yet), but I'm just starting to mess around in Processing (which of course, is nice for also messing around with Arduino). I didn't know you could do html scrapers in processing though... It'd be neat to put the whole thing in one sketch!


    9 years ago on Step 6

    Very interesting project! Great work. I love things that tell you about the real world out there.


    11 years ago on Introduction

    not bad for us old people who can't remember anything...nice job...


    Reply 11 years ago on Introduction

    pfft, yeah so we dont have northern lights. ..but weve got AUSTRALIA!!! ouwstrayleuh my son!! BLIIMEY


    Reply 11 years ago on Introduction

    Yep. I'm in Perth. Closest I get is an Aurora Australis... But for that I'd have to go a long way south. Hey very involved and well done presentation. I thank you !


    Reply 11 years ago on Introduction

    There's an Aurora Australis Yahoo group that you can sign up to. As well as sending you alerts via email they also run a phone alert chain.

    The group is here: http://tech.groups.yahoo.com/group/southern-aurora/

    I also collect all the relevant southern stats here: http://efpeters.customer.netspace.net.au/pub/Aurora.html
    (the moon phase graphic seems to be broken - I'll have to look into that).

    Excellent instructable, I may have a go at this. 5 Stars.


    Reply 11 years ago on Introduction

    Aussies get the Southern Lights aka the Aurora Australis. The behavior of this display often mirrors the activity of the Aurora Borealis, but covers less populated areas. However, if the display is strong enough and you know when to go look, you can see them too! Look here for an image of the Southern lights.


    Reply 11 years ago on Introduction

    I did, but, despite my main form of transportation being a bike, I couldn't use the prizes. The other main form of transportation here is horses, and they don't take kindly to bright flashy things going by them.