0% found this document useful (0 votes)
15 views

Ec Project REP

This document describes a project to design an Arduino earthquake detector alarm with a seismic graph plotter. It uses an ADXL335 3-axis accelerometer sensor to detect shaking or movement from an earthquake. The accelerometer is interfaced with an Arduino, LCD display, buzzer, and LED. It also involves coding in Arduino to detect earthquakes and Processing IDE to plot the vibrations on a graph on a computer.

Uploaded by

Muhammad Hamad
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Ec Project REP

This document describes a project to design an Arduino earthquake detector alarm with a seismic graph plotter. It uses an ADXL335 3-axis accelerometer sensor to detect shaking or movement from an earthquake. The accelerometer is interfaced with an Arduino, LCD display, buzzer, and LED. It also involves coding in Arduino to detect earthquakes and Processing IDE to plot the vibrations on a graph on a computer.

Uploaded by

Muhammad Hamad
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

COMSATS University Islamabad

(Wah Campus)

PROJECT Report
Earthquake Detector Alarm with Seismic
Graph Plotter

Thursday, June 23, 2022

Circuit & electronics LAB


Engineer Kanwal Saeed
MEMBERS
Muhammad Hamad | FA20-BME-023
Munim Ijaz Lodhi | FA20-BME-030
Muhammad wasif Azeem | FA20-BME-026
Omar Shafique | FA20-BME-075

INTRODUCTION

In this project, we will design Arduino Earthquake Detector Alarm with Seismic Graph. We will used ADXL335
3 axis Accelerometer as a sensor for detecting tilting, trembling, or any shaking movement of an earthquake.
We will an interface ADXL335 Accelerometer with Arduino and LCD display for designing Arduino Earthquake
Detector Alarm with Seismic Graph.

COMPONENTS

1. Arduino Uno Board


2. ADXL335 Accelerometer
3. 16 x 2 LCD Display
4. Buzzer
5. LED

Circuit Diagram & Connections:

Designed on Tinker CAD


WORKING PRINCIPAL
In this Arduino Earthquake Detector Alarm with Seismic Graph project, we will write two codes:

one for Arduino to detect an earthquake and another for Processing IDE to plot the earthquake vibrations
over the graph on Computer.

ADXL335 3 Axis Accelerometer:


This Accelerometer module is based on the popular ADXL335
three-axis analog accelerometer IC, which reads off the X, Y,
and Z acceleration as analog voltages. By measuring the
amount of acceleration due to gravity, an accelerometer can
figure out the angle it is tilted at with respect to the earth. By
sensing the amount of dynamic acceleration, the
accelerometer can find out how fast and in what direction the
device is moving. Using these two properties, you can make all
sorts of cool projects, from musical instruments (imagine
playing and having the tilt connected to the distortion level or
the pitch-bend) to a velocity monitor on your car (or your children’s car). The accelerometer is very easy to
interface to an Arduino Micro-controller using 3 analog input pins and can be used with most other
microcontrollers, such as the PIC or AVR.

Working of ADXL335 Accelerometer:

The most commonly used device is the piezoelectric accelerometer. As the name suggests, it uses the
principle of piezoelectric effect. The device consists of a piezoelectric quartz crystal on which an accelerative
force, whose value is to be measured, is applied.

Due to the special self-generating property, the crystal produces a voltage that is proportional to the
accelerative force. This voltage signal is then read by microcontroller to draw graph and detect earthquake.
Project
Processing IDE GRAPH

ARDUINO CODE
#include <LiquidCrystal_I2C.h>
#include<Wire.h>

LiquidCrystal_I2C lcd (0x27, 16,2);

#define buzzer 12 // buzzer pin


#define led 13 //led pin
#define x A0 // x_out pin of Accelerometer
#define y A1 // y_out pin of Accelerometer
#define z A2 // z_out pin of Accelerometer

/*variables*/
int xsample=0;
int ysample=0;
int zsample=0;
long start;
int buz=0;
/*Macros*/
#define samples 50
#define maxVal 2 // max change limit
#define minVal -2 // min change limit
#define buzTime 5000 // buzzer on time

void setup()
{
lcd.begin(); //initializing lcd
Serial.begin(9600); // initializing serial
delay(1000);
lcd.print("EarthQuake ");
lcd.setCursor(0,1);
lcd.print("Detector ");
delay(2000);
lcd.clear();
lcd.print("BY");
delay(500);
lcd.clear();
lcd.print("Muhammad Hamad");
delay(1000);
lcd.setCursor(0,1);
lcd.print("Omar Shafique");
delay(1500);
lcd.clear();
lcd.print("Munim Ijaz");
delay(1000);
lcd.setCursor(0,1);
lcd.print("Muhammad Wasif");
delay(1500);
lcd.clear();
lcd.print(" CALIBRATING");
delay(500);
lcd.clear();
lcd.print(" CALIBRATING.");
delay(500);
lcd.clear();
lcd.print(" CALIBRATING..");
delay(500);
lcd.clear();
lcd.print(" CALIBRATING...");
delay(500);
pinMode(buzzer, OUTPUT);
pinMode(led, OUTPUT);
buz=0;
digitalWrite(buzzer, buz);
digitalWrite(led, buz);
for(int i=0;i<samples;i++) // taking samples for calibration
{
xsample+=analogRead(x);
ysample+=analogRead(y);
zsample+=analogRead(z);
}

xsample/=samples; // taking avg for x


ysample/=samples; // taking avg for y
zsample/=samples; // taking avg for z

delay(450);

lcd.clear();
lcd.print("Device Ready!");
delay(2000);
lcd.clear();

lcd.print("X Y Z");
}

void loop()
{
int value1=analogRead(x); // reading x out
int value2=analogRead(y); //reading y out
int value3=analogRead(z); //reading z out

int xValue=xsample-value1; // finding change in x


int yValue=ysample-value2; // finding change in y
int zValue=zsample-value3; // finding change in z

/*displying change in x,y and z axis values over lcd*/


lcd.setCursor(0,1);
lcd.print(xValue);
lcd.setCursor(6,1);
lcd.print(yValue);
lcd.setCursor(12,1);
lcd.print(zValue);
delay(100);

/* comparing change with predefined limits*/


if(xValue < minVal || xValue > maxVal || yValue < minVal || yValue > maxVal || zValue < minVal || zValue >
maxVal)
{
if(buz == 0)
start=millis(); // timer start
buz=1; // buzzer / led flag activated
}

else if(buz == 1) // buzzer flag activated then alerting earthquake


{
lcd.setCursor(0,0);
lcd.print("Earthquake Alert ");
if(millis()>= start+buzTime)
buz=0;
}

else
{
lcd.clear();
lcd.print("X Y Z ");
}

digitalWrite(buzzer, buz); // buzzer on and off command


digitalWrite(led, buz); // led on and off command

/*sending values to processing for plot over the graph*/


Serial.print("x=");
Serial.println(xValue);
Serial.print(" y=");
Serial.println(yValue);
Serial.print(" z=");
Serial.println(zValue);
Serial.println(" $");

You might also like