RPi4Cam is a flexible, open-source system for controlling multiple Raspberry Pi cameras to record synchronized videos for behavioral neuroscience experiments. It features a central GUI for managing camera operations, including starting/stopping recordings, configuring camera modes, transferring video files, and previewing live streams. The system is designed to be scalable, robust, and easy to use, with support for segmented recordings and clock synchronization verification.
- Centralized Control: Manage multiple Raspberry Pi cameras from a single Tkinter-based GUI.
- Recording Management: Start and stop recordings on individual or groups of cameras, with customizable durations and segment lengths.
- File Management: Transfer recorded sessions (H.264 videos and timestamp files) to a central storage location, with options to delete remote files after transfer.
- Live Preview: Stream MJPEG video feeds from each camera for real-time monitoring.
- Clock Synchronization: Verify and synchronize clocks across all Raspberry Pis using
chronycor hardware-based GPIO triggers. - Status Monitoring: Real-time updates on camera status, network connectivity, disk space, and recording duration.
- Modular Architecture: Separates camera service (
camera_service.py), GUI (central_control_gui.py), and utilities (gui_utils.py) for maintainability. - Open Source: Licensed under the BSD 3-Clause License, allowing free use and modification.
- Hardware:
- One or more Raspberry Pi 4 devices with cameras (tested with Raspberry Pi Camera Module 2/3).
- A central computer (Linux recommended) to run the GUI.
- Network connectivity between the central computer and Raspberry Pis.
- Optional: Push-button and wiring for hardware-based clock synchronization (see
gpiotest.py).
- Software:
- Raspberry Pi OS (64-bit recommended) on each RPi.
- Python 3.9+ on all devices.
- Required libraries (see
requirements.txt). libcameraandMP4Boxinstalled on the central computer and RPis.
- Network:
- A local network with static or known IP addresses for each RPi (see
hostnames.csv). - SSH access enabled on each RPi with username matching the hostname.
- A local network with static or known IP addresses for each RPi (see
-
Prepare Raspberry Pis:
- Install Raspberry Pi OS and ensure SSH is enabled.
- Install required dependencies on each RPi:
sudo apt update sudo apt install -y python3 python3-pip libcamera-apps gpac pip install -r requirements.txt
-
Start the camera service:
-
Prepare the Central Computer: