DEV Community

Paul J. Lucas
Paul J. Lucas

Posted on • Updated on

DIY Home Security Camera System

Introduction

A few years ago after I bought a house, I decided I wanted to install security cameras. The problems with mass-market systems include:

So I decided to DIY my own home security camera system:

  • There’s a higher initial cost for the equipment, but there’s no ever-increasing subscription cost.
  • Nobody can access my video but me since it’s stored locally on my own hard drive.
  • My service will continue indefinitely.

One caveat, of course, is that I had to figure all this stuff out for myself. But I’m a computer guy: challenge accepted. 🤓

Hardware

Camera Preliminaries

For cameras, you have to consider two things:

  1. Electrical power.
  2. LAN connectivity.

For power, there are three choices:

  1. Hard-wired (120v, 15a).
  2. Power-over-Ethernet (PoE).
  3. Battery + solar panels.

Hard-wired is the most complicated and likely most expensive since you’ll likely need to hire a licensed electrician (and, depending on your jurisdiction and how “legit” you want to be, may also need a permit) to run the 120v electrical wire. And then you still have to connect the camera to your LAN somehow (likely WiFi).

PoE supplies low-voltage electrical power over standard Ethernet cable so you can run such cable yourself; plus it obviously meets both requirements of power and LAN connectivity. To use PoE, you need a PoE switch that actually puts the electrical power over the Ethernet cable.

For my 4-camera system, I opted for the Zyxel 5 Port Gigabit PoE switch.

For PoE switches, you have to read the specs carefully. Just because a PoE switch has N ports doesn’t mean all N are PoE. Typically, N–1 ports are PoE and the 1 other port connects to the rest of your LAN.

I’d use battery + solar panels only if I wanted to mount a camera in a location where it would be either difficult or impossible to run an Ethernet cable to. That said, the problems with battery + solar panels are:

Often, PoE cameras are configured via a web browser connecting to the camera’s own web server. In such a case, it’s best to assign each camera a fixed IP address on your LAN so it’s possible to access it directly via a URL like http://192.168.1.xxx where xxx specifies the camera.

A proper home router will have the ability to assign a fixed IP address to a DHCP client based on its MAC address. Alternatively if your cameras support it, you can assign them static IP addresses; but then you have to exclude those from your DHCP address pool.

In my case, my cameras have a URL of the form http://192.168.1.10x where x is in 1–4.

Cameras

There are many choices for PoE cameras. A general prerequisite is that you want a camera that supports the ONVIF standard. Also since the cameras are mounted outdoors, they must be rated for outdoor use via their IP code and be IP6x where x ≥ 5 (e.g., IP65).

Other features you likely want to consider are whether the camera supports:

  • Nightvision.
  • Remote pan-tilt-zoom (PTZ).
  • Audio (1- or 2-way).

The way I narrowed down the choices was to some reading on Internet forums for security cameras (there are several). The ones several people recommended are:

The cameras I ultimately selected were the Hikvision DS-2CD2H45FWD-IZS 4MP IR Outdoor Network Turret cameras.

I bought these cameras in 2019. That model has since been discontinued, but replaced by a better version.

Camera Installation

For the Hikvision cameras, if they’re mounted under something, then no additional hardware is needed. However, when mounted to the side of a building, Hikvision also makes a “cap” and a wall mounting bracket. The Ethernet cable can enter the bracket either from the back or bottom via conduit.

In my case, one of the cameras is mounted under my front porch, so it could be mounted directly; the remaining three cameras are mounted to the side of my house, so I needed three caps and brackets.

While I do a lot of DIY stuff around my house, I didn’t want to install the cameras myself since it required:

  • Climbing high on a ladder to install 3 of the 4 cameras.
  • Cutting, bending, and running conduit (which requires special equipment) for 2 of the 4 cameras.
  • Crawling through my very cramped attic to run Ethernet cable for 2 of the 4 cameras.

If you’re in the San Francisco Bay Area, I highly recommend LMi.net for running wire. I also had the guy install a 4-port patch panel and wall plate in my networking closet where I’d use short patch cables between it and the PoE switch.

Mac Mini

Since I’ve been a Mac guy for a long time, a Mac Mini was the obvious choice for the computer to use since it’s small, can be run headless, and administered via Remote Desktop.

