OAK-D Cameras · Raspberry Pi · Discord Bots
SVA MFA Interaction Design · Winter 2026
~20–30 min first-time setup
.env file on the PiRecommended starting points: Fatigue Detection or Gaze Estimation
Your Laptop LOCAL
GitHub repo lives here.
Edit code here.
Raspberry Pi REMOTE
Camera + venv live here.
Run scripts here.
hostname and press Enter to see which machine you're on.
Bottom line: Edit on laptop → copy to Pi → run on Pi. Repeat.
Already configured on each Pi
/opt/oak-shared/venv/What you need to do
.env
Test your SSH config from your local terminal:
If it connects, you're good! If not:
From your laptop terminal (not the Pi!):
# Navigate to your local repo
cd ~/path/to/smart-objects-cameras
# Fatigue detection (recommended)
scp fatigue_detector.py orbit:~/oak-projects/
scp -r utils orbit:~/oak-projects/
scp -r depthai_models orbit:~/oak-projects/
scp discord_notifier.py orbit:~/oak-projects/
scp discord_dm_notifier.py orbit:~/oak-projects/
Replace orbit with gravity or horizon as needed.
If you have VS Code with the Remote-SSH extension:
SSH in, then check if .env already exists:
If it exists
Camera bot tokens are set. Optionally add your DM bot token:
nano ~/oak-projects/.env
# Add at the bottom:
DISCORD_USER_ID=your_id
DISCORD_DM_BOT_TOKEN=your_token
If it doesn't exist
Your instructor will share tokens via 1Password. Create the file:
nano ~/oak-projects/.env
# Paste tokens from instructor
chmod 600 ~/oak-projects/.env
Never commit .env to GitHub!
Every time you start working on the Pi:
# Activate the shared virtual environment
activate-oak
# Navigate to your project folder
cd ~/oak-projects
# Run a detector!
python3 fatigue_detector.py --display
(venv) appear before your prompt after activate-oak.
Flags are optional settings that change how scripts run:
| Flag | What It Does | Example |
|---|---|---|
--display |
Show live video window | python3 gaze_detector.py --display |
--log |
Save events to a log file | python3 fatigue_detector.py --log |
--discord |
Post to Discord class channel | python3 person_detector*.py --discord |
--threshold |
Detection sensitivity (0.0–1.0) | ... --threshold 0.7 |
Combine them: python3 fatigue_detector.py --display --log
--displayUse --display when:
Don't use when:
Instead: run without --display, use Discord or logs to monitor.
Monitors eye aspect ratio (EAR) to detect drowsiness. Uses your personal DM bot.
With display (VNC/monitor):
activate-oak
cd ~/oak-projects
python3 fatigue_detector.py --display
Press 'q' to quit.
Without display (SSH only):
activate-oak
cd ~/oak-projects
python3 fatigue_detector.py
Press Ctrl+C to stop. Check Discord DMs.
Detects where someone is looking. Outputs gaze direction to the terminal.
activate-oak
cd ~/oak-projects
python3 gaze_detector.py --display # with video window
python3 gaze_detector.py # terminal only
Uses the class camera bots (OrbitBot, GravityBot, HorizonBot) — not your personal DM bot.
activate-oak && cd ~/oak-projects
python3 person_detector_with_display.py --display # with video
python3 person_detector_with_display.py # headless
python3 person_detector_with_display.py --discord # + class channel
Bot commands in Discord:
!ping !status !screenshot !detect
| What You Want | Window 1 | Window 2 |
|---|---|---|
| Fatigue + personal DMs | python3 fatigue_detector.py --display |
python3 discord_dm_notifier.py |
| Gaze estimation | python3 gaze_detector.py --display |
not needed |
| Person + personal DMs | python3 person_detector*.py |
python3 discord_dm_notifier.py |
| Person + class channel | python3 person_detector*.py --discord |
not needed |
A running script blocks its terminal. If you need a detector and your DM bot at the same time, you need two windows — each SSH'd into the Pi.
Window 1 — Detector
Window 2 — DM Bot
Stop each with Ctrl+C in its own window.
Mac
Cmd+T new tabCmd+N new window
Windows
Click + for a new tab
or open another window
VS Code
Click + in terminal panel
or click the split icon
activate-oak first.
source ~/.bashrc then try again.
hostname to check)ls ~/oak-projects/)utils/ folder? (-r flag for folders)depthai_models/?Wrong
Correct
After copying files, your ~/oak-projects/ on the Pi:
~/oak-projects/
├── fatigue_detector.py # Main detector script
├── utils/ # Helper modules
│ └── face_landmarks.py
├── depthai_models/ # Model YAML configs
│ ├── yunet.RVC2.yaml
│ └── mediapipe_face_landmarker.RVC2.yaml
├── discord_notifier.py # Webhook helper
├── discord_dm_notifier.py # Your personal DM bot
└── .env # Your tokens (never commit!)
Python packages live in /opt/oak-shared/venv/ (shared by everyone).
| Detector | Files to Copy | Notes |
|---|---|---|
| Fatigue | fatigue_detector.py, utils/, depthai_models/,discord_notifier.py, discord_dm_notifier.py |
Recommended! Uses DM bot |
| Gaze | gaze_detector.py, utils/, depthai_models/ |
Terminal output only |
| Person | person_detector_with_display.py,discord_notifier.py |
Uses class camera bots |
| DM Bot | discord_dm_notifier.py |
Add token to .env |
scp it to the Pi again! The Pi has the old version until you copy the new one.
Detection threshold
# More sensitive (more false positives)
python3 person_detector*.py --threshold 0.3
# Less sensitive (fewer false positives)
python3 person_detector*.py --threshold 0.7
# Default is 0.5
Logging & headless
# Save events to a log file
python3 fatigue_detector.py --log
# Run headless + monitor via Discord
python3 person_detector*.py --discord
# Then use !screenshot in Discord
Install once on your laptop:
# Install Claude Code
curl -fsSL https://cli.anthropic.com/install.sh | sh
# Verify
claude --version
Then use it from your project directory:
Example:
You: How does the person detection
pipeline work?
You: Modify the detector to also
detect cars. Create a new file
called person_detector_alice.py
You: I'm getting this error: [paste]
Do
Don't
person_detector_yourname.py instead of editing the original.
You can always compare your version to the reference!
Stuck? Ask your instructor or use claude from your project directory.