Introduction: Earthquake / Vibration Sensor

Picture of Earthquake / Vibration Sensor

We needed a method of detecting vibration in equipment, so I whipped up a simple vibration detector. One day, when the equipment was off, I saw that the detector was registering quite a bit of movement, even though I could not feel anything. I heard later that there had been an earthquake a few hundred miles away. That's when I had the "a ha" moment and decided to make a Seismic detector. Original article at http://arduinotronics.blogspot.com/2014/09/arduino-seismic-vibration-sensor.html

Parts:

Vibration Sensor - http://tinyurl.com/p3ej3fv

Arduino - http://tinyurl.com/pd3z4b4

16x2 LCD - http://tinyurl.com/n9rjk75

1 M Ohm Resistor - http://tinyurl.com/qdr2zox

Step 1: Connections

Picture of Connections

LDT0-028K

The vibration sensor connections are simple. Connect the + leg to A0, and the - leg to Arduino Gnd. Insert a 1 M Ohm resistor between the A0 and Gnd as well.

LCD

If you are using a I2C LCD, so there are 4 connections:

VCC - Arduino +5

SDA - Arduino A4

SCL - Arduino A5

Gnd - Arduino Gnd

There is special code and libraries required, see http://arduinotronics.blogspot.com/2014/09/arduino-seismic-vibration-sensor.html

If you are using a 16 pin parallel LCD;

The line in code:

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

resolves to the connections below:

The circuit:
* LCD RS pin to digital pin 12

* LCD Enable pin to digital pin 11

* LCD D4 pin to digital pin 5

* LCD D5 pin to digital pin 4

* LCD D6 pin to digital pin 3

* LCD D7 pin to digital pin 2

* LCD R/W pin to ground

* LCD VSS pin to ground

* LCD VCC pin to 5V

* 10K potentiometer:

1. ends to +5V and ground

2. wiper to LCD VO pin (pin 3)

Step 2: Code

Picture of Code

I'm including the code here for the parallel LCD. Contact me if you want the I2C code. It requires special libraries, but only uses two data pins instead of 6.

//sensitivity variables

int minimum = 200;

int maximum= 1023;

int maxdelay = 400;

// include the library code:

#include

// initialize the library with the numbers of the interface pins

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

// Custom Character

byte seismic[8] = { B11111, B11111, B11111, B11111, B11111, B11111, B11111, B11111, };

//defines the pin connections

int sensePin= 0;

void setup() {

Serial.begin(9600);

lcd.begin (16,2); // or (20,4)

lcd.createChar(0, seismic);

lcd.begin(16, 2);

}

void loop() {

int reading= analogRead(sensePin);

Serial.println(reading);

reading = constrain(reading, minimum, maximum);

Serial.println(reading);

reading = map(reading, minimum, maximum, 0, 15);

Serial.println(reading); lcd.clear();

for (int i=0; i <= reading; i++){

lcd.write(byte(0));

}

if (4<=reading && 8>reading){

lcd.setCursor(0, 1);

lcd.print(" ");

lcd.print("Seismic Activity");

delay(500);

}

if (8<=reading){

lcd.setCursor(0, 1);

lcd.print(" ");

lcd.print("Earthquake");

delay(500);

}

delay(maxdelay);

lcd.clear();

}

Comments

HrithuO (author)2017-07-24

Hey, Steve, I wonder if it was okay to connect the vibration sensor directly to the Arduino like that? Did it not cause any trouble? I say this because the data sheet for the piezo vibration sensor tells me the output could be as large s +/- 90V. and the arduino pins are desingned to handle a max of nearly 5.5V. Please let me know if you faced any troubles. :)

LansR (author)2016-01-07

Hey Steve i hope you're still active :) i just wa'nna ask you if there is an alternative vibration sensor, since there is no stock for the sparksfun piezo vibration sensor. Thanks :D

sspence (author)LansR2016-01-07

Here you go - http://amzn.to/1SCWis2

LansR (author)sspence2016-01-09

hey spence thanks for the reply. Can you make a video on how to input the codes and the library on the arduino application? thanks :D

LansR (author)sspence2016-01-09

hey spence thanks for the reply. Can you make a video on how to input the codes and the library on the arduino application? thanks :D

ecanderson (author)LansR2016-01-07

I just picked one of these (the mass-less version of the one shown in the article photo) up two weeks ago for another project. You can add your own mass to create resonant frequencies as desired. Got it here

http://www.amazon.com/gp/product/B00E4WKS70?psc=1&redirect=true&ref_=oh_aui_detailpage_o05_s00

tomatoskins (author)2015-04-28

Super cool use of a piezo!

About This Instructable

12,265views

45favorites

License:

Bio: Professionally, I'm an IT Engineer (Executive Level) and Electronics Tech. I'm a Amateur Radio Operator (KK4HFJ). I lived off grid, with Solar (PV ... More »
More by sspence:DIY I2C LCD Display with InputsRaspberry Pi & the Neo 6M GPSEarthquake / Vibration Sensor
Add instructable to: