Designing Cheap ZoneMinder Network Cameras
ZoneMinder is an open-source project used for managing and monitoring DIY surveillance systems. While this system is almost 2 decades old, it’s still actively maintained by a fairly large group of contributors. There are plenty IP cameras that can be picked up fairly cheaply, however when it comes to long term network security for these devices often the manufacturers don’t provide long term software support. Meaning either your system needs to be tightly controlled behind a firewall or operated on an independent air-gapped network. For most home networks the prior can be quite risky and the later can be unfeasible. To resolve this I decided to build my surveillance camera nodes from cheap raspberry pi zero devices, while these devices still use the original SOC, they are still supported with regular firmware and OS updates.
I am using the $5 original PI zeros as I have no need for the wifi functionality, instead I will be connecting these cameras via USB OTG <-> Ethernet adapters. The reason for this is purely to reduce any constant load on the shared medium that is a home wireless network. I am also using replica PI cameras, due to the cheap cost and adequate full-hd performance. The goal was to 3D print an enclosure for this assembly, leaving enough room for a standard copper heatsink to be mounted on the SOC.
I ended up with a 2 piece 3d printed cases, the Pi itself fits directly into the base leaving the two micro USB ports exposed. There is then a recess underneath the PI to route the camera cable from the PI’s ZIF connector. The camera itself is held into the lid part using four m2x3 bolts that thread into the tapped holes. This whole assembly is then held together by four m2.5×20 pan-head bolts that thread into friction fit nuts in the base. There is a cut-out for the camera lens as well as a vent to reduce heat built-up on the SOC (as these cameras are aimed to be mounted indoors).
I was constantly mindful of the restrictions of my 3D printer during the design of the case, being an ancient UP! Mini that’s not exactly on par with printers of this era. However after a bed calibration, a new reel of PLA and some tinkering I was able to get consistent prints of the case.
Surprisingly everything fit together and worked exactly as designed. The one issue with the design was the white PLA being very conspicuous and intrusive. The beauty of white PLA is it’s very good base for spray painting any other colour on, with minimal layering required.
With these units assembled I programmed up a few SD cards with raspberry pi OS Lite. Fortunately these Debian derivatives contain the V4L2 (Video for linux) drivers which makes handling the stream from the /dev/video0 camera very easy and efficient. Then V4l2rtspserver is a handy open-source tool for easily configuring this stream as a rtsp (real time streaming protocol) network stream. While this has to be manually compiled it’s very lightweight software and very quick to configure. Once setup the device is a plug and play node for the zoneminder server, with a 1080p 5fps stream I see around a ~8 to ~12% load on the CPU, which for such a low power single-core SOC is quite impressive. You could definitely increase the frame-rate higher without the Zero breaking a sweat if you have the storage capacity to justify doing so.
While this already produced pretty good quality cheap reliable cameras, I am already considering improvements for a second revision. I am considering building in a photosensitive IR spotlight array for self-contained night vision. I would also like to investigate adding an internal Ethernet port, as it would be a slightly more elegant solution than having an in-line adapter. All in all pretty happy with my first stab at DIY home surveillance, and with the increase in local crime I’m feeling a lot more comfortable knowing I have a record of movements around the property.