One thing you might not know is that, for some computers at least, when you run them headless, they disable graphics acceleration — that you still want enabled so you don’t get sluggish graphics when using Remote Desktop. Fortunately, display emulators exist that trick the computer into thinking there’s a display attached so it won’t disable acceleration.

Hard Drive

Since video files are being written constantly to the drive, you really don’t want to use the computer’s internal drive, especially if it’s an SSD: it’ll just wear it out too quickly. Instead, attach an external Thunderbolt drive.

To figure out how much drive capacity you need, there are online video storage calculators you can use. The factors are:

  • Video format, frame rate, and quality to yield Gb/h (gigabytes per hour).
  • Total number of cameras.
  • Subset of cameras to store 24/7 video.
  • Number of days to store video.

In my case:

  • Gb/h: 3.62.
  • Total number of cameras: 4.
  • Subset of cameras to store 24/7 video: 2.
  • Number of days: 30-ish.

The four cameras that I have are:

  • Front door.
  • Front of house.
  • Driveway.
  • Back yard.

Of those, I only wanted the front-of-house and driveway cameras to record 24/7. For the front door and back yard cameras, having them record only upon motion detection is sufficient — and cuts the storage requirements roughly in half.

Doing the math yielded a 6 Tb drive would be sufficient. I selected a G-Technology 6Tb G-Drive with Thunderbolt.

That drive is apparently no longer available, so you’re on your own for which manufacturer to select.

Hardware Cost

So what did all the hardware end up costing?

Item Unit # Total
Hikvision camera $274.00 4 $1096.00
— Pendant cap $14.95 3 $44.85
— Wall bracket $17.95 3 $53.85
Mac Mini $1517.92 1 $1517.92
Hard drive $349.95 1 $349.95
Display emulator $8.50 1 $8.50
PoE switch $48.66 1 $48.66
Patch cables $0.69 4 $2.76
Total $3122.49

Apologies if the numerical columns aren’t right-aligned. AFAICT, I’ve entered the Markdown correctly; it’s just not rendering correctly.

Hikvision cameras are roughly the same price as Ring cameras, so their cost shouldn’t be counted against a DIY system. The obviously biggest cost is the Mac Mini plus drive. I guess that’s the price you have to pay to DIY.

However in my case, I also use the Mac Mini for a networked Time Machine backup server (for which I have a separate hard drive attached), so I’d have the Mac Mini even if I didn’t DIY my own camera system.

Software

The software that comes with a security camera tends to be fairly basic in that it’s:

  • Typically only for configuring the camera, not 24/7 monitoring.
  • Even if it can monitor the camera, it can’t monitor more than one camera.

After some research, the web consensus seems to boil down to:

Since I’m a Mac guy, I went with Security Spy. It does pretty much everything you’d want it to do:

  • Either 24/7 or motion-detection recording on a per-camera basis.
  • Mask regions for motion detection.
  • Auto-delete old video files by either time or space.
  • Has an iOS app so you can monitor your cameras from your iPhone.
  • Has a myriad of other configuration options.
  • One time cost: no software subscription.

Plus there’s an active user forum and the author is fairly responsive.

WiFi

Since my cameras are PoE, WiFi has nothing to do with my camera system. However, when I first got my system up and running, video performance on my iPhone (which uses WiFi at home to connect to my LAN) via the Security Spy iOS app was poor. After a lot of investigation, the culprit turned out to be the crappy WiFi supplied by my then ISP’s router.

I replaced my ISP’s router with a Netgear Orbi 6 Mesh WiFi system and performance improved dramatically. The lesson is that to support streaming video to your phone while at home, you need a good WiFi system.

Conclusion

Since I installed my system in 2019, it’s been rock solid and I’ll never have to pay anybody any additional fees.

Epilogue

As mentioned, I’m a Mac guy, or more generally, an Apple guy, so beyond the recommendation for Blue Iris software for Windows, I know nothing else about either Windows or Android — so don’t ask.

Top comments (1)

Collapse
 
bogomil profile image
Bogomil Shopov - Бого

Wow. Thanks for this tutorial. I will do something like this. I probably will do a Linux-based system and spare the money that you give for the Mac Mini.
Thanks again!