Raspberry Pi Zero W Homebridge Camera

This is a combined set of instructions to install an Apple Home Kit compatible Raspberry Pi Camera v2 using Homebridge. I initially installed this using a Raspberry Pi 3 and then wanted to get it working on my Raspberry Pi Zero W to make it more compact. These instructions are specific  to Raspberry Pi Zero. If you want to install on a different Raspberry Pi, you need to determine the ARM version for your device. Then you need to download and install the correct Node.js version from their site. Use the “Linux Binaries (ARM)” distro and the correct ARM version. Other than that one change, all instructions below should work.

Install Raspbian on the Pi. Either desktop or lite version will work. These instructions assume that you have already done the normal Raspbian setup for locale, timezone, wifi, etc…

From a shell prompt, update the OS.

$ sudo apt-get update && sudo apt-get upgrade

Run the Raspberry Pi configuration and enable the Camera and SSH interfaces. Change the default password while you are at it.

Then install the camera hardware. (I am using the official Raspberry Pi Camera Camera V2.1)

$ nano /etc/modules

Add the following entry to the bottom of the file if it is missing.

# Camera with v4l2 driver

At this point you need to reboot the system.

$ shutdown -r now

Next we need to download and install Node.js and npm. Because we are using the Raspberry Pi Zero W, we need to install the armv6 version.

$ cd ~/
$ wget httpd://nodejs.org/dist/v8.11.1/node-v8.11.1-linux-armv6l.tar.xz
$ tar xf node-v8.11.1-linux-armv6l.tar.xz
$ sudo cp -R node-v8.11.1-linux-armv6l/* /usr/local/

Once this has been completed, run the following scripts to verify that everything is working.

$ node -v
$ npm -v

You can remove the downloaded node files if everything is working.

$ rm -fr ~/node-v8.11.1-linux-armv6l*

Now you can install Homebridge and the Raspberry Pi Camera plugin.

$ sudo apt-get update & sudo apt-get install libavahi-compat-libdnssd-dev ffmpeg
$ sudo npm install -g --unsafe-perm homebridge
$ sudo npm install -g homebridge-camera-rpi

From here, you can run the homebridge command to make sure that it starts up correctly.

$ homebridge

If you don’t get any errors then you can create the config.json file to setup the camera in homebridge. Create the following config.json file in the pi home directory.

$ nano ~/.homebridge/config.json

Then put this in the file.

    "bridge": {
        "name": "Homebridge",
        "username": "CC:22:3D:E3:CE:30",
        "port": 51826,
        "pin": "031-45-154"
    "description": "",
    "platforms": [
            "platform": "rpi-camera",
            "cameras": [{"name": "Front Door"}]

You can change the camera name to something other than “Front Door” depending on what you want to display in HomeKit.

To have Homebridge startup automagically, you can follow the instructions on this link to get that done. One note, when you create the homebridge user account to run the service, add the video user group to that account so it has permissions to the camera.

$ sudo usermod -a -G video homebridge


One response to “Raspberry Pi Zero W Homebridge Camera”

  1. Tiny typo in the .json config, there is a comma missing off the end of the “name”: “Homebridge” line. Also threw me that you can’t just scan the HomeBridge QR, you have to manually enter the code then select the Pi Cam. Other than that great tutorial saved me a lot of investigation. 😀

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.