https://github.com/aranbarri/motion-detector-mailsender
This project uses a Raspberry Pi with a PiCamera2 module (IMX219, OV5647) to detect motion using OpenCV. When motion is detected, an image is saved and automatically sent to a configured email address. You can customize motion sensitivity and resolution easily using environment variables.
https://github.com/aranbarri/motion-detector-mailsender
deep-neural-networks email-sender motion-detection opencv-python picamera2 raspberrypi
Last synced: about 12 hours ago
JSON representation
This project uses a Raspberry Pi with a PiCamera2 module (IMX219, OV5647) to detect motion using OpenCV. When motion is detected, an image is saved and automatically sent to a configured email address. You can customize motion sensitivity and resolution easily using environment variables.
- Host: GitHub
- URL: https://github.com/aranbarri/motion-detector-mailsender
- Owner: aranbarri
- License: mit
- Created: 2025-04-13T19:41:14.000Z (6 days ago)
- Default Branch: main
- Last Pushed: 2025-04-13T21:25:53.000Z (6 days ago)
- Last Synced: 2025-04-13T21:28:35.285Z (6 days ago)
- Topics: deep-neural-networks, email-sender, motion-detection, opencv-python, picamera2, raspberrypi
- Language: Python
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 📸 Motion Detector and Email Sender with PiCamera2 and OpenCV
This project uses a Raspberry Pi with a PiCamera2 module (IMX219, OV5647) to detect motion using OpenCV.
When motion is detected, an image is saved and automatically sent to a configured Gmail address. You can customize motion sensitivity and resolution easily using environment variables.
## Features
- Motion detection via frame differencing
- Photo capture on movement
- Automatic email alerts with attached images
- Live preview window using OpenCV
- Dockerized for easy deployment
- Configurable sensitivity via environment variable `DIFF_THRESHOLD`---
## Requirements
- Raspberry Pi with PiCamera2 module - (IMX219, OV5647)
- Raspberry Pi OS (Bullseye or newer)
- Python 3.9+
- Docker & Docker Compose---
## Setup
### 1. Clone the repository
```bash
git clone https://github.com/aranbarri/motion-detector-mailsender.git
cd motion-detector-mailsender
```### 2. Set your environment variables
Edit the `docker-compose.yml`:
```env
[email protected]
[email protected]
EMAIL_PASSWORD=your_app_password
DIFF_THRESHOLD=5000
CAMERA_WIDTH = 2028
CAMERA_HEIGHT = 1520
```
> Use an app-specific password if you have 2FA enabled on Gmail.### 3. Build and run
```bash
docker-compose up --build
```The motion detection script will start and display a live preview. Images with detected motion will be saved and emailed.
---
## 🗂 Project Structure
```
motion-detector-mailsender/
├── detektor/
│ └── motion_detektor.py # Main script
├── Dockerfile # Container setup
├── docker-compose.yml # Service configuration
├── requirements.txt # Python dependencies
```---
## 🛠Customize
- Adjust motion sensitivity with the `DIFF_THRESHOLD` environment variable.
- Change the capture resolution the same way.
- Modify the email logic to send to multiple addresses or use other services (e.g. Telegram, Discord).---
## 📜 License
MIT License---