Door Knock Notifier

with Arduino UNO and Buzzer

Has
2 min readJan 22, 2020

Installing dependencies

pip install pyserial

Windows Users

pip install win10toast

Bringing the Project Live

  1. Clone project to your hard disk.
  2. Open KnockNotifier.ino with Arduino IDE and upload it to Arduino UNO. https://github.com/yesIamHasi/ArduinoProjects/tree/master/DoorKnockNotificiation
  3. Make a circuit as shown in the diagram.
  1. Attach the buzzer to the back of the door with screw, tape or glue.
  2. Linux users run KnockNotifier-Ubunutu.py, Windows 10 users run KnockNotifier-Win10.py
  3. 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])
return

def 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)

--

--

No responses yet