Introduction: The Seismic Reflector

Picture of The Seismic Reflector

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]

The Aim

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

Picture of Gather the Parts

For this project you'll need a few bits.  Once you see what I'm trying to do you will be able to customise the parts list depending on your preference and what you have around.

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.



Step 2: The Software

Picture of The Software

The Software component of this project is written in Processing.  I'm not a pro-coder so I welcome comments on how this could be done better or more efficiently. 

The role of this software is to check the USGS 1day Earthquake RSS feed and trigger an event if a new entry is added to the list.  Right now the app checks the feed every 30 seconds which I think is probably a bit too often, but you can modify that if needed.

If a new event is added to the Feed and the app finds this, it sends a packet to the hardware containing the magnitude of the earthquake.  The hardware takes over at this point and knows how to respond to different strengths.  The app also has the ability to play an audible alert (which I've set to be an WW2 air raid siren)  when a new earthquake is posted.

A row of buttons at the bottom of the application allows for a certain degree of configuration and testing, but it's not exactly a complex interface.

It would be great if I could get the processing app to sit in the system tray on a PC, perhaps someone knows how to do that.  I know you can get Third party apps that minimise other applications to the tray, but that seems like cheating.  It's also a good size to be a Vista or Win7 widget, so if anyone wants to take the code and run with it, be my guest!

The attached zip file is the latest version of the code.  The connect button does not show the correct behaviour yet, although it should work (as long as you've changed the COM port to reflect what is used in your set-up).  This release of the software also includes the Air Raid siren which I downloaded from the very excellent Freesound.org (link to sample is here).  Future releases won't have this sample included in the zip due to the file size, so grab it while it's hot!

There are doubtless a few bugs in this code, I've not tested it too well, but If you have problems with it, then leave a comment and I'll do my best to respond.  I want to give a shout out to Bruno Nadeau, the author of the RomeFeeder Lib for Processing (link) who helped me get the USGS feed working. Please check Bruno's site for the latest versions of the library. (you will need this to compile the app)


Step 3: The Arduino Firmware

Picture of The Arduino Firmware

The code for the Arduino is fairly simple.  It waits for a byte to come in and check to see if it is '001' if it isn't then it discards it and continues to wait.  This byte is the header byte, and is there to stop any false alarms!  When the code receives a '001' then it reads the next byte it receives as the magnitude of an earthquake that that application has reported.  It then pulses the vibration motors at a rate appropriate to the Magnitude that is has been given.

Have a look at the attached .PDE, I've commented the code but if there is anything that you don't understand I'll try and answer it in the comments.  I'm not sure about all the map() stuff, I think I'll need to review that in a later release!

There are certainly more things I'd like to do with this code.  For a start there should be much more 'interesting' ways of creating the vibration profile.  Right now it's as simple as it could be, the magnitude that is passed in is used both to determine the value to pass out of the PWM pins (how fast the motors spin) and the length they spin for.  A much more sophisticated function could be used that pulses the motors along a simulation of an actual seismic waveform.  This would produce the 'organic' feeling that I've been aiming for.


Step 4: Putting It All Together, Final Thoughts

Picture of Putting It All Together, Final Thoughts

There are a couple of things left to mention, firstly there is a problem with power.  Even though I'm using transistors to protect the pins on the arduino, quite often the current being sucked by the motors causes the arduino to reset.  The obvious solution here is to power the motors directly, not through the arduino pins, and that's what I'll be doing in the next version of the hardware.

The reason I'll be doing this as a next step is that I'm also planning on ditching USB both as a means of power, and serial.  Instead I'll be powering the device from batteries (4xAA cells most likely) and using Xbee's for a wireless serial link.  This will achieve the ambition of having the device as a stand alone object, not seemingly thethered.  I'll have to find a nice enclosure for it too.

Finally, I'd just like to stress that this project is about empathising in some small way with victims of earthquakes.  I'm not trying to make light of peoples anguish or suffering, and I'm not trying to play on peoples fears of an impending "big one".  I do not experience many earthquakes where I live, but I know a lot of people around the world (specifically around the Med and the Pacific) do.  This is my attempt to understand that feeling a bit better. Thanks for reading!

Jim

Comments

nutsandbolts_64 (author)2011-04-06

I thought this was some sort of documentation about a large-scale project which literally deflects seismic waves out into somewhere else (at least dampen it). It would be awesome though, if you can turn the ground beneath you into a seismic-wave absorbent area which absorbs the energy released by the quake. Oh, and you might want to consider adding something in your device there that tells you where the quake struck.

Johenix (author)2011-04-03

Seismologist Jim Berkland (I think I have the name right) has a theory that when the Moon is either New or Full and at Perigee (nearest to the Earth in its orbit) Earthquakes (and Moonquakes) are likeliest to occour. (The Moonquakes are recorded by NASA's Appolo seismomiters on the Moon.)

Some years back "Sky and Telescope" magazine published in "Astronomical Computing" a program by the late Dr. Thomas VanFlandren in BASIC for computing exact times and dates of the New and Full Moons and Lunar Perigee and Apogee.

Note that there is sort of a 19 year cycle in major Volcanic and Seismic activity and a 38 year cycle in the position of the Moon.

jensenr30 (author)2011-04-03

nice1

Biggsy (author)2011-04-03

I used to sit watching the 'world disasters database' morose as it sounds i found it facinating seeing global trends, and reading stories about chemical leaks, bee attacks volcano erruptions etc without having to be spoon fed by the bbc or other news outlet

Welldone for a very good and thought provoking i'ble

high five for you :)

edwianni1 (author)2011-01-16

I just came across this (Seismic Reflector) and I think that it is a pretty neat idea (and could be very useful in the right environment). I would like to try something like it but I don't have any technical knowledge about the Arduino and limited knowledge about PC's or programming. I was looking at the USGS site (earthquakes in the last 7 days) and noticed they constantly update almost in real time (above M5 and below M5). Is there any (rather) simple way to to take these notifications and just generate a "sound" ( without any sophisticated concerns about amplitude or anything else about the sound) ..........directly out of the PC when they happen (without the Arduino)? Thank You Very Much. Sincerely, Ed.

jimthree (author)edwianni12011-01-17

Hi Ed.

Do you know anything about processing (www.processing.org)? If not it's very easy to learn and even with limted knowledge you can pick things up quite quickly. It's been a while since I looked at this project, but from memory the PC application which I wrote to go with the arduino should work fine without an arduino attached. One of the options on in the pc program (there are buttons on the bottom of the window) turn on or off the sound alerts (I used an air raid siren). You need to download the zipfile from Step 2 and load it up in processing. You can edit the code to make it do what you want, it's fairly simple code. You will also need to install the RomeFeeder library which is linked to from Processing.org.

If all this sounds a bit complex, then an easier step would be to just download an RSS feed reader (although I don't have any recommendations). I'm sure some of them will have the ability to play an audio alert when a new item (earthquake) is posted to the feed.

Jim

edwianni1 (author)jimthree2011-01-17

Hi Jim,

Thank you for the quick reply. I will look into "processing.org". I looked at the RSS feeder on the USGS site (latest earthquakes M5+ list), but I did not see any way to create an audible alarm each time the list is updated (again, I'm not as technically knowledgeable as I would like). Again, thank you for your excellent article and follow up help. Sincerely, Ed.

Istarian (author)2009-11-19

It would be easier if you provided the necessary libraries with the program sources. Also, if you could make a way to set the preferences for the serial port,etc within the program you could export this as a java application (you'd need to do it three times though, once for mac windows and linux).

chimericdream (author)2009-11-19

I'd be interested in knowing when/if you get a standalone wireless version of this working.  It's a great concept, and I would be interested in building a wireless version.... though I don't have the experience to take what you have built and convert it.

jimthree (author)chimericdream2009-11-19

You wouldn't believe how easy it is to make this wireless.  Power to the ardiuno would be from a battery source, (although you could invest a little time in understanding how you can use the transistors directly from the batteries, rather than through the arduino's pins like I did).  The best way of making the data side of the project wireless (IMHO) is to use Xbee modems.  Check out this link: http://www.ladyada.net/make/xbee/ for some great info.  Essentially, with no configuration at all, two of these fairly cheep devices will replace your USB serial cable.  It can't get easier than that.  I will certainly publish an update when I get mine wireless.

Jim

VorlonKen (author)2009-11-19

Hi The buttons.png is missing from the zip file.

jimthree (author)VorlonKen2009-11-19

Thank you for finding that, I've uploaded a new zip with it in!
Jim

kelseymh (author)2009-11-15

Okay, this is pretty cool.  You might try contacting the USGS folks directly (scientists are weirdly cool about e-mails from competent people :-) and see if they have any advice, suggestions, or even interest in this sort of thing.  It's a great PR idea.

Bongmaster (author)2009-11-15

different :)

About This Instructable

16,207views

22favorites

License:

More by jimthree:Ghetto Pixels - Building an open source BlinkMThe Seismic ReflectorMini Greenhouse Irrigation System
Add instructable to: