kiroloskhairy
Published

ANTI-Earthquake Bed

A bed that senses an earthquake or other danger and closes to protect sleepers. It protects people from accidents caused by earthquakes.

IntermediateFull instructions provided324
ANTI-Earthquake Bed

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Grove - Vibration Sensor (SW-420)
Seeed Grove - Vibration Sensor (SW-420)
×1
Dual H-Bridge motor drivers L298
SparkFun Dual H-Bridge motor drivers L298
×1
DC Motor, 12 V
DC Motor, 12 V
×1
Solderless Breadboard Half Size
Solderless Breadboard Half Size
×1
Jumper wires (generic)
Jumper wires (generic)
×1
5 mm LED: Red
5 mm LED: Red
×1
Buzzer
Buzzer
×1
Switch Actuator, Head for spring return push-button
Switch Actuator, Head for spring return push-button
×1
9V battery (generic)
9V battery (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Hot glue gun (generic)
Hot glue gun (generic)

Story

Read more

Schematics

fritzing circuit diagram for ANTI-Earthquake Bed

simulation ANTI-Earthquake Bed by proteus

Code

ANTI-Earthquake_Bed.ino

Arduino
int led = 2;
int buzzer = 4; 
int vibra_sen = A5;
int push =12;

int value;
float measurement;

// MOTOR A
int EN_1 = 6;
int IN_1 = 7;
int IN_2 = 8;

void setup(){
  pinMode(led,OUTPUT);
  pinMode(buzzer,OUTPUT);
  pinMode(vibra_sen,INPUT); 
  pinMode(push,INPUT); 

  // MOTOR A
  pinMode(EN_1,OUTPUT);
  pinMode(IN_1,OUTPUT);
  pinMode(IN_2,OUTPUT);
 }

void loop(){



  measurement = pulseIn(vibra_sen,HIGH);
  value = digitalRead(push);

   if (measurement > 50){
   digitalWrite(led,HIGH);
   digitalWrite(buzzer,HIGH);

   //MOTOR A
   digitalWrite(IN_1,HIGH);
   digitalWrite(IN_2,LOW);
   analogWrite(EN_1,150);
   delay(65);
   digitalWrite(IN_1,HIGH);
   digitalWrite(IN_2,HIGH);
  
  }



   if (value==HIGH){

   digitalWrite(led,LOW);
   digitalWrite(buzzer,LOW);
   
   
   //MOTOR A
   digitalWrite(IN_1,LOW);
   digitalWrite(IN_2,HIGH);
   analogWrite(EN_1,150);
   delay(65);
   digitalWrite(IN_1,HIGH);
   digitalWrite(IN_2,HIGH);
   
  }


}

Credits

kiroloskhairy

kiroloskhairy

0 projects • 0 followers

Comments

Add projectSign up / Login