Earthquake Alert Project

 







Connection Diagram 







                     CODE 

#include <MPU6050.h>

#include <Wire.h>

MPU6050 MPU;

int GyroX , GyroY , GyroZ;

int buzzer = 10;

void setup() {

  pinMode(11,OUTPUT); 

  Serial.begin(9600);

  Wire.begin();

  MPU.initialize();

}

void loop() {

  MPU.getRotation(&GyroX, &GyroY, &GyroZ);

  if(GyroX< -1000 ||GyroX> 1000 || GyroY>1000 || GyroY< -1000 || GyroZ >1000 || GyroZ < -1000 ) {

  tone(buzzer,2800);

  digitalWrite(11,HIGH);

  delay(50);

   noTone(buzzer);

   digitalWrite(11,LOW);

   delay(50);

tone(buzzer,2800);

  digitalWrite(11,HIGH);

  delay(50);

   noTone(buzzer);

   digitalWrite(11,LOW);

   delay(50);  

   tone(buzzer,2800);

  digitalWrite(11,HIGH);

  delay(50);

   noTone(buzzer);

   digitalWrite(11,LOW);

   delay(50);  

   tone(buzzer,2800);

  digitalWrite(11,HIGH);

  delay(50);

   noTone(buzzer);

   digitalWrite(11,LOW);

   delay(50);  

   tone(buzzer,2800);

  digitalWrite(11,HIGH);

  delay(50);

   noTone(buzzer);

   digitalWrite(11,LOW);

   delay(50);  

   tone(buzzer,2800);

  digitalWrite(11,HIGH);

  delay(50);

   noTone(buzzer);

   digitalWrite(11,LOW);

   delay(50);  

   tone(buzzer,2800);

  digitalWrite(11,HIGH);

  delay(50);

   noTone(buzzer);

   digitalWrite(11,LOW);

   delay(50);  

   tone(buzzer,2800);

  digitalWrite(11,HIGH);

  delay(50);

   noTone(buzzer);

   digitalWrite(11,LOW);

   delay(50);  

   tone(buzzer,2800);

  digitalWrite(11,HIGH);

  delay(50);

   noTone(buzzer);

   digitalWrite(11,LOW);

   delay(50);  

   tone(buzzer,2800);

  digitalWrite(11,HIGH);

  delay(50);

   noTone(buzzer);

   digitalWrite(11,LOW);

   delay(50);  

   tone(buzzer,2800);

  digitalWrite(11,HIGH);

  delay(50);

   noTone(buzzer);

   digitalWrite(11,LOW);

   delay(50);  

   tone(buzzer,2800);

  digitalWrite(11,HIGH);

  delay(50);

   noTone(buzzer);

   digitalWrite(11,LOW);

   delay(50);  

   tone(buzzer,2800);

  digitalWrite(11,HIGH);

  delay(50);

   noTone(buzzer);

   digitalWrite(11,LOW);

   delay(50);  

   tone(buzzer,2800);

  digitalWrite(11,HIGH);

  delay(50);

   noTone(buzzer);

   digitalWrite(11,LOW);

   delay(50);  

   tone(buzzer,2800);

  digitalWrite(11,HIGH);

  delay(50);

   noTone(buzzer);

   digitalWrite(11,LOW);

   delay(50);  

   tone(buzzer,2800);

  digitalWrite(11,HIGH);

  delay(50);

   noTone(buzzer);

   digitalWrite(11,LOW);

   delay(50);  

   tone(buzzer,2800);

  digitalWrite(11,HIGH);

  delay(50);

   noTone(buzzer);

   digitalWrite(11,LOW);

   delay(50);  

   tone(buzzer,2800);

  digitalWrite(11,HIGH);

  delay(50);

   noTone(buzzer);

   digitalWrite(11,LOW);

   delay(50);  

   tone(buzzer,2800);

  digitalWrite(11,HIGH);

  delay(50);

   noTone(buzzer);

   digitalWrite(11,LOW);

   delay(50);  

    tone(buzzer,2800);

  digitalWrite(11,HIGH);

  delay(50);

   noTone(buzzer);

   digitalWrite(11,LOW);

   delay(50);  

   tone(buzzer,2800);

  digitalWrite(11,HIGH);

  delay(50);

   noTone(buzzer);

   digitalWrite(11,LOW);

   delay(50);  

   tone(buzzer,2800);

  digitalWrite(11,HIGH);

  delay(50);

   noTone(buzzer);

   digitalWrite(11,LOW);

   delay(50);

   tone(buzzer,2800);

  digitalWrite(11,HIGH);

  delay(50);

   noTone(buzzer);

   digitalWrite(11,LOW);

   delay(50);  

   tone(buzzer,2800);

  digitalWrite(11,HIGH);

  delay(50);

   noTone(buzzer);

   digitalWrite(11,LOW);

   delay(50);  

    tone(buzzer,2800);

  digitalWrite(11,HIGH);

  delay(50);

   noTone(buzzer);

   digitalWrite(11,LOW);

   delay(50);  

   tone(buzzer,2800);

  digitalWrite(11,HIGH);

  delay(50);

   noTone(buzzer);

   digitalWrite(11,LOW);

   delay(50);  

   tone(buzzer,2800);

  digitalWrite(11,HIGH);

  delay(50);

   noTone(buzzer);

   digitalWrite(11,LOW);

   delay(50);

   tone(buzzer,2800);

  digitalWrite(11,HIGH);

  delay(50);

   noTone(buzzer);

   digitalWrite(11,LOW);

   delay(50);  

   tone(buzzer,2800);

  digitalWrite(11,HIGH);

  delay(50);

   noTone(buzzer);

   digitalWrite(11,LOW);

   delay(50);  

    tone(buzzer,2800);

  digitalWrite(11,HIGH);

  delay(50);

   noTone(buzzer);

   digitalWrite(11,LOW);

   delay(50);  

   tone(buzzer,2800);

  digitalWrite(11,HIGH);

  delay(50);

   noTone(buzzer);

   digitalWrite(11,LOW);

   delay(50);  

   tone(buzzer,2800);

  digitalWrite(11,HIGH);

  delay(50);

   noTone(buzzer);

   digitalWrite(11,LOW);

   delay(50);




  } else {

  noTone(buzzer);

  digitalWrite(11,LOW);

  }

}

Post a Comment

Previous Post Next Post

Contact Form