Earthquake Detector Using Arduino Uno

Arduino Earthquake detector

Welcome to the quanta project, in this post we are going to make an earthquake detector which is very helpful to the community at the time of disaster. earthquake detector can detect an earthquake with the help of some sensor and can give time to the people to run away through the effective area. so, it can lifesaver to the community. you can make it easily by following some steps given in the post. in this project, you will learn the basics of analog pin and Arduino. An Earthquake is an unavoidable and eccentric regular wonder that frequently makes harm lives and property. We can’t battle it yet we can remain caution and mindful utilizing innovation that can secure us.

In this project, we will use the principle of the triple-axis accelerometer. which measures the acceleration in the all three axes. so there we will measure the acceleration with the help of a sensor and then we will make the calibration with the help of a serial monitor. so, that we can do the best condition on the basis of the reading given by the accelerometer. We also know that the accelerometers like ADXL335 are profoundly touchy to knocks and vibrations in any of the three physical axes. ADXL335 gives simple voltage comparable to forced speeding up. It has three yields, one each for of X-, Y-and Z-axis. The three simple yields are wired to Arduino Uno ADC pins. Any increasing speed caused because of development in any of the axis is identified by the accelerometer and send to the Arduino ADC.

when the vibration occurs due to the earthquake the sensor gets some acceleration and send this value to the Arduino. arduino receive the data and send the instructions to the display and buzzer which is connected to the circuit. the vibration cause the acceleration in any of the, it will work fine with that.

Component Required to make Earthquake detector;-

  • Arduino Uno
  • Accelerometer
  • LCD display
  • Led
  • Buzzer

Circuit Diagram Required to make Earthquake detector;-

Code for Earthquake detector;-

#include <Wire.h>


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

#define DEVICE (0x53) //ADXL345 device address

#define TO_READ (6) //num of bytes we are going to read each time (two bytes

for each axis)

#define offsetX -10.5 // place your OFFSET values here

#define offsetY -2.5

#define offsetZ -4.5

#define gainX 257.5 // place your GAIN factors

#define gainY 254.5

#define gainZ 248.5

byte buff[TO_READ] ; //6 bytes buffer for saving data read from the device

char str[512]; //string buffer to transform data before sending it to the

serial port

void setup()


Wire.begin(); // join i2c bus (address optional for master)

Serial.begin(9600); // start serial for output


//Turning on the ADXL345

writeTo(DEVICE, 0x2D, 0);

writeTo(DEVICE, 0x2D, 16);

writeTo(DEVICE, 0x2D, 8);


void loop()

int regAddress = 0x32; //first axis-acceleration-data register on the

int x, y, z;

readFrom(DEVICE, regAddress, TO_READ, buff); //read the acceleration data
from the ADXL345

//each axis reading comes in 10 bit resolution, ie 2 bytes. Least Significat
Byte first!!

//thus we are converting both bytes in to one int

x = (((int)buff[1]) << 8) | buff[0];

y = (((int)buff[3])<< 8) | buff[2];

z = (((int)buff[5]) << 8) | buff[4];

//we send the x y z values as a string to the serial port

sprintf(str, “%d %d %d”, x, y, z);


Serial.print(10, byte());













Upload the code in the Arduino

What do you think?

18 points
Upvote Downvote

Written by shahid

Leave a Reply

Your email address will not be published. Required fields are marked *

WIFI deauther, spamer and jammer

Tickling Creatures