Security System

The "Security System" application is a Python-based project that leverages hardware components to create a simple yet effective security monitoring system. This project utilizes an SMD Motor Driver, an RGB LED Module, a Buzzer Module, and an HC-SR04 Ultrasonic Distance Module. The system is designed to activate an alarm and visual warning signals if the detected distance falls below a predetermined threshold.

Project Key Components:

  1. SMD Motor Driver:

    • The SMD Motor Driver serves as the interface between the Python script and the components, interpreting commands to control the movement of the RGB LED and the activation of the Buzzer.

  2. SMD RGB LED Module:

    • The RGB LED Module is used to provide visual feedback. It is capable of displaying various colors, and in this project, it will indicate the security status through red and blue lights.

  3. SMD Buzzer Module:

    • The Buzzer Module serves as the audible alarm component. It emits sound when activated by the Python script.

  4. HC-SR04 Ultrasonic Distance Module:

    • The HC-SR04 Ultrasonic Distance Module measures the distance between the sensor and an object in its path. It provides distance data to the Python script for security monitoring.

  5. Python Script:

    • The Python script is the central component of the application. It communicates with the HC-SR04 Ultrasonic Module, interprets distance data, and controls the RGB LED and Buzzer through the SMD Motor Driver.

Project Key Features:

  1. Distance-based Security Monitoring:

    • The Security System continuously monitors the distance measured by the HC-SR04 Ultrasonic Module. If the detected distance falls below a predetermined value, the system activates the alarm and visual warning signals.

  2. Visual Feedback with RGB LED:

    • The RGB LED Module displays red and blue lights to indicate the security status. Red lights may represent an alert or danger, while blue lights indicate a normal or safe condition.

  3. Audible Alarm with Buzzer:

    • The Buzzer Module emits a sound when the system detects a potential security threat, providing an audible alert to draw attention to the situation.

Project Wiring Diagram:

Getting Started:

  1. Hardware Setup:

    • Connect the SMD Motor Driver to both the RGB LED Module and the Buzzer Module, following the provided documentation.

    • Integrate the HC-SR04 Ultrasonic Distance Module into the setup, ensuring secure connections.

  2. Run the Application:

    • Execute the Python script, initiating the "Security System" application.

    • Observe the RGB LED displaying colors and the Buzzer emitting sound based on the detected distance.

  3. Customize Security Thresholds:

    • Adjust the predetermined distance threshold in the script to customize the security monitoring levels.

    • Experiment with different colors and sound patterns for the RGB LED and Buzzer to suit specific security scenarios.

Project Codes:

from import*
import time
port = "COM13"
m = Master(port)


while True:
    distance = m.get_distance(0, 1)
    if distance != None:
        if distance < 15:
            m.set_buzzer(0, 1, 600)
            m.set_rgb(0, 1, red = 255, green = 0, blue = 0)
            m.set_rgb(0, 1, red = 0, green = 0, blue = 255)

            m.set_buzzer(0, 1, 0)
            m.set_rgb(0, 1, red = 0, green = 0, blue = 0)
            m.set_buzzer(0, 1, 0)

Last updated