Skip to content

Home monitoring system with a Raspberry Pi and sending notifications with a Telegram bot

License

Notifications You must be signed in to change notification settings

m0by314/raspberry_pi_home_security_system

Repository files navigation

Home security system with Raspberry Pi and sending notifications with a Telegram bot

Linter

Tutorial to build a home security system with Raspberry Pi and sending notifications with a Telegram bot.

How it works

  • When a movement is detected, the application records a video that is sent to your phone by the Telegram bot.
  • Once installed, the surveillance system is managed from your smartphone with bot commands from the Telegram app.
  • The system is started by a systemd service activated at boot time

Prerequisites.

Connect the PIR sensor

image

Setup

  • Open the config.py file and configure the TOKEN_ID and CHAT_ID variables with your token_id and your chat_id
    # Variable to configure
    TOKEN_ID = 'Your token_id'
    CHAT_ID = 'Your chat_id'

Installing

The installation requires root rights:

A reboot will be done at the end of the installation to activate the camera hardware

sudo make install

Bot's commands

  • /start : start the home surveillance
  • /stop : stop the home surveillance
  • /status : show the status of home surveillance
  • /photo : take a picture
  • /video time= : records a video, by default delay is 60s
  • /clean : remove all files in video folder
  • /help : show help

Details

  • By default, the duration of the video is set to 60s. If you want change this, you need to modify the VIDEO_TIME constant in config.py

  • It's possible to add other commands to the bot in app.py

Testing

make test

Uninstall

sudo make uninstall

A reboot will be done at the end to deactivate the camera hardware

Built With

Hardware:

  • Raspberry Pi Zero WH
  • Infrared Camera v2 8MP
  • HC-SR501 PIR Motion Sensor Module

Libraries: