Living Dangerously: Earthquake Data

The other day, as a way of avoiding work that I really should be doing, I made a few basic but necessary improvements to my earthquake RSS feed reading code. I haven’t touched it for ages, but sometimes it’s good to come back to these things after a little while away.
First I tweaked it so that the programme only displays the earthquake data and writes it to the serial port (for arduino) when there is new activity – before it was sending the data every time it checked, which is not helpful. So now we only get new data if there’s a new earthquake.

So you can see from the screen grab that the magnitude of the most recent earthquake was 59 (well, 5.9 really), while the depth was 50 km. In the Processing IDE’s text area at the bottom  it says ” no new activity”, meaning that the data displayed is from the last earthquake.

Next I added a magnitude threshold so it only picks up earthquakes above a certain magnitude. This is mostly because small earthquakes and tremors are surprisingly frequent, sometimes occurring every few seconds. Now the programme only parses a new one roughly every 10 minutes.

“Waiting…” means that the last new earthquake that occurred wasn’t big enough for us to bother with. The idea is more to respond to noteworthy occurences,  on the website the RSS feed is from they distinguish between earthquakes above 2.5, and those of 5.0 and over. However, earthquakes over 5.0 are still surprisingly common, so next I think I’ll look into the classification system a bit more and work out suitable a magnitude threshold.

This works nicely because  the plan is to have the arduino do something physical in response to earthquakes, but I don’t really want that to happen too often, so adjusting the magnitude threshold changes how often  data is sent to the arduino. Well, roughly anyway, but thats a good thing.

The XML feed also contains the date and location of the earthquake so I’ll be doing something with those next, probably nothing too exciting – sometimes it’s just nice to have the meta data.

Next the arduino code also needs doing, not to mention the design and implementation of the hardware and output. At this rate, it’s going to take ages.

Anyway, nothing to exciting, just checkin’ in really.

Advertisement

About this entry