This is a project about earthquakes. On the 29th September 2009 a strong, magnitude 8 earthquake struck of the coast of Samoa. It happened early in the morning and caused a Tsunami which killed nearly 200 people. It was evening, after work when I heard the news here in the UK.
The next day at work I was curious and wanted to learn more about this event, so I looked up the USGS website and started reading. As I looked around the site, I came across a page with a picture of the globe on it and a large yellow square over the Samoan Islands. As I looked at this chart, and briefly refreshed the page, another large square, this time red, appeared over the coast of Indonesia. The mouse-over read that it was a magnitude 7.6 earthquake. It had occurred minutes, if not seconds before I saw that red square appear.
I had just witnessed an earthquake occur on the other side of the world. While part of me was geeking out over how cool the near-real-time technology was, a much larger part of me spent those next few minutes thinking about the human impact, and what it must be have been like. The UK is not known for it's seismic activity, it's not something I'd spent much time thinking about before. However, because of the immediacy of the information, I felt much closer to it.
I told everyone in the office about what I'd just seen, but there was nothing on any of the regular news outlets about this, Only the red box on the map. It was about 1/2 hour later when the news of this earthquake broke on Reuters, AP and the BBC, with their first pictures of the devastation. Although slightly less strong than the Samoan earthquake of the night before, the Sumatran earthquake struck much closer to a densely populated area. More than 1000 people lost their lives, over 130,000 homes were destroyed. At least 20 countries have responded to the disaster with aid. My own response is significantly less practical but I'm hoping it can help somehow, even if only on a psychological level.
I'd like to introduce you to what i'm calling 'the Seismic Reflector'.
[Wikipedia sources here and here]
This project has two strands, a software and a hardware component. The aim is to build a device which responds to earthquakes being reported in near-real time via the USGS RSS feeds. The device responds by illustrating the magnitude of the reported earthquake via two fairly chunky vibration motors of the kind used in video game controllers. The device is connected to a PC via a virtual com port over USB (thanks to an on board Arduino). On the PC, an application sits there checking the RSS feed periodically and when a new event it posted to the RSS feed, the desktop app parses the data out of it and presents the magnitude of the quake to the Arduino which interpreters this as rate at which to activate the vibration motors.
[Images below from Boston.com Big Picture and USGS]
Step 1: Gather the Parts
First you will need a Computer, connected to the internet. It helps if this is a computer that you use (or is just on) pretty much all the time, I use my work computer, but if you have a media centre PC or home server, that would be ideal. Onto this PC you need to load the "Processing" Environment, which you can download here.
Download Processing from http://www.processing.org
Next, you will need to download the program that I've written to read the USGS feeds. You can find this at the bottom of the page here. This is loaded into the Processing IDE and run. You will need to make one change to it, change the reference to "COM6" to be whatever COM port your computer uses to talk to an Arduino.
Speaking of Arduino's, the next requirement is for an Arduino of some kind. In this project I used a Boarduino from Adafruit, because they rock. They are also very easy to use with breadboards.
Learn more about Arduino
Learn more about Boarduino
Speaking of breadboards, I'd advise you use one to build this project with at the start, unless you are super-cool and want to dive straight into PCB fabrication, or some kind of rats-nest stylee. I've used a breadboard thorough this project as you'll see from the photos.
Next you will need some components. Other than the Arduino, perhaps the biggest things going here are the vibration motors. I used vibration motors out of a playstation dual -shock controller which are probably rated about 5v although I'm guessing here. You can use anything you can get your hands on, but it should be able to fling itself around a bit, so you probably need something bigger than a pager motor. Most game controllers, including the Playstation dual-shocks have both a low frequency motor with a big weight on, and a high frequency motor with a small weight. This is useful for us as it creates a nice organic feeling vibration when they are both used together.
Powering motors straight from arduino pins looks like it should work, but actually it's really bad. You can fry your pin very easily, so don't do it kids. If you have some kind of H-Bridge lying around then you can do that, or just use some transistor based setup to take the current load away from the pin, and prevent current flowing back. I learned how to do this from the excellent ITP resource on controling high current loads with transistors.
Learn more about using transistors to control motors at ITP
I've used two motors so I've built two independent circuits to control them via PWM from arduino pins. If you only have one motor, or more then you will need to duplicate the components for each motor you want to drive.
For each motor circuit I used:
1x TIP120 transistor (NPN) (datasheet)
1x 1k Ohm resistor
1x Power Diode
some interconnecting wire
You can see the circuit diagram for this, and a more detailed parts list at the ITP page that I linked to above, I can't tell you what a cool resource ITP is.
In my code, I'm using pins 9 and 10 on the arduino, but you can change the code to use whichever (PWM) pins you like.