Electric Lock With Vibrating Sensor

by safety first 4578 in Workshop > Home Improvement

446 Views, 1 Favorites, 0 Comments

Electric Lock With Vibrating Sensor

IMG_20180422_124406.jpg

We have made a prototype of an electric door lock with vibrating sensor. We hope you like it. Here's how we made it.

IMG_20180422_124416 (1).jpg

WHAT? Electric lock with vibrating sensor.

WHY? For the safety of the school.

FOR WHOM? For the school.

MATERIALS:

1. Arduino UNO

2. Breadboard

3. Vibration sensor

4. Solenoid lock

5. Wires

6. Relay

HOW TO BUILD

IMG_20180422_093050 (4).jpg
IMG_20180422_093041 (1).jpg

HOW TO BUILD:

1. Place the vibration sensor on the Breadboard.Connect a wire from the first pin(S) to A0 Analog pin on Arduino UNO. Then connect a wire from positive pin of vibration sensor to GND on Arduino UNO. Now connect a wire from negative pin to 5V on Arduino UNO.

2. Place the relay on the breadboard. Connect a wire from the first pin(S) to 2 digital pin on Arduino UNO. Then connect a wire from positive pin of relay to the line of negative pin. Now connect a wire from negative pin of relay to GND on Arduino UNO. Connect a wire from the 'common' pin to GND on Arduino UNO. Then connect a wire from the NO pin on the relay to a pin on the solenoid lock.

3. Connect a wire from second pin of solenoid lock to 3.3V on Arduino UNO.

CODE

IMG_20180422_124406.jpg
IMG_20180422_124356.jpg

CODE:

int elock = 2;

void setup() {

pinMode(A0, INPUT);

pinMode(elock, OUTPUT);

Serial.begin(9600);

}

void loop() {

int vsensor = analogRead(A0);

Serial.printIn(vsensor);

if(vsensor<1000)

digitalWrite(elock,HIGH);

}