Skip to content

metkelhansen/Babyphone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Babyphone Logo

Babyphone

Open-source baby monitor built with Raspberry Pi, real-time streaming, and a mobile app.

FeaturesArchitectureHardwareQuick StartAppFull Setup Guide

Pi Zero 2 W Camera Module 3 Wide WebRTC Expo FastAPI


What is this?

A self-hosted baby monitor that you build yourself — no cloud, no subscription, no creepy third-party servers watching your kid. Everything runs on your own hardware, in your own network.

Put a Raspberry Pi Zero 2 W with a camera in your baby's room. Watch the live stream from your phone — at home or remotely through WireGuard VPN. Get notified when there's motion or sound.

Why not just buy one? Commercial baby monitors are either expensive, cloud-dependent, or both. This project gives you full control: you own the hardware, the software, and the data. Plus, it's a fun build.


Features

Feature Details
Live Stream Low-latency video via WebRTC or MJPEG 720p @ 15fps, works in-app and browser
Motion Detection Edge-processed on Pi Zero No cloud needed, instant alerts
Audio Monitoring USB microphone support Sound level detection + alerts
Push Notifications Firebase Cloud Messaging Get notified on your phone instantly
Event History Thumbnails + clips stored on Pi 5 Browse past events in the app
Remote Access WireGuard VPN Watch from anywhere, fully encrypted
Self-Hosted Everything on your own hardware No cloud, no subscription, no data leaving your network

Architecture

┌─────────────────────────────────────────────────────────────────┐
│  Baby's Room                                                    │
│                                                                 │
│  ┌──────────────────────────┐                                   │
│  │  Raspberry Pi Zero 2 W   │                                   │
│  │                          │                                   │
│  │  Camera Module 3 Wide    │──── go2rtc (host service)         │
│  │  USB Microphone          │──── Edge Agent (Docker)           │
│  └──────────────────────────┘                                   │
│           │ WebRTC/RTSP                │ HTTP                   │
└───────────┼────────────────────────────┼────────────────────────┘
            │ LAN / WireGuard            │
┌───────────┼────────────────────────────┼────────────────────────┐
│  Server   ▼                            ▼                        │
│  ┌──────────────────────────────────────────────────────┐       │
│  │  Raspberry Pi 5  (Docker)                            │       │
│  │                                                      │       │
│  │  FastAPI ── PostgreSQL ── Redis ── Push Worker        │       │
│  └──────────────────────────────────────────────────────┘       │
│           │                                                     │
└───────────┼─────────────────────────────────────────────────────┘
            │ LAN / WireGuard
┌───────────┼─────────────────────────────────────────────────────┐
│  Phone    ▼                                                     │
│  ┌──────────────────────────────────────────────────────┐       │
│  │  React Native App (Expo)                             │       │
│  │                                                      │       │
│  │  Live Stream ── Events ── Settings ── Push           │       │
│  └──────────────────────────────────────────────────────┘       │
└─────────────────────────────────────────────────────────────────┘

Hardware

What you need

Part Model Notes
Single-board computer Raspberry Pi Zero 2 W The camera unit. Tiny, low-power, Wi-Fi built-in.
Camera Raspberry Pi Camera Module 3 Wide IMX708 sensor, 120° wide-angle, autofocus, HDR. Perfect for a baby room.
Case Pi Zero Case with Cam Mount 3D-printed case that holds the Pi Zero + Camera Module. Print it yourself or order one.
Microphone Any USB microphone For sound detection. A cheap USB mic works fine.
Server Raspberry Pi 5 (or any Linux box) Runs the backend. Can be shared with other services (Pi-hole, etc.).
MicroSD card 16 GB+ For the Pi Zero. 32 GB recommended.
Power supply USB-C 5V/3A For the Pi Zero.

3D-Printed Case

The camera unit fits in a compact 3D-printed case that mounts the Pi Zero 2 W together with the Camera Module 3:

Print it: MakerWorld — Raspberry Pi Zero Case with Cam

No 3D printer? Order a print from a local maker space or use an online printing service.


Tech Stack

Component Technology
Camera Streaming go2rtc — WebRTC, RTSP, MJPEG
Edge Agent Python — motion detection, audio monitoring, event reporting
Backend API FastAPI — async Python, auto-generated docs
Database PostgreSQL 16 — users, devices, events
Task Queue Redis 7 — push notification queue
Mobile App React Native + Expo — Android (iOS possible)
VPN WireGuard — remote access (optional)
Containers Docker Compose — backend + agent

Quick Start

Full step-by-step guide with screenshots: SETUP.md

1. Backend (on Pi 5 or any server)

git clone https://github.com/metkelhansen/Babyphone.git
cd Babyphone/backend
cp .env.example .env
# Edit .env → set strong passwords
docker compose up -d

2. Camera (on Pi Zero 2 W)

git clone https://github.com/metkelhansen/Babyphone.git ~/babyphone
cd ~/babyphone/pi-zero

# Install go2rtc as host service (camera needs native access)
nano stream/go2rtc.yaml          # Set your Pi Zero's IP
chmod +x stream/install-go2rtc.sh
./stream/install-go2rtc.sh

# Start edge agent
cp .env.example .env
nano .env                         # Set backend URL + pairing code
docker compose up -d

3. App (on your phone)

cd Babyphone/app
npm install
npx expo start
# Scan QR code with Expo Go on your phone

App

The mobile app is built with React Native and Expo. It connects directly to the Pi Zero for live video and to the backend for events and settings.

Screens:

  • Live View — real-time camera stream (WebRTC or MJPEG fallback)
  • Events — timeline of motion/sound events with thumbnails
  • Settings — device management, pairing, notification preferences

Project Structure

Babyphone/
├── app/                    # React Native / Expo mobile app
│   ├── app/                # Screens (Expo Router)
│   ├── components/         # Reusable UI components
│   └── lib/                # API client, state management, config
│
├── backend/                # Runs on Pi 5 (Docker)
│   ├── api/                # FastAPI application
│   │   ├── models/         # SQLAlchemy models (User, Device, Event)
│   │   ├── routers/        # API endpoints
│   │   ├── services/       # Business logic (auth, push, storage)
│   │   └── worker/         # Background push notification worker
│   └── docker-compose.yml  # PostgreSQL + Redis + API + Worker + Adminer
│
├── pi-zero/                # Runs on Pi Zero 2 W
│   ├── agent/              # Edge agent (Docker) — motion, audio, events
│   ├── stream/             # go2rtc config + install script (host service)
│   └── docker-compose.yml  # Agent container only
│
├── SETUP.md                # Detailed setup guide (step-by-step)
└── README.md               # This file

FAQ

Can I use a different Raspberry Pi model? Yes. Any Pi with a CSI camera port works for the camera unit (Pi 3, Pi 4, Pi 5). The Pi Zero 2 W is ideal because it's small, cheap, and quiet. The backend can run on any Linux machine.

Does it work with only one Raspberry Pi? Yes. You can run everything on a single Pi (camera + backend). Just run both Docker Compose files on the same device and use localhost as the backend URL.

Can I access the stream from outside my home? Yes, using WireGuard VPN. Set up a VPN tunnel between your phone and your home network. The setup guide covers this.

Does this affect other services on my Pi 5? No. The backend runs in Docker containers on ports 8000 and 8888. Services like Pi-hole (port 53/80) or rspamd are completely unaffected.

Is the video stored in the cloud? No. Everything stays on your hardware. Event clips are stored on the Pi 5's local storage. Nothing leaves your network unless you set up remote access yourself.


License

This project is open source. Built with love for parents who want privacy and control.

About

Babycam App + Raspberry Pi Streaming & Events (MVP)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors