This project came about after wanting a Ring style doorbell, there are four main issues with Ring doorbells:
- They are expensive
- They are not open source
- They are not customisable
- They send your data to Amazon
Not wanting a big tech firm to have pictures of me on their server I decided to make my own doorbell. This project is fully self hosted and although a network is required to run it, it does not require an internet connection and can be run on an air gapped network (I have not tested this but it should work).
For this project you will need:
-
ESP32-CAM (I used the AI-Thinker model) ~£10 on Amazon
-
Camera Housing (I used a electrical junction box) ~£4 at ScrewFix
-
Computer / SBC to run MQTT, MotionEye (I used a Orange Pi 3 LTS) ~£35 on AliExpress
-
A PC to run YOLOv3 (I used my Dell PowerEdge R810 but you can use the same SBC as above)
Diagrams and schematics can be found in the
hardwarefolder (coming soon)
-
MotionEye - For motion detection (I used a docker container on my Orange Pi)
-
An MQTT Client (I used Mosquitto) - For communication between the scripts as this allowed for other people to use the data for their own projects within the house
-
Python3 - the YOLO Libary uses Python3, it is recommended to use the
requirements.txtto install the required packages as openCV currently has dependancy issues with Python3.9 -
yolov3.weights - this is the pretrained model data, it should be put in
./utilsand can be downloaded from here
All of the config required is a .env file, this should be placed in the root directory of the project. The .env file should contain the following:
DISCORD_TOKEN= <YOUR DISCORD BOT TOKEN>
DISCORD_CHANNEL_ID= <YOUR DISCORD CHANNEL ID>
IMAGE_DIR_PATH= <MOTION EYE SAVE DIR >
MOTION_EYE_URL= <MOTION EYE URL>
MQTT_BROKER= <YOUR BROKER IP / HOSTNAME>
MQTT_PORT= <YOUR BROKER PORT>
MQTT_USER= <YOUR BROKER USER>
MQTT_PASS= <YOUR BROKER PASSWORD>
a sample .env file is provided in the repo
to run the project you will need to run the following command:
nohup python3 yolo-process.py > /dev/null &;
nohup python3 motion-send.py > /dev/null &;
nohup python3 discord-bot.py > /dev/null &This script is tempermental and needs updating to use asyncio instead of threading. I'm in the process of updating this script when I have time.
This script runs the discord bot, it gets the messages from MQTT and converts them into a discord message, it also sends the images to discord.
see below an example of the discord bot in action:
This project is still a work in progress and I am still working on it when I have time. Please feel free to contribute to the project if you have any ideas or want to help out.
- make !live work in
motion-send.pyasyincronously - remove threading (very inefficent) and replace with asyncio in
motion-send.py - remove threading (very inefficent) and replace with asyncio in
discord-bot.py - remove threading (very inefficent) and replace with asyncio in
yolo-process.py - make all python files conform to PEP8
- update YOLO version to v5-8 (currently v3)
- rewrite
README.mdto be more user friendly and include a setup guide - dockerise the project to make it easier to deploy
- add hardware diagrams and schematics to
hardwarefolder
