Door Knock Notifier
Installing dependencies
pip install pyserial
Windows Users
pip install win10toast
Bringing the Project Live
- Clone project to your hard disk.
- Open KnockNotifier.ino with Arduino IDE and upload it to Arduino UNO. https://github.com/yesIamHasi/ArduinoProjects/tree/master/DoorKnockNotificiation
- Make a circuit as shown in the diagram.
- Attach the buzzer to the back of the door with screw, tape or glue.
- Linux users run KnockNotifier-Ubunutu.py, Windows 10 users run KnockNotifier-Win10.py
- Now knock and you’ll receive the notification.
How does it work?
Arduino:
When someone knocks at the door it produces vibrations. These vibrations are then converted to analog electrical recorded by the analog pin of Arduino. The signal will cause a drop in voltage at analog pin A0. When this happens a trigger is sent via serial port to python client.
void setup() {
// put your setup code here, to run once:
Serial.begin(1000000);
}void loop() {
// put your main code here, to run repeatedly:
int reading = analogRead(A0);
if (reading < 1023){
Serial.println(reading);
}
}
Python:
import serial, subprocess
def notify(message, title):
subprocess.Popen([‘notify-send’,title, message])
returndef readSerial(port, baudrate):
UNO = serial.Serial(port, baudrate)while True:
while (UNO.inWaiting() == 0):
pass
reading = UNO.readline()
try:
reading = int(reading)
if reading < 1020:
print (“Someone is at the door”)
notify(‘Someone is at the door’, ‘Smart Door’)
except ValueError:
print (‘[!] Non readible’)if __name__ == ‘__main__’:
readSerial(‘/dev/tty/ACM0’, 1000000)