The RaspberryPi-Camera-Timelapse project is a low-power camera solution managed via the Blynk platform. It captures images at scheduled intervals, detects humans in the frame, overlays information such as timestamp and temperature, and uploads the enhanced images to Cloudinary. Power management is optimized using the Witty Pi 4 Mini for controlled sleep cycles, making it efficient for remote monitoring or time-lapse photography.
- Scheduled Image Capture: Configurable intervals for image capture, fully managed through Blynk.
- Human Detection: Real-time notification via Blynk if a human is detected in the image.
- Cloud Upload: Automatic image upload to Cloudinary for remote access.
- Low Power: Utilizes Witty Pi 4 Mini to control power, making it battery-friendly.
To replicate this project, you’ll need the following components:
- Raspberry Pi Zero 2 WH: The main processing unit, chosen for its small form factor and low power consumption.
- Witty Pi 4 Mini: A real-time clock and power management module that allows the Raspberry Pi to operate on a timed power cycle, greatly reducing power usage.
- Raspberry Pi Camera Module V2: The camera used for capturing images (Arducam 8MP IMX219 175 Degree)
Make sure you have the following software and accounts set up:
- Python 3: Installed on your Raspberry Pi.
- Blynk Account: For remote monitoring and control.
- Cloudinary Account: For uploading and storing captured images.
- SSH Access: To deploy and manage your code on the Raspberry Pi remotely.
To configure the camera, follow these steps:
- Open the configuration file:
sudo nano /boot/firmware/config.txt
- Modify the following lines:
- Find the line
camera_auto_detect=1
and update it to:camera_auto_detect=0
- Find the line
[all]
and add this below it:dtoverlay=imx219
- Find the line
- Save the file and reboot the system:
sudo reboot
Refer to the ArduCam IMX219 Camera Documentation for more details.
To ensure the camera is working, run:
libcamera-hello
In my setup, I use the Arducam 8MP IMX219 175 Degree Ultra Wide Angle Raspberry Pi Camera Module. I noticed that images had a significant purple tint by default. To address this, I use a tuning file. You can download the tuning file imx219_160d.json
and apply it when running libcamera
commands. This resolves color issues and improves overall image quality.
Additional information can be found here:
libcamera-still -o output.jpg --tuning-file /path/to/imx219_160d.json
Install the necessary Python libraries and dependencies:
sudo apt update
sudo apt install python3-pil python3-opencv
To install the WittyPi 4 Mini software:
- Download and install the script:
wget https://www.uugear.com/repo/WittyPi4/install.sh sudo sh install.sh
The camera.service
file manages the automatic execution of the camera script.
- Open the service configuration file:
sudo nano /etc/systemd/system/camera.service
- Copy and paste your
camera.service
content into this file.
- Enable the service to run at startup:
sudo systemctl enable camera.service
- Start the service:
sudo systemctl start camera.service
To verify if the service is running:
sudo systemctl status camera.service
Use journalctl
to check logs:
sudo journalctl -u camera.service
- To stop the service manually:
sudo systemctl stop camera.service
- To disable the service at startup:
sudo systemctl disable camera.service
DietPi is recommended for its lightweight and faster performance compared to Raspberry Pi OS. Follow these steps to set it up:
Install git with dietpi-software
Install the OpenSSH server to enable scp
and SSH functionality:
sudo dietpi-software install openssh-server
To configure the camera:
- Open the configuration file:
sudo nano /boot/config.txt
- Add or modify the following lines:
camera_auto_detect=0 dtoverlay=imx219
- Save the file and reboot the system:
sudo reboot
Install libcamera
and related tools:
sudo apt install libcamera-apps
Test the camera functionality:
libcamera-hello
If you are using a non-original Arducam camera, such as the Arducam 8MP IMX219 175 Degree Ultra Wide Angle Raspberry Pi Camera Module, download and use the tuning file imx219_160d.json
. Using this file helps correct significant color issues (e.g., purple tint) and improves image quality:
libcamera-still -o output.jpg --tuning-file /path/to/imx219_160d.json
Install required Python libraries:
sudo apt install python3-pil python3-opencv