Raspberry Pi CCTV Setup
This is a first to me on this blog, I'll be writing an article documenting my process for setting up a security camera system using two Raspberry Pis and a separate storage system.
A note before continuing further: This project can be accomplished using a Raspberry Pi 3 and a Raspberry Pi Zero W. You could also use a Raspberry Pi 4, but seeing as the extra computing power isn't strictly necessary, I'd advise against it unless you're certain you want to invest the extra money. – Raspberry Pi 3 (B/B+) (x2) – CanaKit 5V 2.5A Raspberry Pi 3 B+ Power Supply / Adapter (x2) – Micro SD Card for the OS* (x2) – Flirc Raspberry Pi 3B Case – MakerFocus Raspberry Pi Camera Night Vision Camera for Raspberry Pi 3B/3B+ and Pi 2B B+ – ModMyPi – PIR Night Vision Camera Box Bundle – B+/2/3/3B+ – An extra computer with access to a microSD card adapater
* It doesn't really matter how big the SD cards are, I don't really remember which exact ones I'm using. Just find a good deal on a good brand and use those. I've gone ahead and linked some I recommend
- MotionEyeOS (OS image)
Device Setup and OS Installation
I'm going to split the following into two parts, as they can be completed independent of each other. This is the process I did it in while waiting for some parts and logistics to be worked out.
Each of the two devices has a unique job. One will be position inside the house as a storage/hub server, and the other will have the camera module attached and be positioned outside.
Raspberry Pi Hub
For the hub device, I installed the Flirc Raspberry Pi 3B Case. The installation process is fairly straightforward, so I won't go into detail.
Raspberry Pi Camera
For the camera, I had to install the camera and case individually, as the camera came much earlier than the case (the exact model I needed had to be shipped from out of the country). The camera installation is simply an attachment of a ribbon cable and a few screw to hold the IR sensors in place. The case case with its own set of instructions for setup, and was mainly a few pieces of plastic that fit together to form a sealed-enough case. I'd recommend assembling the case with some glue or epoxy to give more of a waterproof seal for anyone attempting this same project.
Note: The only reason I'm using two Raspberry Pi 3s is because I already had them lying around, so it would have just been extra expense for me to buy another one specifically for the camera, and I didn't have anything else for these to do.
I took each of my microSD cards and my downloaded latest release of MotionEyeOS. For the purposes of this project, I used just the “raspberry-pi-3” version.
dd on Linux, I flashed the OS image onto the microSD cards each individually. After flashing, I made sure to test the installation by inserting the microSDs into each of the Pis and powering them on. The command was something like:
dd -if=/path/to/motioneyeos-raspberrypi3.img -of=/dev/sdx && sync
In order to be able to reliably access each device, I went to my local router's settings and ensured that they had been set to static IP addresses. If you are unsure how to do this part, try looking up your router's instruction manual.
Once it was powered on and I navigated to the IP of each device, I was greeted with a login screen. After logging in, I recommend immediately changing the admin passwords for each device, as well as setting up a surveillance user account for each.
After changing some camera settings on the raspberry pi with the camera, I configured it to be set up to stream the video on the local network.
On the hub side, I went to the settings and configured it to view the video stream as pictured above, then set up the stream to be stored on a local SFTP share I had previously configured.
I also went and set up some optional motion detection settings and set a time period for how long to keep archived recordings.
Since the Hub merely needs to be plugged in to be installed (I recommend using a hardwire ethernet connection if possible), I won't be going through how I set it up.
For the camera, I only wanted a front door camera to mainly track package theft. I went through a few different methods of mounting the camera. For my situation, I'm currently renting this house, so I didn't want to screw any bolts or nails that I'd have to pay cover up later. Additionally, the front door area where I wanted to install the camera is mostly brick. This made it difficult to find a way to attach the camera (especially before I ordered the optional case mount).
Eventually, I settled on using some construction adhesive to attach the camera mount to the brick wall I wanted it to be set up on.
Here are some pictures of the completed setup:
I'm really pleased overall with this set up after finishing it. It took quite a while with a few points where I thought it was going to be ready, but encountered minor setbacks. Regardless, this is a fairly inexpensive and useful project. I'll be giving a progress update after a month or so to follow up.