Home Wireless
Published in

Home Wireless

A Tiny Sealed Raspberry Pi Webcam

CNC Spindle Cameras Part I

The Raspberry Pi Zero/Pi Camera V2 camera
Views of the Camera (Pi V2 Camera version)

Background

The Hardware

The version for USB cameras
The version with a Pi V2
Showing the insides

Design

Software

Software Installation / Walkthrough

  • Start by installing Raspberry Pi OS (32 bit). I used the Raspberry Pi imager app to make an SD card, which works well. Click the subtle gear icon bottom right and …
  1. Enable SSH
  2. Set up the WiFi SSID and password
  3. Set the hostname to a unique name. I use ZeroCam1, ZeroCam2, …
  4. Set the Locale to your country/timezone.
  5. Change the user name and password. Leaving the user as “pi” is asking for trouble.
  • Insert the SD card built by imager into the Pi Zero, wait for it to boot then SSH into it.
  • sudo raspi-config and
  1. in system set boot into desktop mode
  2. in display options set the VNC resolution. I use 1080P (1920x1080).
  3. in interface enable VNC if you use it. I do.
  4. in interface select your camera choice if you use the Raspberry Pi camera module.
  5. in performance options change the GPU memory to 96MB if using a Pi camera
  • I usually reboot and switch to VNC at this point.
  • Next install mjpg-streamer-experimental. This old fork of the really old mjpg-streamer adds support for native raspberry pi (now legacy) functionality. The github documentation is adequate.
git clone https://github.com/jacksonliam/mjpg-streamer.git
sudo apt-get install libjpeg-dev cmake gcc g++
cd mjpg-streamer/mjpg-streamer-experimental/
make
sudo make install
  • Finally, to test the program restart the console and use a script like this for a usb (uvc) camera. This script also works for the Raspberry Pi cameras if you’ve installed the legacy support, which has a uvc driver, although it’s maybe not optimal efficient.
export LD_LIBRARY_PATH=/usr/local/lib/mjpg-streamer
mjpg_streamer -o "output_http.so -w /usr/local/share/mjpg-streamer/www" -i "input_uvc.so -d /dev/video0"
  • Point a browser to Cameraip:8080.
Screen image of mjpg-streamer web site

Starting at power-on

sudo nano /lib/systemd/system/tinycam.service
sudo chmod 644 /lib/systemd/system/tinycam.service
[Unit]
Description=TinyCam Startup Script
After=multi-user.target
[Service]
Type=simple
ExecStart=/home/MyName/tinycam.sh
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable tinycam.service
#!/bin/sh -
# disable power management for wifi
iwconfig wlan0 power off
# run video server
export LD_LIBRARY_PATH=/usr/local/lib/mjpg-streamer
mjpg_streamer -o "output_http.so -w /usr/local/share/mjpg-streamer/www -p 80" -i "input_uvc.so -r 1280x720 -d /dev/video0"

Selecting the video device

mjpg_streamer -o "output_http.so -w /usr/local/share/mjpg-streamer/www -p 80" -i "input_uvc.so -r 1280x720 -d /dev/v4l/by-id/my-video-stream-id"

WiFi Performance

Making the Case

The Bottom

Bottom Model
Actual camera bottom with Pi Zero W2 — for external USB camera

Heat Dissipation

The Top

Camera Top (2 pieces)

--

--

Home automation in the wireless IOT era

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mark Zachmann

Entrepreneur, software architect, electrical engineer. Ex-academic.