Modern traffic camera system for Raspberry Pi 3B+ with IMX477 camera using Bookworm OS.
β
Phase 1: Basic camera functionality with picamera2
β
Phase 2: Docker FileBrowser web interface
β
Phase 3: Codebase cleanup and modernization
π Ready for: Enhanced features and license plate detection
- setup_camera.sh - Automated setup for Bookworm/picamera2
- test_camera.py - Comprehensive camera testing with diagnostics
- camera_capture.py - Production single photo capture
- camera_diagnostics.py - Complete system health checks
- docker-compose.yml - FileBrowser web interface configuration
- Hardware: Raspberry Pi 3B+ + IMX477 Camera
- OS: Raspberry Pi OS Bookworm (libcamera native)
- Camera API: picamera2 (modern Bookworm-compatible library)
- Backend: Python 3.11+ with system-wide picamera2
- Frontend: FileBrowser Docker container
- Storage: Local filesystem (photos/ directory)
- Interface: Web browser access on port 8080
TrafficCamera/
βββ photos/ # πΈ All captured images
βββ data/ # πΎ FileBrowser application data
βββ venv/ # π Python virtual environment
βββ setup_camera.sh # π§ One-time system setup
βββ test_camera.py # β
Testing & validation
βββ camera_capture.py # π· Production photo capture
βββ camera_diagnostics.py # π System health checks
βββ docker-compose.yml # π³ Web interface config
βββ README.md # π This documentation
- Setup:
setup_camera.shinstalls picamera2, creates venv, sets up directories - Capture:
camera_capture.pytakes timestamped photos β saves tophotos/ - View: FileBrowser container serves
photos/via web interface - Monitor:
camera_diagnostics.pychecks all system components
git clone https://github.com/csantosscott/TrafficCamera.git
cd TrafficCamera
./setup_camera.sh# Test with virtual environment
source venv/bin/activate
python3 test_camera.py
# Or test without venv (system python)
python3 test_camera.pydocker-compose up -dAccess FileBrowser at: http://<pi-ip>:8080 (admin/admin)
# Single photo capture
python3 camera_capture.py
# View photos in web browser at http://<pi-ip>:8080- Hardware: Raspberry Pi 3B+ with IMX477 camera
- OS: Raspberry Pi OS Bookworm (64-bit recommended)
- Camera: IMX477 connected to CSI port, enabled in raspi-config
- Software: Docker and Docker Compose
- Memory: 128MB+ GPU memory (increase from default 76MB)
- Network: For FileBrowser web interface access
# Verify camera detection
libcamera-hello --list-cameras
# Check GPU memory (should be 128MB+)
vcgencmd get_mem gpu
# Verify Docker is installed
docker --version && docker-compose --versionpython3 camera_diagnostics.pyWhat it checks:
- β libcamera tools and camera detection
- β picamera2 library availability
- β GPU memory allocation
- β System memory status
- β Docker container status
- β Project setup verification
- β Quick photo capture test
# Enable camera interface
sudo raspi-config # β Interface Options β Camera β Enable
# Check physical connection
# Ensure ribbon cable firmly connected to CSI port
# Test detection
libcamera-hello --list-cameras
# Reboot after changes
sudo reboot# Edit boot configuration
sudo nano /boot/firmware/config.txt
# Add or modify this line:
gpu_mem=128
# Save and reboot
sudo reboot
# Verify change
vcgencmd get_mem gpu# Start container
docker-compose up -d
# Check container status
docker ps
# Find Pi IP address
hostname -I
# Access web interface
# http://<pi-ip>:8080 (admin/admin)
# Check logs if issues
docker logs traffic_camera_filebrowser# picamera2 is installed system-wide, not in venv
# Use system python directly:
python3 test_camera.py
# Or recreate venv with system packages:
rm -rf venv
python3 -m venv venv --system-site-packages
source venv/bin/activateThis is a known issue with the test script and doesn't affect single photo capture functionality. Use camera_capture.py for production photo taking.
sudo nano /boot/firmware/config.txt
# Add: gpu_mem=128
sudo rebootdocker-compose down
docker-compose up -d./setup_camera.sh # Re-run setup if neededFirst, run diagnostics:
python3 camera_diagnostics.pyTest individual components:
libcamera-hello # Test camera hardware
python3 test_camera.py # Test picamera2 integration
python3 camera_capture.py # Test photo capture
docker ps # Check containersCheck system status:
vcgencmd get_mem gpu # GPU memory
free -h # System memory
docker logs traffic_camera_filebrowser # Container logsSee projectplan.md for detailed development phases and progress tracking.