This past weekend I was at science hack day in Palo Alto. A normal hack day is when a bunch of people get together and try to build something—usually a program, but can be something physical like electronics too—in 24 hours. Science hack day is a 24 hack day for making things for science—whether it be a program to crunch large datasets from particle accelerators, or a robot with a spectrograph attached. This was the second science hack day, the first was in London this summer and was a big success.
Since Palo Alto is way closer to me than London I jumped at the opportunity to participate. I had only one problem, I didn't know what to work on. Luckily the event's organizer and fellow space enthusiast Ariel Waldman had come up with a fantastic idea and was looking for help. Her idea was to make a lamp that would light up whenever a near earth asteroid went by. So I came down to the Bay area with a teensy and a box of electronics and got to work.
We started with a cheap IKEA lamp but I didn't have the right relays to turn the bulb on and off so I decided to take it apart and replace the bulb with LED's. That way I could turn the lights on and off with the microcontroller. I went a step further and used three color LED's. I glued a bunch of LED's to a translucent plastic cup and glued some more cups together to make a lamp shade.
Then I wired each color of the LEDs to a switching transistor to turn them on and off and wired that to the teensy. I got a ton of help soldering from my friend Kate. The actual building of the lamp only took a few hours. I spent a lot of my time talking to all the other interesting people at the hack day.
Case Study for Open and Accessible NASA Data
Once the LED's were wired to the teensy I could now trigger the lamp over USB. Now all I had to do was figure out when an asteroid has passed by the earth. NASA's JPL provides plenty of information about near earth objects including a page with all the past and upcoming passes. In general NASA is committed to open data. They have all kinds of pages like this. The problem is while I can go to the page and look at it, the data isn't 'machine readable'. What would be better is there to be an API that I could hook into that could automatically let a program know what asteroids are passing and when.
Luckly for the lamp, someone has already done this. Sort of. @lowflyingrocks is a twitter account that has been set up by Tom Taylor to scrape the data off the JPL site and update @lowflyingrocks every time there is a pass. Twitter, unlike random JPL webpages, does have an API. So I wrote a python script to read the @lowflyingrocks stream and send a signal to the teensy to flash the lights.