{"id":29961760,"url":"https://github.com/gabrielahn/dogo-cam-project","last_synced_at":"2025-10-25T12:45:05.563Z","repository":{"id":305480870,"uuid":"1022985308","full_name":"gabrielAHN/dogo-cam-project","owner":"gabrielAHN","description":"A raspberry Dog Cam for checking out a video of a dog, and temperature the area.","archived":false,"fork":false,"pushed_at":"2025-07-28T10:31:07.000Z","size":9174,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-28T11:27:34.276Z","etag":null,"topics":["flask","gunicorn","raspberry-pi"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gabrielAHN.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-20T09:25:17.000Z","updated_at":"2025-07-28T10:38:54.000Z","dependencies_parsed_at":"2025-07-28T11:39:43.300Z","dependency_job_id":null,"html_url":"https://github.com/gabrielAHN/dogo-cam-project","commit_stats":null,"previous_names":["gabrielahn/dog-kotaro-cam","gabrielahn/dogo-cam-project"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gabrielAHN/dogo-cam-project","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielAHN%2Fdogo-cam-project","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielAHN%2Fdogo-cam-project/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielAHN%2Fdogo-cam-project/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielAHN%2Fdogo-cam-project/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gabrielAHN","download_url":"https://codeload.github.com/gabrielAHN/dogo-cam-project/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielAHN%2Fdogo-cam-project/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268629811,"owners_count":24281172,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-03T02:00:12.545Z","response_time":2577,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flask","gunicorn","raspberry-pi"],"created_at":"2025-08-03T23:42:21.121Z","updated_at":"2025-10-25T12:45:00.520Z","avatar_url":"https://github.com/gabrielAHN.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dogo Cam Project 🐶\n\nThis project sets up a Raspberry Pi 3 to stream live video from a camera module (e.g., for monitoring a pet like a dog) and display environmental temperature/humidity data from a sensor.\n\n![raspberry-pi-image](https://github.com/gabrielAHN/dogo-cam-project/blob/main/img/raspberry-pi-cam.png?raw=true)\n\nThe stream is accessible via a web interface with basic authentication, limited to a maximum of 3 concurrent viewers. It uses Flask for the web app, Picamera2 for video, and Adafruit libraries for the sensor.\n\n![Dog View](https://github.com/gabrielAHN/dogo-cam-project/blob/main/img/dog-stream.png?raw=true)\n\nDependencies are managed with UV via a `pyproject.toml` file. The app runs on boot using systemd, and optionally, you can expose it securely via Cloudflare Tunnel (also boot-enabled).\n\n## Prerequisites\n- [Raspberry Pi 3](https://www.amazon.com/Raspberry-Pi-Model-Board-Plus/dp/B0BNJPL4MW?sr=8-1) with [Raspberry Pi OS (64-bit recommended)](https://www.raspberrypi.com/software/operating-systems/).\n- [Picamera Module V3 (or compatible) connected and enabled](https://www.amazon.com/Arducam-Raspberry-Camera-Autofocus-15-22pin/dp/B0C9PYCV9S?sr=8-1).\n- [OSOYOO DHT22 (or standard DHT22) temperature/humidity sensor](https://www.amazon.com/Gowoops-Temperature-Humidity-Measurement-Raspberry/dp/B073F472JL?sr=8-1).\n- (OPTIONAL) A domain with DNS hosted (e.g., via AWS Route 53) for remote access—use a placeholder like `your-domain.com`.\n- Basic tools: Git, Python 3.12+.\n\n## Hardware Setup\n\n### 1. Connect the Camera Module\n- Attach the Picamera V3 to the Raspberry Pi's CSI port.\n- Enable the camera: Run `sudo raspi-config`, navigate to Interface Options \u003e Camera \u003e Enable, then reboot.\n- Test: Run `libcamera-hello` in terminal—if you see a preview, it's working.\n\n### 2. Connect the DHT22 Sensor\n- Wiring (using GPIO pins; power off Pi before connecting):\n\n| Sensor Pin | Raspberry Pi Physical Pin | Function | Notes |\n|------------|---------------------------|----------|-------|\n| VCC | Pin 1 | 3.3V Power | Supplies power to the sensor. Although the manufacturer's tutorial suggests connecting to 5V (Pi Pin 2 or 4), using 3.3V is safer and recommended to prevent potential voltage mismatch that could damage the Pi's GPIO pins. The sensor operates fine at 3.3V. |\n| Data | Pin 7 | GPIO4 | The data signal pin. GPIO4 is commonly used in tutorials, but you can choose any available GPIO pin and adjust your code accordingly. |\n| GND | Pin 6 (or Pin 9) | Ground | Completes the circuit. Pin 6 is adjacent for easier wiring without crossing wires much. |\n\n- Add a 4.7kΩ-10kΩ pull-up resistor between VCC and Data pins for signal stability.\n- Test: After software setup, run a simple script to verify readings (see Software Installation).\n\n## Software Installation\n\n### 1. Raspberry Pi APT Installs\n- Update system and install required packages for GPIO, camera, and monitoring:\n  ```\n  sudo apt update \u0026\u0026 sudo apt upgrade -y\n  sudo apt install libgpiod2 libcamera-apps-lite python3-picamera2 htop -y\n  ```\n\n### 2. Install UV (Package Manager)\n- UV is used for faster dependency management. Install globally:\n  ```\n  curl -LsSf https://astral.sh/uv/install.sh | sh\n  ```\n- If installed via pipx, path might be `~/.local/bin/uv`—add to PATH if needed: `echo 'export PATH=\"$HOME/.local/bin:$PATH\"' \u003e\u003e ~/.bashrc \u0026\u0026 source ~/.bashrc`.\n\n### 3. Set Up the Project\n- Clone the project repository:\n  ```\n  git clone https://github.com/gabrielAHN/dogo-cam-project.git\n  cd dogo-cam-project\n  ```\n- Create `.env` for secrets (do not commit to Git):\n  ```\n  BASIC_AUTH_USERNAME=your_username\n  BASIC_AUTH_PASSWORD=your_password\n  MAX_VIEWERS=3\n  PORT=5000\n  ```\n\n### 4. Manage Dependencies with `pyproject.toml`\n- Create `pyproject.toml` in the project root:\n  ```\n  [project]\n  name = \"dog-cam-stream\"\n  version = \"0.1.0\"\n  requires-python = \"\u003e=3.12\"\n\n  [tool.uv]\n  dependencies = [\n      \"flask\",\n      \"flask-httpauth\",\n      \"picamera2\",\n      \"python-dotenv\",\n      \"adafruit-circuitpython-dht\",\n      \"adafruit-blinka\",\n      \"gunicorn\",  # For production server\n  ]\n  ```\n- Sync dependencies (creates/manages venv):\n  ```\n  uv sync\n  ```\n\n### 5. Application Code\n- Main file: `dogcam_stream.py` (Flask app with streaming, auth, sensor reads—code as per your setup).\n- Template: `templates/index.html` (HTMX for dynamic temp/humidity display).\n- Test locally: `uv run gunicorn --worker-class gthread --workers 1 --threads 4 --bind 0.0.0.0:5000 dogcam_stream:app`\n  - Access `http://your-pi-ip:5000` (e.g., `http://192.168.1.100:5000`), enter auth creds.\n\n## Setting Up on Boot (Systemd Service)\n\n### 1. Create the Service File\n- Edit `/etc/systemd/system/dog-stream.service` (use a generic name; sudo required):\n  ```\n  [Unit]\n  Description=Dog Stream Flask App\n  After=network.target\n\n  [Service]\n  User=your-user\n  WorkingDirectory=/home/your-user/dogo-cam-project\n  EnvironmentFile=/home/your-user/dogo-cam-project/.env\n  ExecStart=/home/your-user/.local/bin/uv run gunicorn --worker-class gthread --workers 1 --threads 4 --bind 0.0.0.0:5000 dogcam_stream:app\n  Restart=always\n  RestartSec=10\n  LimitNOFILE=4096\n  OOMScoreAdjust=-1000\n\n  [Install]\n  WantedBy=multi-user.target\n  ```\n- Reload and enable:\n  ```\n  sudo systemctl daemon-reload\n  sudo systemctl enable --now dog-stream.service\n  ```\n- Check: `sudo systemctl status dog-stream.service`—should be active.\n\n## Optional: Cloudflare Tunnel Setup for Remote Access\nExpose the local app securely to your domain (e.g., `your-domain.com`) without port forwarding. Cloudflare handles HTTPS and DNS (delegate nameservers from your hosted zone provider like AWS Route 53).\n\n### 1. Install Cloudflared\n- Download for ARM: `wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-arm -O cloudflared`\n- Make executable and move: `chmod +x cloudflared \u0026\u0026 sudo mv cloudflared /usr/local/bin/`\n\n### 2. Authenticate and Create Tunnel\n- Log in: `cloudflared tunnel login`\n- Create: `cloudflared tunnel create dog-stream-tunnel`\n- Config file (`~/.cloudflared/config.yml`):\n  ```\n  tunnel: dog-stream-tunnel\n  credentials-file: /home/your-user/.cloudflared/\u003ctunnel-uuid\u003e.json\n  ingress:\n    - hostname: your-domain.com\n      service: http://localhost:5000\n    - service: http_status:404\n  ```\n- Run manually: `cloudflared tunnel run dog-stream-tunnel`\n\n### 3. DNS Setup\n- In Cloudflare Dashboard: Add site \u003e Enter `your-domain.com` \u003e Update nameservers in your hosted zone (e.g., AWS Route 53) to Cloudflare's.\n- Add CNAME: Name `@` (root), Target `\u003ctunnel-uuid\u003e.cfargotunnel.com`, Proxied (orange cloud).\n\n### 4. Boot Setup for Tunnel (Systemd Service)\n- Create `/etc/systemd/system/cloudflared.service`:\n  ```\n  [Unit]\n  Description=Cloudflare Tunnel for Dog Stream\n  After=network.target\n\n  [Service]\n  User=your-user\n  ExecStart=/usr/local/bin/cloudflared tunnel --config /home/your-user/.cloudflared/config.yml run dog-stream-tunnel\n  Restart=always\n  RestartSec=10\n\n  [Install]\n  WantedBy=multi-user.target\n  ```\n- Enable: `sudo systemctl enable --now cloudflared.service`\n- Check: `sudo systemctl status cloudflared.service`\n\n## Troubleshooting\n- Camera not starting: Ensure enabled in `raspi-config`; test with `libcamera-hello`.\n- Sensor errors: Verify pull-up resistor; retry logic in code handles checksum issues.\n- Access issues: Check auth creds in `.env`; monitor logs with `journalctl -u dog-stream.service`.\n- Performance: On RPi 3, lower video resolution if CPU/RAM high (edit code: `{\"size\": (320, 240)}`).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabrielahn%2Fdogo-cam-project","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgabrielahn%2Fdogo-cam-project","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabrielahn%2Fdogo-cam-project/lists"}