https://github.com/ethymoney/pi-dashcam
My own custom dashcam using a Raspberry Pi Zero 2, the Raspberry Pi camera module V3, and a PiSugar3.
https://github.com/ethymoney/pi-dashcam
Last synced: 9 months ago
JSON representation
My own custom dashcam using a Raspberry Pi Zero 2, the Raspberry Pi camera module V3, and a PiSugar3.
- Host: GitHub
- URL: https://github.com/ethymoney/pi-dashcam
- Owner: EthyMoney
- License: mit
- Created: 2023-07-30T02:35:43.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-21T04:27:31.000Z (over 1 year ago)
- Last Synced: 2025-07-31T23:28:23.889Z (11 months ago)
- Language: Python
- Size: 42 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Raspberry Pi Dashcam
## NOTE: This is an in-progress project!
I'm still working through some of the finer details. The base code already here does work for the most part. Recording works, starting and stopping works, power input montoring works, auto-stopping and uploading works. The main pieces are all here, just need to do some field testing and polishing.
#
This project transforms a Raspberry Pi into a functional dashcam. Leveraging the power of the PiCamera2 library and FFmpeg, it continuously records video while your vehicle is on the move, and automatically saves the recorded video to a network storage location when the vehicle returns home. The goal was to create a solution that automatically manages the video recording start and stop and the storage and offloading of files, minimizing the need for any manual intervention while keeping the good parts of an off-the-shelf dashcam. You will always have your most recent trip recorded and on your network storage, ready to be viewed or shared with ease.
## Purpose
The purpose of this project is to provide an affordable, DIY alternative to commercial dashcams while allowing for custom automatic behavior to make using it require no thought. This solution allows for continuous video recording that is automatically managed, so you never need to fiddle with an SD card or stupid cloud accounts and apps ever again!
## How It Works
1. **Starting the Program:** The program is designed to launch automatically when the Raspberry Pi boots up. This can be triggered by starting the vehicle if the Pi is connected to the vehicle's power system.
2. **Video Recording:** As soon as the program starts, it begins recording video using the connected PiCamera. The video is saved to a local file on the Pi.
3. **Monitoring WiFi Status:** While the program is running, it continuously checks the status of a specified WiFi connection (your home WiFi). Initially, the program recognizes that it's connected to the home WiFi, but it won't attempt to stop the recording until it has lost the connection first and then reconnected, indicating that the vehicle has left home and returned.
4. **Stopping the Recording:** When the vehicle returns home, and the Pi reconnects to the home WiFi, the program stops the video recording once it sees the PiSugar3 go to battery power (vehicle turned off).
5. **Uploading the Video:** After stopping the recording, the program mounts the network storage drive and uploads the recorded video to this location.
6. **Verifying and Cleaning Up:** The program then verifies that the video was successfully uploaded by checking the file's existence and size on the network storage. If the upload was successful, it deletes the local copy of the video file. If the upload was not successful, it leaves the local copy intact for manual recovery.
7. **Shutting Down:** Finally, the program cleanly shuts down the Raspberry Pi. Then the cycle repeats when the vehicle is started again.
## Setup
To get started with this project, clone this repository and then we'll take care of dependencies next:
First, install the required OS packages:
```bash
sudo apt install python3 python3-pip ffmpeg python3-pil python3-rpi.gpio libcap-dev python3-libcamera python3-pyqt5 python3-opengl python3-picamera2 -y
```
Next, install the required Python packages (run this from within the project folder):
```bash
pip3 install -r requirements.txt
```
You will need to modify the script with your specific network and WiFi details. In particular, you'll need to replace the placeholders in the script with your own values:
- Replace `"WiFi Name Here"` with the SSID of your home WiFi.
- Replace the server IP and shared folder name with your network storage details.
- Replace the username and password with your network storage credentials.
Finally, configure your Raspberry Pi to automatically run the script on boot. This can be done by adding a command to your Pi's `rc.local` file (or equivalent, depending on your operating system).