How to build a home surveillance system with a RaspberryPI, a motion sensor, a camera and a Telegram bot.
When a movement is detected, the application records a video that is sent to your phone by the bot.
Once installed, the monitoring system is managed from your smartphone with the bot's commands.
The system is started by a systemd service activated at boot time
- Raspberry Pi Camera Module
- PIR motion sensor module
- 3 female-to-female jumper wires
- Tutorial for create your Telegram Bot
Use the cursor keys to select and open Interfacing Options, and then select Camera and follow the prompt to enable the camera.
raspi-config, it will ask to reboot.
Open the file
lib/config.pl and add your token_id
TOKEN_ID = 'Your token_id' VIDEO_TIME = 60 # duration of video recording REGISTRATION_FOLDER = 'tmp/video' # video recording folder
Before installing set your token_id then:
- /start : start the home monitoring system
- /stop : stop the home monitoring system
- /status : show the status of the monitoring system
- /photo : take a picture
- /video time= : records a video, argument time defines the duration of the recording
- /clean : remove all files in video folder
- /help : show help
- 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
- It's possible to add other commands to the bot in
app.pywith the decorator @bot.handler()
@bot.handler("/hello") def func_hello(): return bot.semd_message("Hello World")