Introduction: Arduino Seismic Activity Monitor - Ethernet Shield

Picture of Arduino Seismic Activity Monitor - Ethernet Shield

Have you ever wanted to impress your friends by saying something crazy like, "I think there's going to be an earthquake soon" moments before an earthquake hits?

Or do you just want some warning, a few seconds that could save your life.

This project will allow you to hook up a seismic sensor to a router through the Ethernet shield and host a webpage off of the SD card on the shield. This webpage will then display information about the seismic sensor and the history of its activity.
All the data for the seismic sensor is stored in a Pachube feed and then displayed on the webpage as several graphs.

You will need:

  -  Arduino
        - Preferably an Arduino with large memory, I used the Arduino Mega 2560
        - You can use one with less memory, you just might have to remove some stuff from the sketch
  - Ethernet Shield
  - Micro SD Card
  - Pachube account: 

  - Piezoelectric Sensor
  - Breadboard
  - Resistors, Capacitors, Diode
        - Check the section on building the circuit for more details on values
  - 5 x Op-Amps - Single-supply compatible
        - or you can build it with dual supplies, whatever floats your boat :p
        - You can get away with using only 3 - 4 op amps, the rest I use is for amplification
  - Solid Wire of course!

I assume you already have:
  - Router
  - Computer
        - Would be pretty magical to surf the net without these
  - Extra Ethernet cable
  - USB cable for the arduino
  - Un-destroyed analog pin on your arduino

Step 1: The Circuit - Sensor

Picture of The Circuit - Sensor

The sensor I used to capture seismic vibrations is a Piezo Film vibra-tab.
They come with an optional weight attached to the end, but I found that the weight was not enough.

The frequency of earthquakes is between 1 - 20 Hz, but with even the heaviest weight the resonant frequency was in the KHz.
So to reduce the resonant frequency and get some useful signals, I took some  washers slapped them on a bolt and some nuts and experimented. I used a Oscilloscope with FFT and changed the weight on the tip of the film until frequencies of around 40Hz were the largest. If you don't own an oscilloscope, just add a little weight and then hit the sensor. It should flop around for about half a second to a second before coming to rest.

Once you have the sensor tuned to the right frequency, place it in your breadboard at one end, you're going to need the space for the rest of the circuit.
As you can see from the picture, I taped down the base of the sensor. This is because the leads on the piezo film is flat, and tends to be loose inside the breadboard, so any vibrations tend to get lost in the movement of the leads.
Taping it so that the base can't move will ensure that your data is accurate!

Step 2: The Circuit - Charge Amp

Picture of The Circuit - Charge Amp

Since a Piezoelectric Film isn't just a simple signal source, some circuitry is required to accurately and predictably measure the sensor's output.

 A Charge Amp takes the charge across a capacitor and translates it into a voltage. If you know your electronics you can see that it is essentially an integrator, which prevents the charge across the Piezo film, which acts like a capacitor, from discharging quickly.
This allows you to turn it into a stable voltage signal.

I used an LM324N, a quad op amp, to create the charge amp portion of the circuit.
If you follow the schematic on the last picture, you should get an AC signal at the output floating on 2.5Vdc [ If you are using a 5 volt supply ]

Step 3: The Circuit - Shaping the Signal

Picture of The Circuit - Shaping the Signal

The signal coming out of the charge amp section is an AC wave floating on 2.5Vdc. Since the amplitude of the wave is the same size when it swings to the positive end as the negative end, we can get more use from the ADC in the Arduino by amplifying only the positive waves.

We can do this by chopping off the bottom half of the wave with a diode and biasing it so that the diode is just-just turned on.
Now you have a waveform sitting on 0Vdc with only the positive peaks of the signal being read by the ADC.
I used a small signal, low voltage drop diode and then forward biased it with 0.45V.

You can stop here or further amplify the circuit, but that is completely up to you.

For this instructable I will stop here, since it isn't really meant to be an instructable on designing single supply amplifiers :p
This PDF from Texas Instruments can give you a good idea how to build them:

Step 4: Hookan It Up

Picture of Hookan It Up

This step is probably the simplest - hooking up the circuit to the Arduino.

  -  You need a wire from the Vcc portion on your breadboard to the 5V slot on your Arduino
  -  A wire from the ground line on your breadboard to the GND pin on the Arduino
  -  The output, either of the second stage or optional amplification stage, should be connected to one of the analog input pins

Next: Programming!

Step 5: Programming - Arduino Side

Picture of Programming - Arduino Side

The programming was probably the heftiest portion of this project, and hopefully my liberal amount of commenting will help make it clear how the program works.

