Category Archives: General

Installing Homebridge and homebridge-camera-rpi on a Raspberry Pi Zero W

I finally started over from scratch with my Raspberry Pi Zero W and Camera Module V2. These are the steps I took to configure it with Homebridge as a Homekit-compatible camera.

Initial Pi Setup

  1. Using balenaEtcher, I installed the September 2019 version of Raspbian Buster Lite (link to latest release) on my SD card.
  2. I enabled ssh access by creating an empty file named ssh at the root of the SD card.
  3. To allow the Pi onto my home network, I created a file named wpa_supplicant.conf at the root of the SD card. The contents should be:

    country=US 
    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    network={
        ssid="YOUR_NETWORK_NAME"
        psk="YOUR_PASSWORD"
        key_mgmt=WPA-PSK
    }
    
  4. Then I inserted the SD card in the Pi, booted it up, found it’s IP address on my network (I used LanScan), and connected via ssh pi@<ipaddress>.

  5. It’s important to change the pi account password with the passwd command.
  6. I selected my time zone and set the locale to en_us.UTF-8 via sudo raspi-config.
  7. Finally, I updated the software with:

    sudo apt-get update
    sudo apt-get upgrade
    

Install Homebridge, homebridge-pi, and homebridge-camera-rpi

  1. Homebridge requires an installation of node.js, which, surprisingly, can’t be installed via apt on the Pi Zero. This command will install the most recent LTS version of node.js by running a script from node-pi-zero:

    wget -O - https://raw.githubusercontent.com/sdesalas/node-pi-zero/master/install-node-v.lts.sh | bash
    
  2. From Running Homebridge on a Raspberry Pi, Homebridge will require git to be installed:

    sudo apt-get install git
    
  3. Those instructions also indicate that avahi must be installed:

    sudo apt-get install libavahi-compat-libdnssd-dev
    
  4. Finally, we can actually install homebridge:

    sudo npm install -g homebridge
    
  5. As well as homebridge-pi (which will provide thermal measurements from the Pi in Homekit):

    sudo npm install -g homebridge-pi
    
  6. Before installing homebridge-camera-rpi (which will expose the camera to Homekit), we need to:

    • Activate the camera via raspi-config
    • Edit sudo nano /etc/modules and add the line bcm2835-v4l2
    • Reboot
    • Install ffmpeg: sudo apt install ffmpeg
  7. Then, we can install homebridge-camera-rpi:

    sudo npm install -g homebridge-camera-rpi
    
  8. And then setup the configuration file (~/.homebridge/config.json) to contain:

    {
      "bridge": {
        "name": "PiZeroHomebridge",
        "username": "CC:22:3D:E3:CE:30",
        "port": 51826,
        "pin": "031-45-154"
      },
    
      "description": "This is an example configuration file",
      "accessories": [
        {
          "accessory": "PiTemperature",
          "name": "Pi Zero Temperature"
        }
      ],
    
      "platforms": [
        {
          "platform": "rpi-camera",
          "cameras": [{"name": "Pi Camera"}]
        }
      ]
    }
    
  9. Finally, I needed to add homebridge to my path via export PATH=/opt/nodejs/bin:$PATH.

  10. Now, you can run homebridge and add the devices to HomeKit configuration.

Configuring Homebridge to run on Bootup

There are great instructions for running Homebridge automatically at Bootup. These are the steps I used to configure it as a system service:

  1. Download these files:

    • homebridge to /etc/default via this command:

      sudo wget -O /etc/default/homebridge https://gist.github.com/johannrichard/0ad0de1feb6adb9eb61a/raw/1cf926e63e553c7cbfacf9970042c5ac876fadfa/homebridge
      
    • homebridge.service to /etc/systemd/system via this command:

      sudo wget -O /etc/systemd/system/homebridge.service https://gist.github.com/johannrichard/0ad0de1feb6adb9eb61a/raw/1cf926e63e553c7cbfacf9970042c5ac876fadfa/homebridge.service
      
  2. Fix path to the homebridge binary in homebridge.service with:

    sudo sed -i 's,/usr/local/bin/homebridge,'"$(which homebridge)"',' /etc/systemd/system/homebridge.service
    
  3. Create a new user:

    useradd --system homebridge
    
  4. Per the camera setup instructions, add the new user to the video group:

    sudo adduser homebridge video
    
  5. For convenience, I added the pi user to the homebridge group as well, so it can edit the configuration files:

    sudo adduser pi homebridge
    
  6. Create a new directory for the configuration files:

    sudo mkdir /var/lib/homebridge
    
  7. Give the new user ownership of the configuration files:

    sudo chown -R homebridge:homebridge /var/lib/homebridge/
    
  8. Give the group write permissions for the configuration files:

    sudo chmod -R 775 /var/lib/homebridge/
    
  9. Log out and log back in (still as pi) to pick up the new permissions.

  10. Duplicate the configuration file in the new folder:

    cp .homebridge/config.json /var/lib/homebridge/config.json
    
  11. Make sure the ownership and permissions for config.json are set:

    • sudo chown homebridge:homebridge /var/lib/homebridge/config.json
    • sudo chmod 664 /var/lib/homebridge/config.json
  12. Have the system read the new configuration:

    sudo systemctl daemon-reload
    
  13. Enable it, start it up, and confirm it’s running:

    sudo systemctl enable homebridge
    sudo systemctl start homebridge
    systemctl status homebridge
    

