Introduction: Electric Lock With Vibrating Sensor
We have made a prototype of an electric door lock with vibrating sensor. We hope you like it. Here's how we made it.
Step 1:
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
Step 2: HOW TO BUILD
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.
Step 3: CODE
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);
}