First, a flowchart on how the program operates is shown in the first three pictures.

The program has been provided as well for download, just enter your own Pachube information and you are off to the races!

Libraries you may need:

#include <SPI.h>
#include <SdFat.h>
#include <SdFatUtil.h>
#include <Ethernet.h>
#include <EthernetDHCP.h>

Google for any you are missing, they are generally the first result if you include "Arduino" in your search

Step 6: Programming - HTML Side

Picture of Programming - HTML Side

For the html files you want to place on the SD card, you only really need "index.htm"
The rest are just filler.

Attached is what my site looks like and the html for it.
In "index.htm" you will find the code for the buttons I have there.

To make a button you just need to include in you website:

<form METHOD=get action="/">
<input type=hidden name=cmd value=gettime>
<input type=submit value="Text on Button">

This will create a form button which, when clicked, will send a GET command to your Arduino.
With the button I have here, the Arduino will receive

"GET /?cmd=gettime HTTP1.1/0"

As you can see, the NAME value get's inserted right after the "?"; the VALUE value is what is after the "="
The third line tells you what the button does and looks like, with the TYPE determining how it reacts to being pushed, and the VALUE showing up as text on the button.

The ACTION portion on the front line is a little stranger.
With the "/" in there, the button will send "/?cmd" to the arduino, but you could type in "" in there, and the button will attempt to send "/?cmd" to google's servers.

Step 7: Fini

Well, if you were able to follow these steps, you will now have a seismic activity monitor that you can place anywhere you'd like.
That is, as long as it is near a reliable power source and a router!

I hope that some of you will brave this project,


gvlachos (author)2016-10-12


What version of arduino ide you use to upload the sketch?i use the latest one and i cannot upload it.i got back lot of errors such as Client has rename it to EthernetClient and more.exit status 1

Christian RayD (author)gvlachos2017-03-11

sir did you finish this already? we got the same problem

sir i when i download the ethernetdhcp.h i got the error #include <wiring.h> and then i change the ethernetdhcp.h to ethernetclient.h but i got the error Client -_- dont know what to do now -_-

Christian RayD (author)2017-03-10

anyone ready for my question herE? hahaha

Christian RayD (author)2017-03-09


pgwiley (author)2016-10-11

This may be what I was looking for, but I may be in a little over my head-- I was hoping to make a system to see whether or not certain freight trains are shaking our office building more than others, so need it to be able to display seismic activity when a motion-activated camera records passing trains.

mora123 (author)2015-06-24

how can i write acode of this sensor on the Arduino c

toby7 (author)mora1232016-08-31

Same question about Arduino Code.

toby7 (author)2015-12-04

Since you didn't supply the Piezo device, here it is:

JadinA2 (author)2015-09-10

Exactly what I've been looking for, however, with more sensors you should be able to triangulate and work out the source of disturbances. I'm thinking this could be used for intruder detection if calibrated correctly? Perhaps you could have a map of your property that gets painted red wherever vibrations are detected.. Hmm..

AndreBerghuis (author)2015-03-11

Cool. Why did you not use the SW-180 vibration sensor? Or the ADXL335 Accelerometer? Thanks.

devbj (author)2015-02-03

I saw this article too late. very cool & smart system.

also, you're a good web designer. ;) very easy access to get info via HTTP Server.

Would you mind if I introduce this article to our collegue & our online collection site?

Sovereignty (author)2011-12-09

I'm not very familiar with the analog stuff, but would it be difficult to adjust the sensor to detect when someone, say, walks on a deck?

The walkway to my front door is a wood deck of 2x4s and I've been trying to think of a way to illuninate it as people walk across it.

veedo (author)Sovereignty2011-12-09

not difficult at all
All you would have to do is remove some weight from the sensor and change the caps in the charge amp section to lower values to amplify higher frequencies

amustakim (author)veedo2014-09-08

can this project use to detect vibration on turbine enjine?

Sovereignty (author)veedo2011-12-10

Thanks. And good job!

sharon.nkc (author)2014-09-03


I would like to know how sensitive is your sensor and if it will be able to detect vibrations as low as 2 on the richter scale?

bonatius (author)2013-12-04

I would like to ask you where did you buy the Piezoelectric Sensor?
Thank you.

veedo (author)bonatius2013-12-23

Any online electronics retailer will carry them, Digikey is popular in north america but I'm sure you can find something similar in every country

taufique_ (author)2013-01-09

