Skip to content

Zedstron/babymonitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

34 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿผ BabyGuard โ€” Smart Raspberry Pi Baby Monitor

BabyGuard Banner


๐Ÿš€ Overview

BabyGuard is a Raspberry Piโ€“powered smart baby monitoring system built using FastAPI + WebRTC for ultra-low latency streaming.

โœ” Works over LAN + WAN
โœ” Designed for real-time monitoring + interaction
โœ” Lightweight, self-hosted, privacy-first โœ” Can Control Infrared Devices


โœจ Features

๐ŸŽฅ Monitoring

  • Live camera feed (Pi Camera optional)
  • Live microphone streaming (optional)
  • WebRTC ultra-low latency

๐ŸŒก๏ธ Environment

  • Temperature & humidity monitoring
  • Outside weather integration

๐ŸŽ™๏ธ Interaction

  • Push to TALK
  • Media Player for child soothing
  • White Noise for Sleep

๐Ÿ’ก Hardware

  • LED Indicator (via GPIO)
  • Temp/Humid Sensor (via GPIO)
  • Buzzer indicator (via GPIO)
  • Microphone Support (via USB)
  • Camera Module (via CSI Port)
  • TSOP Receiver for IR Learning (via GPIO)
  • IR Sender LED (via GPIO)

๐Ÿ“Š System Monitoring

  • CPU, RAM, disk, network stats
  • Full Raspberry Pi health dashboard

๐ŸŽž๏ธ Media

  • Video recording
  • Playback interface
  • Snapshot capture + gallery

๐Ÿ” Security

  • JWT Authentication

๐Ÿ“ธ Screenshots

Main Interaction Dashboard

Mediaplayer & Snapshots Gallery

Resource Usage Tracking


๐Ÿง  Architecture (WAN Setup)

Wireguard Secure VPN & Caddy Reverse Proxy Config

๐Ÿ”— Flow

  1. Client connects via domain โ†’ Caddy (TLS termination)
  2. Caddy reverse proxies to backend
  3. WireGuard tunnel connects VPS โ†’ Home network (Private Secure VPN)
  4. Raspberry Pi (behind NAT) streams via WebRTC

๐Ÿ”Œ GPIO & Hardware Guidelines

Note: All components are recommended for the best experience, but none are mandatory. If you omit a specific part (e.g., IR sender/receiver or mic/camera), only that specific functionality will be unavailable. Everything else will work seamlessly.

CSI Camera Module

GPIO Pinout Details

Components Schematic Diagram

  • LED Indicator wiring (GPIO pins)
  • DHT22/DHT11 (Temp/Humidity) (GPIO pins)
  • Piezo Buzzer (GPIO pins)
  • Speakers integration (3.5mm Audio Jack)
  • Microphone integration (USB port 2.0 or 3.0)
  • Camera module (CSI camera port)
  • TSOP IR Reciver sensor (GPIO pins)
  • IR sender sensor (GPIO pins)

Automatic installation is recommended hence there are mnay steps involved installing system wide global packags and setting up proper boot service and other optimizations e.g. enabling/disabling other required hardware capablitities & features, the included setup.sh script takes care of this automatically.

๐Ÿ› ๏ธ Automatic Installation (Recommended)

1. Clone

git clone https://github.com/Zedstron/babymonitor
cd babymonitor

2. Run Setup

sudo chmod +x setup.sh
sudo ./setup.sh

Or if automatic installation isn't working for you, or crashes or packages broken or any thing in general go wrong try following Manual minimal steps.

๐Ÿ› ๏ธ Manuall Installation

1. Clone

git clone https://github.com/Zedstron/babymonitor
cd babymonitor

2. Update & Upgrade APT repo

sudo apt update -y
sudo apt upgrade -y

3. Virtual Env

python3 -m venv venv
source venv/bin/activate

4. Install Packages

Install Python Packages

pip install -r requirements.txt

Install System Deps:

sudo apt install -y $(cat packages.txt)

5. ENV File

Create the .env file with nano or any text editor of your choice and place following variables

JWT_SECRET="any alphanumeric strong random value for JWT"
WEATHER_API_KEY="optional key for current latest weahter"

Note: Obtain a weather API key at https://home.openweathermap.org/users/sign_in just in case if you are interested in this feature

6. SSL

Generate certificates for https, since for PTT to work we cannot access microphone in browser from http, permission won't be allowed

mkdir cert
cd cert
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365 -nodes

โ–ถ๏ธ Run

python main.py

An experimental Docker image is published to Docker Hub. This method is NOT Recommended for production and is provided for quick testing only.

โš ๏ธ Docker (Experimental)

Before running the container, ensure a .env file exists in the project root containing at minimum a JWT_SECRET. You may also include an optional WEATHER_API_KEY (if omitted, external weather won't be available). You can obtain a weather API key at https://home.openweathermap.org/users/sign_in

Pull the image from Docker Hub:

docker pull zedstron/babyguard

Example run (reads variables from .env):

docker run --env-file .env -p 443:443 zedstron/babyguard

๐Ÿ”ฎ Roadmap

  • Cry detection (AI)
  • Occupancy detection (Vision or Motion Sensor)
  • Push notifications
  • Facial emotions detection e.g. not feeling comfortable
  • Baby heavy movement e.g. moving outside crib
  • Converting FE side to React/Angular

๐Ÿค Contributing

PRs Welcom