Smart Doorbell

The Smart Doorbell project allows the user to interact with environment with both input and output modules. The Ultrasonic Distance Sensor Module is used to detect if there is a person or a hand in front of the doorbell. If anything is near it, it detects and sends a feedback to script, allowing the user to play a sound with a buzzer.

Project Key Components

  1. SMD

    The SMD acts as a bridge between the script and the modules. It is responsible for interpreting the commands sent by the script and translating them into actions that read input from the Ultrasonic Distance Sensor Module and play an alert sound with the Buzzer Module.

  2. Buzzer Module

    The Buzzer Module is connected to the system for the most crucial role for the application, that is alerting the user when something is nearby.

  3. Ultrasonic Distance Sensor Module

    The Ultrasonic Distance Sensor Module is used to detect if anything is nearby and if there is, how many centimeters away.

  4. SMD Libraries

    The SMD library is at the heart of the application. It communicates with the SMD using a specific communication protocol, sending commands to read the Ultrasonic Distance Sensor Module and play an alert sound with the Buzzer Module.

Project Key Features

  • Proximity-Based Activation

    The project uses the module with the HC-SR04 to detect the surroundings via ultrasonic sound waves. It makes a great way to understand how physics of sound works and also see that it is a way of interacting with environment with such an input sensor.

  • Adjustable Sensitivity

    The user can change the sensivity of the distance check, customizing it to be more sensitive or unresponsive to near surroundings.

  • Real-time Monitoring

    The script can easily provide the real-time distance monitoring if the user add a simple line. It enhances the code and gives more opportunity to monitor the surroundings.

Project Wiring Diagram

Getting Started

  1. Hardware Setup

  2. Run the Script

  3. Observe Buzzer Activation

Project Codes

from smd.red import *

SerialPort = "COM3"        # Serial port of the USB gateway module
baudrate = 115200          # Baud rate of communication
ID = 0                     # ID of the SMD
buzzer_module_id = 1       # ID of the buzzer module
distance_module_id = 1     # ID of the ultrasonic distance sensor module

master = Master(SerialPort, baudrate)       # Defines the USB gateway module
master.attach(Red(ID))                      # Gives acces to the SMD of specified ID
master.scan_modules(ID)                     # Scans and identifies the modules that are connected to the SMD

while True:
    distance = master.get_distance(ID, distance_module_id)      # Variable to store the ambient light data
    print(distance)                                             # Printing the value to observe 

    if distance < 15:
        master.set_buzzer(ID, buzzer_module_id, 600)            # Number is correspond to the frequency of the buzzer
    else:
        master.set_buzzer(ID, buzzer_module_id, 0)              # Sets the buzzer frequency to 0, meaning turning the buzzer off

Last updated