I bought the piezo-film sensor and now I am about to build the charging circuit you designed (Thanks!) which I will later connect to a PIC rather than an arduino. I tried simulating the exact diagram on Proteus first, but the output voltage from the final op-amp was at a constant 8.7V "always", it didn't change ( :s inconsistent!) (in both AC and DC voltmeter) when biasing was done at 9V.

I may need to connect the film and build the circuit to test it practically and check for consistent result. However, could you co-operate in answering a few queries?

1. As my piezo will vibrate/bend, I am supposed to get a voltage output as seen in the datasheet (frequency vs open circuit voltage graph). When the signal is passed through the charging amp as you designed, I am supposed to get a stable, amplified voltage level variation right? (e.g. in arduino, sample value would be between 0 and 1023 for a range of vibration producing 0~5V). I am asking this because I am supposed to get no voltage when piezo doesn't vibrate, and say get a 2.5V when desired frequency oscillation occurs, right? Would I get such output from the circuit you have shown Sir?

veedo (author)taufique_2013-01-09

The piezo-electric material changes in capacitance as it bends. The op amp circuit is there to take the capacitance change and turn it into a voltage. So for the simulation you would need to vary the capacitance while it simulates somehow. 

If you get your own op-amp chip, look up the data sheet and hook up the inverting/non-inverting up like it is in the schematic and ignore the pin numbers on the schematic

taufique_ (author)veedo2013-07-24

simulation successful!

ecabral1 (author)taufique_2013-10-23

Taufique_, could you please send to my email ( the simulation that you did? It's for educational purposes. Thanks!!

pastoramadi (author)2013-07-05

Cool stuff, can you provide a step by step instruction on building the circuit sensor and charge amp for a novice high school student with basic electronics knowledge? The link to the Texas group has been deactivated.

veedo (author)pastoramadi2013-07-08

weird that they removed such a widely used document...
All you have to do is google "single supply op amp design" and you will find a lot of information on them and many examples you can work off of

JulianIsrael (author)2013-02-25

Hi man.
where do you bought the sensos?

veedo (author)JulianIsrael2013-04-11

You can try Digikey if you don't mind the shipping cost. Some electronics parts stores may carry piezo sensors, but the chances are slim, as they aren't a commonly bought sensor.

vzhang (author)2013-01-27

hi veedo,
I am making my own film sensor and want to use your circuit to check the output signal. and First i want to simulate in the Altium designer to determine the components' value. may i use a sinusoidal source to replace the LDT piezo film in the circuit

veedo (author)vzhang2013-01-27

The circuit simply senses a change in capacitance of the sensor. You would have to make some sort of variable capacitor in the circuit simulator to test it.

If you can't make a variable capacitor, you can use timed switches to put capacitors in parallel at different times during the simulation.

veedo (author)2013-01-09

I may have just used the wrong symbol in altium for the devie i used. It was a while ago, but i think i wasn't able to find the right part in the libraries.

qendra (author)2012-10-24

you are soo funny, what ever 'floats' your boat, haha brilliant. Im connecting my seismomiter to tweet everytime thers a quake.

Monty^ (author)2011-12-11

The frequency of earthquake ground vibration is typically <6Hz.

A 30-80Hz detector might sense trucks rumbling by or heavy footsteps, but not earthquake ground vibration unless it's from furniture falling over. 

A great resource is with many DIY seismometer designs.

veedo (author)Monty^2011-12-11

well, it's all low pass at 50/60 Hz, so it will amplify any frequency above 1 Hz
Thanks for the resource though!

If you wanted to lower the resonant frequency of the sensor, it's as simple as adding more weight on the sensor.

gyro_john (author)2011-12-11

Didn't you neglect to ground the bottom end of R2 / C3?

veedo (author)gyro_john2011-12-11

fixed! thanks for the catch

veedo (author)gyro_john2011-12-11

oh wow, sorry, there is supposed to be a ground symbol at the bottom

blinkyblinky (author)2011-12-10


If I didn't want to shorten the sketch nor by an Arduino Mega, could I use an external EEPROM?

veedo (author)blinkyblinky2011-12-10

most definitely
There are also some efficiency improvements that can be made to save more space.
I was just not concerned with that since the MEGA has so much space on it

A good example:
I use a float to compare a previous measurement with the next measurement
A more efficient way would be to just use the A/D converter's integer value for both, and then convert it to voltage/float right before sending it to pachube.

blinkyblinky (author)veedo2011-12-11

Ahhh...I have been enlightened.

About This Instructable




More by veedo:Arduino Seismic Activity Monitor - Ethernet ShieldFun Sun-tracking Arduino
Add instructable to: