Skip to content

usernametarek/Alarm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

Alarm-System-with-Raspberry-PI-5

Easy alarm system to make with a Raspberry PI 5 and it's components

Project Overview

Our project aims to recreate a smart alarm system. When an individual passes in front of the distance sensor at a predefined distance, a sound alarm will trigger, and a red LED light will blink. An LCD screen will then prompt the individual to enter a password.

Two scenarios can occur:

  1. If the individual enters the correct password, the system will return to normal.
  2. If the individual enters the incorrect password, the sound and LED will activate more rapidly, and the LCD screen will display an alert message indicating that the police have been notified.

Components needed

To build this project, you will need the following components as showed in the picture.

ajnrbghaebaehkn

Ultrasonic Proximity Sensor (HC-SR04)

This module detects the presence of an individual at a distance. In our project, the distance is adjustable up to a maximum of 1.2 meters.

s-l400

RGB LED

The RGB LED activates whenever an individual passes in front of the sensor, blinking until the correct password is entered. If an incorrect password is entered, the RGB LED will blink more rapidly.

1 1

LCD Screen 0802

The LCD screen displays instructions for the user, such as prompting for password entry. If the password is incorrect, it shows a message indicating that the police have been alerted.

2846-LCD802A_main-500x500

Buzzer

The buzzer activates as soon as an individual is detected. It will turn off if the correct password is entered; however, if the password is incorrect, it will emit a sound at a faster rate.

buzzer

2 Potentiometers

  1. potentiometer 1 adjusts the contrast of the LCD screen to enhance visibility.
  2. potentiometer 2 allows for the adjustment of the detection distance of the ultrasonic proximity sensor.
  3. pot

ADS1115 Module

This module enables the connection of the potentiometer to ensure it functions properly.

319104169_ads1115-16-bit-adc-module_x

prototyping board

used to facilitate multiple connections

breadboard

Setting up

GPIO Pin Configuration

  1. Ultrasonic Sensor (HC-SR04)

    • TRIG: GPIO 16
    • ECHO: GPIO 20
    • VCC : 5V
    • GNG : GROUND
  2. Buzzer

    • S: GPIO 26
    • V: 3.3V
    • G: Ground
  3. LED

    • R: GPIO 21
    • V: 3.3V
    • G: Ground
  4. LCD Display

    • RS: GPIO 6 (D6)
    • E: GPIO 10 (D10)
    • DB4: GPIO 22 (D22)
    • DB5: GPIO 27 (D27)
    • DB6: GPIO 17 (D17)
    • DB7: GPIO 4 (D4)
    • RW: Ground
    • VSS: Ground
    • VDD: 5V
    • V0: Connect to the second potentiometer S pin

    lcd_gpio

  5. ADS1115 Module

    • SDA: GPIO 2
    • SCL: GPIO 3
    • VDD: 3.3V
    • GND: Ground
    • A0: Connect to the first potentiometer S pin
  6. Potentiometer 1

    • S: Connect to the ADS1115's analog input (A0).
    • V: 3.3V
    • G: Ground
  7. Potentiometer 2

    • S: Connect to the LCD Display V0 Pin
    • V: 5V
    • G: Ground

Software Requierements

  1. Python 3

Required libraries

  1. sys: Provides functions and variables for manipulating the runtime environment.
  2. busio: Used for I2C communication.
  3. board: Defines pin names for the LCD screen.
  4. time: Provides functions for manipulating time.
  5. pigpio: Used to control GPIO on a Raspberry Pi.
  6. digitalio: Allows working with digital pins (reading and writing).
  7. threading: Provides tools for creating and managing threads.
  8. adafruit_ads1x15: Library for interacting with analog-to-digital converters.
  9. ADS1115: Specific class for the ADS1115 model.
  10. AnalogIn: Used to read analog inputs.
  11. adafruit_character_lcd: Library for controlling a character LCD.

Step-by-Step Installation Guide

  1. Prepare Your Raspberry Pi:
    • Ensure your Raspberry Pi is powered on and connected to your network.
    • Enable SSH on your Raspberry Pi:
      • You can do this via raspi-config:
        sudo raspi-config
      • Navigate to Interfacing Options > SSH and enable it.
  2. Find Your Raspberry Pi's IP Address:
    • Run the following command on your Raspberry Pi terminal:
      hostname -I
    • Note the IP address displayed (e.g., 192.168.1.100).
  3. Set Up SSH Connection in VS Code:
    • Open Visual Studio Code.
    • Install the Remote - SSH extension if you haven't already.
    • Open the command palette (Ctrl + Shift + P or Cmd + Shift + P).
    • Type and select Remote-SSH: Connect to Host....
    • Choose Add New SSH Host and enter the connection string:
      ssh pi@<YOUR_PI_IP_ADDRESS>
      Replace <YOUR_PI_IP_ADDRESS> with the actual IP address of your Raspberry Pi.
    • Save the configuration when prompted.
  4. Connect to Your Raspberry Pi:
    • Again, open the command palette and select Remote-SSH: Connect to Host....
    • Choose the Raspberry Pi connection you just set up.
    • If prompted, enter the password for the pi user (default is raspberry, unless changed).
  5. Clone the git repository:
    • In the terminal within VS Code, run:
      https://github.com/usernametarek/Alarm.git;
  6. Navigate to the Project Directory:
    cd Alarm ;
  7. Install Required Libraries:
    pip install adafruit-circuitpython-busio adafruit-circuitpython-ads1x15 adafruit-circuitpython-charlcd pigpio
  8. Run the alarm.py file:
    • You can now run the alarm.py file and enjoy the project

Additional Notes

  • Ensure your Raspberry Pi has the necessary updates and packages:
    sudo apt update
    sudo apt upgrade

About

Easy alarm system to make with a Raspberry PI 5 and it's components

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages