How I Built an Handmade Camera

mar 3 nov 2026

How I Built an Handmade Camera

How I Built an Handmade Camera

Why buy an IP camera when you have a Raspberry Pi Zero W sitting in a drawer since 2017?

The idea is simple: the Pi Zero W streams video over Wi-Fi like any IP camera, and Home Assistant, running on my Raspberry Pi 5, picks up the stream and shows it on the dashboard.

What you need:

  • Raspberry Pi Zero W (2017)
  • Raspberry Pi Camera Module 3
  • A 15 → 22 pin ribbon cable
  • A micro-USB 5 V 2.5 A power supply
  • A microSD card

1. Connect the camera (with the Pi turned off)

Each connector has a small dark latch on the front. Pull it forward by 1–2 mm — fingernails or a toothpick on both sides work great — slide the cable in, then push the latch back in to lock it.

  • The wide end of the cable goes into the camera, with the metal contacts facing the camera board: with the lens pointing up, the contacts face up.
  • The narrow end goes into the Pi Zero, with the contacts facing the board: with the components on top, the contacts face the table.

Get this wrong and the camera simply won't show up later — so double check before powering on.

2. Prepare the microSD

You need Raspberry Pi Imager 2.0 or newer. The 1.9 version shipped in Ubuntu's packages writes the card without Wi-Fi or user, because it can't configure current images (they use cloud-init). Grab the Linux build from raspberrypi.com/software and run it:

chmod +x imager_*.AppImage
./imager_*.AppImage
# if FUSE is missing:
sudo apt install libfuse2t64

In the Imager:

  • Device: Raspberry Pi Zero — not Zero 2 W
  • OS: Raspberry Pi OS (other) → Raspberry Pi OS Lite (32-bit)
  • Storage: the microSD (check the size, you don't want to wipe the wrong disk!)

In the customization pages always press Next, never Skip:

  • hostname camera
  • timezone and keyboard layout
  • a user with a password you'll actually remember
  • your Wi-Fi network, with Hidden SSID unchecked and the right country code
  • SSH enabled with your public key (~/.ssh/id_ed25519.pub)
  • Raspberry Pi Connect disabled

Once writing is done, remove and reinsert the card and verify the network config was really written:

grep -i "YOUR-SSID\|regulatory" /media/$USER/bootfs/network-config

Both your network and the country code must appear without a # in front of them.

3. First boot

Put the microSD in the Pi Zero and plug the power supply into the PWR IN port — the one closest to the corner. The green LED should turn on: if it stays off, the microSD is almost always missing or wasn't written correctly.

The first boot can take 10–15 minutes. Be patient. To find the Pi on the network:

sudo nmap -sn 192.168.1.0/24

Look for a MAC address starting with B8:27:EB (Raspberry Pi Foundation) and the name camera.lan. Then connect:

ssh <user>@camera.lan

camera.local may not answer, while .lan is provided directly by the router.

4. Check the camera and update

rpicam-hello --list-cameras

It must show the imx708 sensor. If it says "No cameras available", shut the Pi down and check the cable orientation again (told you!).

Then update the system:

sudo apt update && sudo apt full-upgrade -y

5. Install MediaMTX

MediaMTX is the piece that turns the Pi into a real streaming server. The Pi Zero W has an old ARMv6 CPU, so we need the ARMv6 build. From the SSH session on the Pi:

cd ~
VER=$(curl -s https://api.github.com/repos/bluenviron/mediamtx/releases/latest | grep -o '"tag_name": *"[^"]*"' | cut -d'"' -f4)
echo $VER
wget https://github.com/bluenviron/mediamtx/releases/download/${VER}/mediamtx_${VER}_linux_armv6.tar.gz
mkdir -p mediamtx && tar -xzf mediamtx_${VER}_linux_armv6.tar.gz -C mediamtx
sudo mv mediamtx/mediamtx /usr/local/bin/
sudo mkdir -p /usr/local/etc && sudo cp mediamtx/mediamtx.yml /usr/local/etc/mediamtx.yml.orig
mediamtx --version

6. Configure the stream

The Pi Zero is not exactly a powerhouse, so I keep things light: RTSP only, 1280×720 at 15 fps.

sudo tee /usr/local/etc/mediamtx.yml > /dev/null <<'CONF'
rtsp: yes
rtmp: no
hls: no
webrtc: no
srt: no

paths:
  cam:
    source: rpiCamera
    rpiCameraWidth: 1280
    rpiCameraHeight: 720
    rpiCameraFPS: 15
    rpiCameraBitrate: 1500000
CONF

Test it:

mediamtx /usr/local/etc/mediamtx.yml

You should see using hardware H264 encoder and stream is available and online. From your laptop open rtsp://camera.lan:8554/cam in VLC (Media → Open Network Stream), and enjoy your first frames. Stop the test with Ctrl+C.

7. A 3D-printed case

A bare board with a ribbon cable hanging around isn't exactly something you want on a shelf. So I 3D printed a case that holds both the Pi Zero W and the Camera Module 3: the lens peeks out from the front and the power cable comes out from the side.

A few hours later, here's the result:

Now it looks like an actual product, not a science experiment. 😄


And that's it: a camera built from spare parts and a 3D-printed case, streaming over Wi-Fi, ready to be plugged into Home Assistant.

Not bad for a board that spent years in a drawer. 📷