How to create your own HomeKit camera with a Raspberry Pi and HomeBridge

Posted:
in iOS edited March 22
Though Apple's HomeKit home automation platform has supported cameras for over a year, manufacturers have been slow to bring compatible devices to market. Learn how you can create your own HomeKit security camera for around $60 in this tutorial.





Currently, only a handful of HomeKit-enabled cameras are available for purchase, two of the most popular being the Logi Circle 2, the D-Link Omna 180 Cam HD and the Netamo Presence.




Other than HomeKit support, the one thing most compatible cameras have in common is a high price tag. To help alleviate potential sticker shock, we put together an extremely simple guide on how to create your own. About $60 and four easy steps are all that separate you from your own DIY HomeKit camera.

For this project, we are going to make our own HomeKit camera using a Raspberry Pi. It will essentially be plug-and-play, though you will need to answer a couple setup questions once you power up the camera. After you walk through the setup, you will be able to view live camera feeds while at home or away assuming you have some form of Home hub such as a HomePod or Apple TV.


Background information

This project was built using HomeBridge. HomeBridge is a lightweight server that runs on the Raspberry Pi and emulates the iOS HomeKit API, bringing support to your own projects or (via plugins) to products that don't currently interface with HomeKit or Siri.

For those who like to really tinker, it isn't especially difficult to install HomeBridge yourself. However, we wanted this project to be accessible for anyone, so we've provided our own custom disk image for you to use.

The disk image we provide will include a copy of Raspbian Lite (the Raspberry Pi's operating system), the necessary plugins and components for HomeBridge, as well as a few customizations to make the experience better.

What you will need

To play along at home, you need a few things. Some you may have, others you might need to pick up.




You'll need:



Most people will have a micro SD card available, and the same goes for a spare micro USB cable and wall adapter that can be used for a power supply. The camera I used has an 8MP Sony Exmor IMX219 sensor that is capable of 1080p video.

How-to create your own HomeKit camera


Step 1

To create your camera, start by downloading our provided disk image. The download is on the large size, so be warned. You are downloading an entire OS after all.

Step 2

Once you have the download, we need to burn that image to your micro SD card. There are many ways to do this, but by far the easiest is to use Etcher.




Download Etcher, select the disk image we provided, choose the SD card you have connected, and hit Flash!

Now, all we need to do is to connect the Raspberry Pi and run the setup script.


Step 3

Insert the camera module into the Pi, insert the micro SD card, connect it to a monitor or TV with HDMI, and plug in the power.

The setup script can be run from your Mac via SSH or you can plug in a keyboard and run it from the Pi itself. Using a keyboard is easier for those just getting started.

In either situation, log in with pi as the username, and raspberry as the password. Then type ./get-started.sh followed by Return into the command line.




It will walk you through the setup process which includes entering your Wi-Fi credentials, changing the default username and password, and generating a random HomeKit pairing code. It will then reboot to take effect. Make sure to take note of the HomeKit pairing code.

Step 4

The last step is pairing your new HomeKit camera with the Home app. On your iPhone or iPad, launch the Home app, tap the "+" button in the top right hand corner, and choose Add Accessory.




Now we have to enter the code manually by tapping "Don't Have a Code or Can't Scan?" towards the bottom of your screen. Choose "Enter code", and do just that using the code that was randomly generated for you. In some cases, your device may discover the HomeBridge and the Pi Camera automatically. Add both devices, starting with the bridge, using your randomly generated HomeKit code.

Feel free to assign a room, change the name, or mark the camera as a favorite during the setup.

That's it! Four easy steps: Download the disk image, write to SD card, connect your Pi, and connect to HomeKit.

Viewing your camera

Unless you opted for a different room during setup, cameras will be added to your "Default Room" in the Home app on iOS. You can view their feeds here, as well as get details, and make name or location changes.




You can view the cameras anytime while you are at home over Wi-Fi, or remotely if you have a hub.

Notes

In this tutorial, we used the Raspberry Pi 3 Model B. If you want to save some money, older models work as well, including the Pi 2 (which we did some light testing with).

Similar sentiment goes to the camera modules, as well. While we used the official Pi Camera V2, there are countless others available much cheaper, though we can't guarantee compatibility. It would simply be too difficult to buy and test each camera with each model of Raspberry Pi.




By default, it may be a bit wonky trying to correctly place your Pi camera, but luckily there are many cases and mounts available that make it much easier. My favorites are those compatible with LEGO!

Wrapping it up

While great for viewing camera feeds, there are clearly plenty of limitations to rolling your own HomeKit hardware. As an example, there is no way to record video (other than viewing the video on your iPhone and making a screen recording). You also don't have motion sensing capabilities for notifications or a mic and speaker. Third party cameras contain these, as well as other value-added features.




Still, affordable DIY Pi cameras are a great option to expand what you currently have in your home or present a good stepping off point for those just getting started in home automation. A room only needs one motion sensor, so if you have one already, or create one with a Raspberry Pi, you don't necessarily need one in your camera.

Since the install also includes the HomeBridge server, you can use any number of other plugins for many other accessories and platforms. There are countless HomeBridge plugins for things like IFTTT, SmartThings, Dyson, and so much more. Here are just some of the more popular plugins.

Eventually, we may see many HomeKit cameras on the market hitting close to the $100 mark, at which point projects like this will prove less useful. In there interim, this is a great alternative to official HomeKit cameras.




Be sure to share your experiences as well as your own projects in the forums.

We want to give a big thanks to Aaron Dippner for helping with the project.
knowitallStrangeDaysmickey6packmdpblueraaa
«13

Comments

  • Reply 1 of 60
    cornchipcornchip Posts: 1,068member
    I plan on doing a couple raspberry pi projects this year. Might add this one to the list. Thanks.
    Andrew_OSUSpamSandwich
  • Reply 2 of 60
    Does this work for remote viewing via 3/4G?

    I am no expert but I set a homebridge camera up using a different guide and it worked locally but as soon as I left my WiFi it would not work and I could find no reason why not. 

    I used motioneye OS to create an IP camera which I fed into homebridge with an IP camera plug in. So not the same but ultimately homebridge was sharing the camera to HomeKit, and it added fine and worked but only on the local network. 

    I note my other homekit hue bulbs work off the local network, as do my homebridge temperature sensors as expected, so just the video that fails. 
    edited March 21
  • Reply 3 of 60
    Mike WuertheleMike Wuerthele Posts: 3,111administrator
    mrzippy said:
    Does this work for remote viewing via 3/4G?

    I am no expert but I set a homebridge camera up using a different guide and it worked locally but as soon as I left my WiFi it would not work and I could find no reason why not. 

    I used motioneye OS to create an IP camera which I fed into homebridge with an IP camera plug in. So not the same but ultimately homebridge was sharing the camera to HomeKit, and it added fine and worked but only on the local network. 

    I note my other homekit hue bulbs work off the local network, as do my homebridge temperature sensors as expected, so just the video that fails. 
    What were you using for a HomeKit Hub? Cameras are limited to iOS 11 and newer hub hardware.
    tdknoxchia
  • Reply 4 of 60
    Andrew_OSUAndrew_OSU Posts: 146member, editor
    mrzippy said:
    Does this work for remote viewing via 3/4G?

    I am no expert but I set a homebridge camera up using a different guide and it worked locally but as soon as I left my WiFi it would not work and I could find no reason why not. 

    I used motioneye OS to create an IP camera which I fed into homebridge with an IP camera plug in. So not the same but ultimately homebridge was sharing the camera to HomeKit, and it added fine and worked but only on the local network. 

    I note my other homekit hue bulbs work off the local network, as do my homebridge temperature sensors as expected, so just the video that fails. 
    Hi there, yes, this should work remotely. I tested this and found no issues.
    mrzippyStrangeDays
  • Reply 5 of 60
    knowitallknowitall Posts: 1,022member
    Kudos
  • Reply 6 of 60
    JeFurryJeFurry Posts: 1unconfirmed, member
    Is this disk image compatible with a Pi Zero (or Zero W)? They support camera modules, but are smaller, even cheaper, and lower powered...
  • Reply 7 of 60
    Andrew_OSUAndrew_OSU Posts: 146member, editor
    JeFurry said:
    Is this disk image compatible with a Pi Zero (or Zero W)? They support camera modules, but are smaller, even cheaper, and lower powered...
    I do mention in there that other Pi models will work, and can definitely save some cash. The only one I was able to test with for sure was the Pi 2, but I don't see any limitations on why it wouldn't work with either of those. Probably the Zero W would be best between the two. You may notice a little more lag on the video load, but that's probably it. If you try, I'd love to know for certain. 
  • Reply 8 of 60
    mrzippy said:
    Does this work for remote viewing via 3/4G?

    I am no expert but I set a homebridge camera up using a different guide and it worked locally but as soon as I left my WiFi it would not work and I could find no reason why not. 

    I used motioneye OS to create an IP camera which I fed into homebridge with an IP camera plug in. So not the same but ultimately homebridge was sharing the camera to HomeKit, and it added fine and worked but only on the local network. 

    I note my other homekit hue bulbs work off the local network, as do my homebridge temperature sensors as expected, so just the video that fails. 
    What were you using for a HomeKit Hub? Cameras are limited to iOS 11 and newer hub hardware.
    Have 3 Apple TVs using tvOS 11, at least 1 is always on. 
  • Reply 9 of 60
    SoliSoli Posts: 7,847member
    Cool, cool, cool. I have all those things already.
  • Reply 10 of 60
    w00masterw00master Posts: 101member
    Article forgot one other Homekit approved camera: Arlo Baby Camera: https://www.apple.com/ios/home/accessories/
    edited March 21
  • Reply 11 of 60
    tealiotealio Posts: 3unconfirmed, member
    I already have homebridge running at home, can you tell me what plugin you added for the pi camera? Also any configuration instructions or link to the guide would be sweet! I'm assuming you wouldn't or can't have two homebridge's running simultaneously. 
  • Reply 12 of 60
    Andrew_OSUAndrew_OSU Posts: 146member, editor
    w00master said:
    Article forgot one other Homekit approved camera: Arlo Baby Camera: https://www.apple.com/ios/home/accessories/
    There are actually a few HomeKit cameras, but I wasn't going to list them all. Those two are just the most popular. There is also the Presence from Netatmo, and then a whole host of others slated to this year including a second one from Netatmo and a variety of other 3rd party manufacturers. Even then, they are all still expensive. 
  • Reply 13 of 60
    Andrew_OSUAndrew_OSU Posts: 146member, editor
    tealio said:
    I already have homebridge running at home, can you tell me what plugin you added for the pi camera? Also any configuration instructions or link to the guide would be sweet! I'm assuming you wouldn't or can't have two homebridge's running simultaneously. 
    This is the plugin used. 

    That walks you through most of it. You most likely could have multiple HomeBridge's running at the same time, though for this, you actually don't need to add the bridge to HoemKit if you don't want to. 
    tealiochia
  • Reply 14 of 60
    JinTechJinTech Posts: 300member
    Nice article. Now if there was only a way to tweak the firmware to only recording on the SD card I would order everything to make this today!
  • Reply 15 of 60
    This is awesome guys! Thank you for the tutorial. It'd be great if you start a regular series of DIY IoT for Apple products.

    Great work! 
    SpamSandwich
  • Reply 16 of 60
    GG1GG1 Posts: 190member
    Fantastic. Thanks for this tutorial.
  • Reply 17 of 60
    focherfocher Posts: 620member
    Once you have HomeBridge installed on the Pi, you can do all the configuration through the web admin console. It's a bit easier, especially to search for and add HomeBridge packages.

    One more recommendation, use Docker on the Pi. Then install the pre-built Docker container for HomeBridge. My preferred one is at https://hub.docker.com/r/oznu/homebridge/

    If you aren't deploying apps using Docker, you are really missing out. Makes things a lot simpler and definitely cleaner.
    dewme
  • Reply 18 of 60
    dewmedewme Posts: 1,490member
    You may be able to save some money by repurposing an existing USB web cam.
  • Reply 19 of 60
    Is it possible that you post a tutorial, how you create the Image. Which plugins, Software and tols are used?
    mickey6pack
  • Reply 20 of 60
    JeFurry said:
    Is this disk image compatible with a Pi Zero (or Zero W)? They support camera modules, but are smaller, even cheaper, and lower powered...
    Sorry, didn't see the direct answer to if the provided image in the article works with the Pi Zero W?    Or do we need to start from NOOB and clean build.
Sign In or Register to comment.