And with that, you can now just plug in the Raspberry Pi and it will boot and start up homebridge with your new camera! This is the cheapest way I’ve seen to get a HomeKit camera up and running.

Pro Tools Upgrade?

The last time I purchased Pro Tools was in 2012. I bought Pro Tools 10.0 for Students, which came with a miraculous four years of software upgrades for just a few hundred dollars. The last version I received under that plan was Pro Tools 12.4, in December of 2015. Four years on, that version is still working really well for me under macOS Mojave (10.14.6).

Avid announced some Cyber Monday deals that are still live until Christmas Eve, which has me investigating whether now is the time to upgrade. It looks like my options are:

  • $199 for an upgraded Pro Tools perpetual license, with one year of active support (and new releases).
    • If I can get education pricing through my wife, this reduces to $99/year.
  • A subscription Crossgrade: $80 for year one (with a Cyber Monday promotion), $99 for year two, then $299/year.
  • Apple’s Logic Pro X for $199.

The main driver for upgrading at all is Catalina support. It looks like the Avid Video Engine is the only part of 12.4 that isn’t 32-bit, and I don’t do anything with video, but I’m not sure if the bundle will work well with the embedded 32-bit binary. I don’t plan to update my machines to Catalina for a while, so this is more of a theoretical issue for at least a few more months.

I’m pretty sure I’ll go with a perpetual license when I finally upgrade. After the end of year two, it’s substantially less expensive than a subscription, and I’ve already demonstrated that I can easily live with an out-of-date version for a while. $299/year for a subscription doesn’t match the value I’m getting out of Pro Tools at this point in my life. Since there’s no current discount on a perpetual license upgrade, I’ll just wait until upgrading to Catalina forces my hand.

Preventing USB Drives from Mounting at Boot

The two USB backup drives that are permanently connected to my iMac have been in service for six years, so I recently ordered replacements.

I wanted the new drives to be unmounted from the computer when they weren’t being updated; I’m not sure why I had never configured this before with the previous drives.

Carbon Copy Cloner will try to mount the target destination if it isn’t mounted when a backup task starts. You can optionally configure the drive to be unmounted when the backup task completes. The only remaining piece of the puzzle is to make sure the drives don’t mount when the machine boots up.

The first step is to find the UUID of your drive. This command will return a UUID with the form XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX:

diskutil info /Volumes/"Volume Name" | grep 'Volume UUID'

Then, you can a line to the /etc/fstab file with your UUID and the noauto option:

#
# Warning - this file should only be modified with vifs(8)
#
# Failure to do so is unsupported and may be destructive.
#
UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX none hfs rw,noauto

Save the file, reboot, and the drive should be in an unmounted state!

Olympus OM-D E-M5 Mark III

I just caught wind of the announcement of the new Olympus OM-D E-M5 Mark III, and I got really excited about the prospect of a higher resolution (20MP!) sensor.

I currently own an E-M1 Mark I that I bought just before the Mark II was released (at a steep discount). I originally planned to buy an E-M10, but the cost delta from that to the discounted E-M1 was small in late 2015, and the feature set was a huge step up. Now, coming from that E-M1 Mark I, the performance improvements of the E-M5 Mark III aren’t as pronounced as coming from an earlier generation E-M5.

I pulled together some specifications comparing the OM-D E-M1 Mark I, OM-D E-M5 Mark III, and the OM-D E-M1 Mark II (which I’ve managed to avoid splurging on over the last few years):

