I make a Raspberry Pi powered alarm clock for alerting about auroras.
(or northern lights) are amazing – a beautiful display of ionization of the disturbed . Auroras often happen in the dark of the night and their occurrence is random. The best predictions usually only provide an hour’s notice. To make sure I can get to see the latest Canadian auroras, I made a Raspberry Pi Aurora Alarm.
There is a simple way of determining if there is an Aurora in Canada, you just go to . There you will see a graph like this:
From that graph you can see that the Aurora on September 1st, 2017 did not occur until about 11pm. And, even though I was asleep at the time, I was awaken to see the aurora!
My setup is very simple. I have a Raspberry Pi that probes the Aurora with a simple Python function:
import requests from bs4 import BeautifulSoup def percent_aurora_right_now(): r = requests.get('http://www.aurorawatch.ca/') soup = BeautifulSoup(r.text, 'html.parser') percent_aurora = 0 for span in soup.find_all('span'): if '%' == span.text[-1]: try: percent_aurora = float(span.text.replace('%', '')) except: pass return percent_aurora
and then I have a
for-loop that periodically checks if an Aurora has occurred:
import time while True: if percent_aurora_right_now() > 70: alarm() time.sleep(60)
alarm() function may have to be changed for yourself. You can do whatever alarm is best – push notifications, ringing buzzers, etc. Since I am a heavy sleeper, sound usually doesn’t wake me up so I made a light alarm. That is, my lights will periodically flash when the Aurora occurs:
I have two PIR sensors at the side of my bed so I can also turn on/off the lights manually. For light automation I’m using .
Here’s another picture from the last aurora I saw:
Here’s my full code: