A DIY smart doorbell with a built-in camera, microphone, and speaker. This steampunk-themed design integrates with home assistant and our multi-room audio system to communicate with the rest of our DIY smart home.
Rather than buying a Ring Doorbell (or Nest, or one of the other competitors) I built our own smart doorbell with a Raspberry Pi. The whole project cost about $150 (USD), which is about average for a smart doorbell, but it is much more full-featured than anything else you’ll find on the market. For example, it integrates with the rest of the home security system — using machine learning to identify humans, cars, animals, and more:
But I’m getting ahead of myself.
Designing the Smart Doorbell
Doorbells live outside.
Okay, that’s obvious. But it was my first electronic project that needed to survive the elements. To that end, I decided to use a junction box to house the electronics themselves.
The next requirement was also obvious: a button. However, the concern with such a unique design is that visitors need to intuitively understand what the device is. I decided upon a durable metal button that also lights up. The intention is for the light of the ring to make the button obvious.
Finally, the camera & speakers. This is arguably the most important security camera in the entire house, and I didn’t have a lot of space in the junction box, so I splurged on a night-vision IR camera with a microphone built-in. Throw in a tiny USB speaker, and we have bi-directional audio.
Building a multi-room home audio system begins by making "dumb speakers smart." Like with Sonos, these DIY wireless receiver(s) can be grouped together and play music from many different sources using pulse audio + snapcast.
I had some spare copper and brass parts lying around from prior steampunk projects. This came in handy when not all of the electronics could easily fit in the junction box.
I began by laying out the parts. Three holes were drilled in the sides of the junction box for the power cable, USB cables, and button wires. Plus, one larger hole in the cover to accommodate the camera:
Before sealing the parts, though, it was time to prototype the doorbell itself.
Ringing the Doorbell
The first order of business was to make the doorbell actually ring.
With the doorbell wire attached to GPIO18 (pin 12) on the Raspberry Pi, I then used the Serial Port input in Node RED to detect button-presses. To actually trigger a doorbell alert, as well as handle bi-directional (microphone/intercom) audio, see this post:
Aside from playing music, a multi-room audio system is also capable of becoming a loudspeaker network. Using Home Assistant, it's easy to broadcast audio alerts to the entire household.
There’s also the topic of motion detection and video.
In this regard, the doorbell is just another CCTV camera. It uses the exact same setup described in the following series of posts. The motion detection and object recognition is what generates the images like the one at the top of this post.
With the coding done, it was time to put all the parts together…
Smart Lock Integration
With the basics covered, it was time to assemble and mount everything:
I used hot glue on the openings of the junction box to seal it, where possible. The copper ring seen above also has a lip, protecting the camera from water. Plus, the whole thing is installed underneath a balcony, so not much water even has the chance to hit the doorbell.
The final pieces was to integrate the doorbell with a smart lock. Thankfully, Home Assistant makes this easy. We have this Yale Assure lock:
It communicates with Home Assistant via Z-Wave. What I like about this lock is that it can be programmed remotely to support different user codes (useful as an Airbnb host, or when you need to let a friend in). It also can detect which user pin code was used to open the door (and when) — great peace of mind when giving cleaners a code to the house.
But, most importantly, it can be locked/unlocked with a tap in Home Assistant.
Source Code: Recap
I wish I could give you copy-and-paste code for this project, but a lot of it will depend on your exact hardware, speakers, cameras, etc. Instead, I’ll recap each piece involved and link to the articles/code where I explain how to implement them:
Node Red uses gpiod to trigger a flow when GPIO #18 (the doorbell button) fires.
Home Assistant’s Yale Lock integration allows us to lock/unlock. The Yale lock is a Z-Wave device. Once paired with Home Assistant, it shows up as a lock and requires no further configuration.
This site began as a place to document DIY projects. It's grown into a collection of IOT projects, technical tutorials, and how-to guides. Read more about this site...
Is there somewhere you have the complete doorbell guide in one article? I’m great with hardware but not so much coding… I wouldn’t know how to adapt the instructions from the other articles to apply to the doorbell.
Hey Alex — if you want to do the sort of multi-room setup I have plus facial recognition and live CCTV, I’m afraid it’s far too complicated for a single article. It took about three articles to explain the multi-room sound-system, for example, which is how I play the audio alerts. That article includes the exact source code in Node RED that plays the doorbell alert. That’s the only software controlling the doorbell at all, so I think that article is pretty much all you need in terms of code. It just uses the Node Red gpiod node to trigger the flow. If you only want to play through one speaker, you may not need the other articles in the series. There’s also the person recognition with MotionEye, which you need to train and configure yourself (I can’t just give you my config, it wouldn’t help). But let me know if you get stuck on anything, and feel free to contact me.
At the beginning of the article, you mention, “a night-vision IR camera with a microphone built-in. Throw in a tiny USB speaker, and we have bi-directional audio.”
I can’t seem to find anything about setting up the bidirectional audio in the article, or the linked ones. Can you point me to the right place, please?
Hi Terry! The bi-directional audio is achieved via the loudspeaker. It works exactly like alerts, except instead of piping an audio file (like “doorbell.wav”) into the snapserver, it pipes the microphone input. I’m hoping to package this all up into an easier to use HA component at some point. But if you’ve gotten the loudspeaker alerts working, the microphone is very trivial.
Hope that helps! LMK if you need more clarification.
You have a very frustrating style of documenting a project. You don’t explain a project from start to finish. Constantly throughout the reading are overlapping “Related: …Read More” dialogs that go off on a tangent and loop back to the starting page. Circular looping with no resolution.
In the end, you only discuss hardware parts individually and never explain how they connect together with the Raspberry Pi. And you never show the source code for programs you had to write to make it all work.
I’m sorry you feel that way. But the “modularity” is a feature, not a bug, and you may be expecting something different than I’m trying to offer.
This post is more eye candy than content, because it’s really a combination of many other projects on the blog. But ~30% of the content of this blog is > (according to WordPress stats), and I maintain 3 separate open-source projects that spun out of this site. So the hardcore source-code is all there, but often times it is behind a link (e.g., Github repo with a README).
It’s true, though, I aim to provide “concepts” and “inspiration” (NOT a pre-built solution). I learned the hard way that it’s huge waste of my time try to make a “copy-and-paste” sort of blog post. My early blog posts were thousands of words long “complete guides,” but people really did not like them very much — because they were so specific to my situation and my hardware, they weren’t useful.
Do I have to use Node Red for the coding or would something like Wireshark or C# also work? Just wondering whether I should learn Node Red or if I have other options that I already know how to use. Thanks!
Anything that does the job would do the trick. I’m not sure how you’d use Wireshark for this purpose, but C# is certainly a possibility… if you feel like doing 10x more work.
Types of Waterproof Cases IP67 enclosures and connectors are the most common and versatile for outdoor usage. The IP67 rating means that the waterproof case can handle up to thirty minutes in partially submerged water (read about the IP ratings)...
No silly gimmicks. This collection of home automation ideas will actually make your home more enjoyable for you and your guests. I've personally implemented many of the ideas in this list. These all came from our DIY Home Automation project...
Dashcams (video cameras in cars) are a great security and safety feature. As with the rest of the vanlife IOT, I built my own DIY dashcam that has some unique features — like motion detection and automatic recording. On its surface, this is a post...
Aside from playing music, a multi-room audio system is also capable of becoming a loudspeaker network. Using Home Assistant, it's easy to broadcast audio alerts to the entire household. Playing a Wav File in Home Assistant The simplest approach is...
Running a custom router gives unprecedented insight into everything happening in a network. Building your own router with a a Raspberry Pi may be a little daunting, but it's surprisingly easy and rewarding to do... and the benefits are tremendous...
DSL may be less common these days, but it is still a fact of life for some. Unfortunately, many DSL modem router combination devices are outdated and slow. This leads to many home owners being unnecessarily frustrated with the internet connection...
Glad to see you building lots of cool stuff!
Cheers! Trying to save money in these… strange times.
Is there somewhere you have the complete doorbell guide in one article? I’m great with hardware but not so much coding… I wouldn’t know how to adapt the instructions from the other articles to apply to the doorbell.
Hey Alex — if you want to do the sort of multi-room setup I have plus facial recognition and live CCTV, I’m afraid it’s far too complicated for a single article. It took about three articles to explain the multi-room sound-system, for example, which is how I play the audio alerts. That article includes the exact source code in Node RED that plays the doorbell alert. That’s the only software controlling the doorbell at all, so I think that article is pretty much all you need in terms of code. It just uses the Node Red gpiod node to trigger the flow. If you only want to play through one speaker, you may not need the other articles in the series. There’s also the person recognition with MotionEye, which you need to train and configure yourself (I can’t just give you my config, it wouldn’t help). But let me know if you get stuck on anything, and feel free to contact me.
OK. Thanks for the reply Zane! I’ll see what I can screw up!
Good luck! I did add some more links in the post in hopes it would be helpful.
Hi there,
At the beginning of the article, you mention, “a night-vision IR camera with a microphone built-in. Throw in a tiny USB speaker, and we have bi-directional audio.”
I can’t seem to find anything about setting up the bidirectional audio in the article, or the linked ones. Can you point me to the right place, please?
Hi Terry! The bi-directional audio is achieved via the loudspeaker. It works exactly like alerts, except instead of piping an audio file (like “doorbell.wav”) into the snapserver, it pipes the microphone input. I’m hoping to package this all up into an easier to use HA component at some point. But if you’ve gotten the loudspeaker alerts working, the microphone is very trivial.
Hope that helps! LMK if you need more clarification.
You have a very frustrating style of documenting a project. You don’t explain a project from start to finish. Constantly throughout the reading are overlapping “Related: …Read More” dialogs that go off on a tangent and loop back to the starting page. Circular looping with no resolution.
In the end, you only discuss hardware parts individually and never explain how they connect together with the Raspberry Pi. And you never show the source code for programs you had to write to make it all work.
I’m sorry you feel that way. But the “modularity” is a feature, not a bug, and you may be expecting something different than I’m trying to offer.
This post is more eye candy than content, because it’s really a combination of many other projects on the blog. But ~30% of the content of this blog is
> (according to WordPress stats), and I maintain 3 separate open-source projects that spun out of this site. So the hardcore source-code is all there, but often times it is behind a link (e.g., Github repo with a README).
It’s true, though, I aim to provide “concepts” and “inspiration” (NOT a pre-built solution). I learned the hard way that it’s huge waste of my time try to make a “copy-and-paste” sort of blog post. My early blog posts were thousands of words long “complete guides,” but people really did not like them very much — because they were so specific to my situation and my hardware, they weren’t useful.
Do I have to use Node Red for the coding or would something like Wireshark or C# also work? Just wondering whether I should learn Node Red or if I have other options that I already know how to use. Thanks!
Anything that does the job would do the trick. I’m not sure how you’d use Wireshark for this purpose, but C# is certainly a possibility… if you feel like doing 10x more work.
Okay Thanks
I’m interested in piping TV audio into some kind of house-wide speaker system. I’m looking forward to hearing if and how you did that.