Camera OM-D E-M1 Mark I OM-D E-M5 Mark III OM-D E-M1 Mark II
Price $1400 (in 2013) $1200 $2000 ($1700 now)
Body type SLR-style mirrorless SLR-style mirrorless SLR-style mirrorless
Processor TruePIC VII TruePic VIII TruePic VIII
Max resolution 4608 x 3456 5184 x 3888 5184 x 3888
Effective pixels 16 MP 20.4 MP 20.4 MP
Sensor size Four Thirds Four Thirds Four Thirds
Sensor type CMOS CMOS CMOS
Sensor rate 10fps 30fps 60fps
Autofocus 81 Points 121 Points 121 Points
ISO 100-25600 64-25600 64-25600
Stabilization 5-axis, 4EV 5-axis, 6.5EV 5-axis, 5.5EV
Video 1080p @ 30fps 4k @ 30fps 4k @ 30fps
Lens mount Micro Four Thirds Micro Four Thirds Micro Four Thirds
Focal length X
Articulated LCD Tilting Fully articulated Fully articulated
Screen size 3″ 3″ 3″
Screen dots 1,037,000 LED 1,040,000 TFT LCD 1,037,000 TFT LCD
Viewfinder 2.36M 2.36M OLED 2.36M OLED
Max shutter speed 1/8000 sec 1/8000 sec 1/8000 sec
Format H.264, Motion JPEG MPEG-4, H.264 MPEG-4, H.264
Storage types SD/SDHC/SDXC SD/SDHC/SDXC(UHS-II) 2 SD/SDHC/SDXC(UHS-II)
USB 2.0 (480 Mbit/sec) 2.0 (480 Mbit/sec) 3.0 (5 GBit/sec)
USB Charging No Yes No
Weight 497g (1.10 lb) 414 g (0.91 lb) 574 g (1.27 lb)
Dimensions 130 x 94 x 63 mm 125 x 85 x 50 mm 134 x 91 x 67 mm
GPS None None None

These specifications really highlight DPReview’s claim that the new Olympus E-M5 Mark III is a mini E-M1 II. But, for me, I think it would be the better camera. Smaller, lighter, less expensive, and nearly as capable. The main advantages of the OM-D E-M1 Mark II are “a significantly faster burst rate with AF and a deeper, more comfortable grip”, but I don’t think that’s worth $500 to me.

The more important question is whether the benefits of the OM-D E-M5 Mark III over my current OM-D E-M1 Mark I justify the upgrade. The main benefit for me would be the higher resolution sensor; I’ve never really found myself limited by the sensor throughput, and I’ve never used the camera for video. I think I’ll wait for now to see how the camera is received when it’s released later this year.

Digital Minimalism

I just finished reading Digital Minimalism, Cal Newport’s manifesto on reclaiming our attention. It’s a fast and easy read, and I found his thoughts on solitude and leisure echoed mine from the last few months.

Between travel and professional commitments, I’ve been struggling recently to find the time my introverted brain requires to recharge. I can see the toll this is taking both on me and my family, as my ability to be present with them has been gradually degrading. Newport defines the condition of “Solitude Deprivation” as:

A state in which you spend close to zero time alone with your own thoughts and free from input from other minds.”

He builds a strong case for a link between solitude deprivation and anxiety-related disorders, and makes the claim that humans require solitude in order to survive. I’ve long known that this is true for me, and I know that I need to change my behavior and habits in order to carve out more time for myself. In particular, I need to plan and defend my time with a priority on solitude and meaningful leisure pursuits.

It’s unlikely that I’ll put myself through the intensive “digital declutter” he advocates, but I intend to evaluate the sources of distraction in my life through the lens of Digital Minimalism.

Deploying a Theme

Back when I wrote about creating a child theme for this blog, I never properly configured deployment of the theme. I attempted to configure it with git --bare init, with the working tree in the wp-contents/themes/ folder. This didn’t work. I’m not entirely sure why, but I suspect it’s due to permissions.

In the end, I cloned the repo into my user home folder:

git clone https://github.com/jeffvautin/twentytwelve-child.git twentytwelve-child

Then I created a softlink from the WordPress themes folder (via ln -s).

Finally, I added the server as a remote on my local copy of the repo, so I can push changes to it with:

git push prod master

SSH Keys with FE File Explorer Pro

Following posts by Dr. Drang and Federico, I’ve been experimenting with FE File Explorer Pro. I learned a few things I thought I’d share:

The World Deserves Nothing Less and Would Not Wait

I just read The Circle, Dave Egger’s 2013 dystopian novel about a young employee of a tech company that aspires to “complete the circle”: making all information available to everyone, all the time, with the mantra “privacy is theft”. I found the technology discussion obtuse, but the themes resonated with me.

In the book, the titular company seeks to abolish privacy through the use of “SeeChange” cameras. The leadership of this company genuinely believes that consolidation of the world’s information in a single for-profit company is in the interest of humanity. The novel illustrates the absurdity of this idea through personal tragedy.

Last week, the news broke that Facebook has been paying teenagers to provide them with complete access to their phone and web activity. This could easily have taken place in the world of this novel, in which The Circle seeks to implant tracking chips in the bones of babies at birth. In a year of escalating scandals, it’s also the tipping point for me; I’m done with Facebook. I deleted my Facebook account two years ago, and I haven’t missed it for a moment. I deleted my Instagram account today. This website is now my exclusive public presence1.

The open web is the only inoculation against the tragedy that comes with the consolidation of information within companies like The Circle.


  1. I’ve been inactive on Twitter for months, except for auto-generated links to this site.