ESP8266 Solar Flare Monitor

Introduction: ESP8266 Solar Flare Monitor

You know what's cool? Space weather! What if you had a small box on your desk that told you when a solar flare was occurring? Well, you can! With an ESP8266, IIC 7 Segment Display, and some time, you can have your very own.

Step 1: Hardware: What You'll Need

************************** NOTE ABOUT ELECTROSTATIC DISCHARGE **************************

Right after I finished the first version of my code, I jumped onto the couch with it, and my LED display stopped working. If this happens to you, re-flash the firmware to the processor to fix it, but just be careful with your display! Also, keep your wires a little shorter than mine, I'd say about 6 inches max. I had a lot of interference with my display. I had to do this TWICE! IN THE END I BROKE MY DISPLAY! I had to switch to a white one during construction of the case!!!


Here the hardware you will need,

  • ESP8266 Module
  • Normally Open Button
  • Serial 7-Seg Display

And the tools,

  • Soldering Iron
  • Wire Strippers
  • 3D Printer (Optional)

Step 2: Hardware Assembly

First, connect the 7-Segment display. It's pretty self explanatory, Vcc to 3v3, GND to GND, SDA to SDA, SCL to SCL.


+ --------------------------- 3v3

- --------------------------- GND

SDA --------------------------- SDA (4)

SCL --------------------------- SCL (5)

Pretty simple. Then, the button. Connect one pole to GND and the other to pin 2.

PIN 1 --------------------------- GND

PIN 2 --------------------------- GPIO 2

And that's it! Not too bad, eh?

Step 3: The Code: Theory

Okay, so if you don't care about why I did what I did, skip this step. Otherwise, here it is. Space is really far away. At first I wanted to measure solar flares on my own with my own magnetometer, but that would be pretty hard. There is much more accurate equipment in space already, so let's take advantage of it. I spent a day looking at magnetometers on Sparkfun and Adafruit until I came to this conclusion. I spent two more days finding data sources. I finally found a nice JSON file from NOAA. (This is nice, I live in CO) I then used ThingSpeak API to get the small amount of data I needed. Then, we grab the data from Thingspeak and display it on a 7 Segment display. So lets get on to the code!

Step 4: The Code: Libraries

There are four libraries you need, all of which are fairly simple to obtain. The first two are built into the arduino IDE, but if you don't have them, they're called Wire.h and Arduino.h. The other three are installed automatically with the ESP8266 board usually, but they're called ESP8266WiFi.h, ESP8266WiFiMulti.h, and ESP8266HTTPClient.h. Make sure you have those installed in the IDE, and continue to the next step.

Step 5: The Code: the Code

So, the moment we have been waiting for. The code. This is a work in progress so I will be updating the code. I'll keep original versions, and add another section to this step for each new up date. The downloads are through google drive. (No account needed)

****************Original Version**************** (4/18/2018)

Code 4/18/2018


*************************Version 1.2**************** (4/22/2018)

Code 4/22/2018


Step 6: The Case!

So now that you have a cool new solar monitor, lets put it in a nice box. I 3d printed my case, although you could make a case yourself if you want. Here are the designs.


Now it’s simple. Put the button in the button hole, the display in the display hole and glue the esp8266 to the back wall. Now feed your usb cable through the side hole to the esp8266.

Step 7: Finished!

Here's how it works. The display turns off after 30 seconds. The button turns the display on and switches between the two modes described below. Here are the messages and their meanings.

Y FI -- Connecting

FlAr -- Most recent solar flare (Max class)

Curr -- Current class

Class display example: A5.2

If a class is M, the prefixing letter ("A" in "A5.2") will show up as N.

If a class is X, the prefixing letter ("A" in "A5.2") will show up as H.

Here are the classes.

A -- Smallest class. (1-9) No local effects.

B -- Ten times A. (1-9) No local effects.

C -- Ten times B. (1-9) No local effects.

M -- Ten times C. (1-9) Can effect satellites. Poses a small threat to astronauts. Earth is unaffected.

X -- Ten times M and up. (1-∞) Can knock out communication systems, power grids, satellites, etc. Mainly large electronic devices.

The largest class ever recorded was in 2003. The sensors were overloaded and cut off at X28.

The scale is the same for both FlAr and Curr modes.

Want more info on the scale? Click here.

Step 8: Applications

Let's say you have some sensitive electronics that cost thousands of dollars. You could have this device shut off you equipment if a flare reaches a certain class, to minimize damage.



    • Metalworking Contest

      Metalworking Contest
    • Tiny Home Contest

      Tiny Home Contest
    • Creative Misuse Contest

      Creative Misuse Contest

    10 Discussions


    3 months ago

    nice project, especially for those involved with long distance radio. However, I must point out the Stereo-A spacecraft was struck with a Carrington class flare in 2012.

    1 reply

    3 months ago

    So, are there any other monthly costs beyond an internet connection ?

    I know nothing of the api ?

    2 replies

    All in all, internet is the only thing.

    ThingSpeak API is a free service. All you would need to do to create your own is register an account. But, if you just want to continue using the API I created with ThingSpeak, you don’t have to worry about any of that.


    3 months ago

    cool idea, I imagine this would help determine if there is a chance of seeing northern lights too. could you say more about the looks like it comes from

    1 reply

    I don’t know why the picture doesn’t show up correctly...