- Raspberry Pi 5 (8GB) with Raspberry Pi OS 64-bit (Bookworm)
- MicroSD card (32GB+ recommended)
- USB Webcam (UVC-compatible, 720p+, connected via USB)
- R307 Fingerprint Sensor (wired to GPIO β see hardware_wiring.md)
- Ethernet or WiFi connection
- SSH access enabled
- Download Raspberry Pi Imager from raspberrypi.com
- Select Raspberry Pi OS (64-bit) β Lite or Desktop
- Flash to your microSD card
- Before ejecting, configure WiFi and enable SSH in Imager settings
# Connect via SSH
ssh pi@<your-pi-ip>
# Update system
sudo apt-get update && sudo apt-get upgrade -y
# Install Git
sudo apt-get install -y git
# Clone ClassOS
git clone https://github.com/yourusername/ClassOS.git /opt/ClassOS
cd /opt/ClassOSThe easiest way to deploy is using the provided script:
chmod +x scripts/deploy_pi.sh
./scripts/deploy_pi.shThis script will:
- Update system packages
- Verify USB webcam is detected
- Enable UART for fingerprint sensor
- Install Docker & Docker Compose
- Download AI model weights (YOLOv8n)
- Build and start all Docker services
If you prefer manual steps:
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USER
# Log out and back in# Verify USB webcam is connected
ls -la /dev/video*
lsusb # should show your webcam
# Edit boot config (for UART / fingerprint sensor)
sudo nano /boot/firmware/config.txt
# Add these lines:
enable_uart=1
dtoverlay=uart0
# Disable serial console
sudo systemctl disable serial-getty@ttyS0.service
# Reboot
sudo rebootcd /opt/ClassOS
cp .env.example .env
nano .env
# Key settings to update:
# - Set CAMERA_DEVICE_INDEX=0 (or the index of your USB webcam)
# - Set FINGERPRINT_MOCK_MODE=false (use real sensor)
# - Change JWT_SECRET_KEY and SECRET_KEY to random strings
# - Change POSTGRES_PASSWORD# Build and start all services
docker compose up -d --build
# Watch logs
docker compose logs -f
# Verify all services are running
docker compose ps# All services should show "Up"
docker compose ps
# Expected output:
# classos-db running 0.0.0.0:5432->5432
# classos-backend running 0.0.0.0:8000->8000
# classos-frontend running 80/tcp
# classos-nginx running 0.0.0.0:80->80# Health check
curl http://localhost/api/health
# Should return:
# {"status":"healthy","app":"ClassOS","version":"1.0.0","environment":"production"}Open a browser and navigate to:
http://<raspberry-pi-ip>
Login with default credentials:
- Email: admin@classos.local
- Password: changeme123
β οΈ Change the default admin password immediately!
For Docker to access the USB webcam and fingerprint sensor, uncomment these lines in docker-compose.yml:
backend:
devices:
- /dev/video0:/dev/video0 # USB Webcam
- /dev/ttyS0:/dev/ttyS0 # R307 UART
privileged: trueThen restart:
docker compose down
docker compose up -ddocker compose logs -f backend # Backend logs
docker compose logs -f db # Database logsdocker compose restart backendcd /opt/ClassOS
git pull
docker compose up -d --builddocker exec classos-db pg_dump -U classos classos_db > backup_$(date +%Y%m%d).sqlcat backup.sql | docker exec -i classos-db psql -U classos classos_dbThe Pi 5 with 8GB RAM can handle ClassOS comfortably. Recommended optimizations:
| Setting | Value | Reason |
|---|---|---|
CAMERA_FPS |
30 | Most USB webcams support 30fps at 720p |
HEAD_COUNT_INTERVAL |
5 | Run YOLO every 5th frame to save CPU |
DB_POOL_SIZE |
5 | Adequate for single-classroom use |
YOLO_CONFIDENCE |
0.5 | Balance between detection and false positives |
Docker --workers |
1 | Single worker to avoid memory pressure |
| Symptom | Cause | Fix |
|---|---|---|
| Backend won't start | DB not ready | Check docker compose logs db |
| Camera feed black | Webcam not detected | Verify USB webcam with lsusb, check /dev/video0 exists |
| Fingerprint timeout | UART not enabled | Verify enable_uart=1, check wiring |
| Slow recognition | CPU overloaded | Reduce CAMERA_FPS, increase HEAD_COUNT_INTERVAL |
| Out of memory | Too many models | Use --workers 1, reduce DB_POOL_SIZE |