Surveillance video system with USB camera and a Raspberry Pi running MotionEyeOS. Get advanced functions like a motion detection, video recording, streaming and email/SMS notifications.
This is an update of my previous Security Camera project from the last year. In 2016 I used a native Raspberry Pi camera module and put it together with the board inside of a dummy camera dome. This time I want to build another security camera with slightly different requirements to leverage experience from the previous project:
- Use a USB camera
- Camera with auto-focus
- Resistance against freezing temperatures
- Raspberry Pi 3 (older Pi 2 would work as well)
- ELP USB Camera on Amazon.com | on Aliexpress.com | on manufacturer’s website
- USB Wi-Fi (not required for Raspberry Pi 3 with integrated wireless or if you have Ethernet connection available)
- Dummy/fake dome camera housing (optional if you use ELP camera casing)
The quality of 5MP Raspberry Pi camera module (rev 1.3) is quite good, with the maximum resolution of 2592 x 1944 px. In my setup I preferred a lower FullHD resolution (1600 x 1200 px) anyway, because the real-time transport by a Wi-Fi was too slow for big images. At the time of writing this article you can already buy a newer version (v2) of this camera module supporting up to 8MP (3280 × 2464 pixels) for the same price as v1 – detailed HW specification comparison between v1/v2. For me, however, the major issue was a CSI (Camera Serial Interface) used to connect the module to Raspberry Pi. Its length was very limited without any possibility of extension, forcing me to keep all HW (Pi board, Wi-Fi, camera, SD card) in the same place outdoor. This proved to be a problem during winter (sub-zero F). Sometimes the camera went dark and ocasionally the whole Pi board stopped communicating. A reboot usually helped, but a security camera should reliably work 24×7. A minor issue was a missing auto-focus – I was hoping to get a clearer picture of new close objects (e.g. to read a license plate of a vehicle).
Therefore I decided to try a USB camera instead. It is the only component outdoor kept in a dummy case. A USB cable then goes through a window indoor, where it connects to a Raspberry Pi board. This allowed me to eliminate Wi-Fi as I have Ethernet available indoor. It increased the security (avoiding Wi-Fi jamming) and transmission speed. A big advantage of USB cameras is that you might already have one at home with no use for it. And if you decide to remove the security camera one day, a USB camera can be connected to any other computer, not just a Raspberry.
I selected an ELP USB Camera with 5MP resolution and autofocus, based on OV5640 CMOS chip. You can find its alternatives without autofocus and/or with a small case. The case is perfect if you want to hide the camera. In my project I reused a dome to keep it visible. There are also different USB cable lengths ranging from 1 to 5 meters.
ELP USB Camera 5MP Specifications
|Sensor||OV5640 (1/4” )|
|Max. Resolution||2592 (H) *1944 (V)|
|Pixel Size||1.4µm x1.4µm|
|Maximum Image Transfer Rate||2592×1944@ 15fps MJPEG / 2048×1536@ 15fps MJPEG|
1600×1200@ 15fps MJPEG / 1920×1080@ 15fps MJPEG
1280×1024@15fps MJPEG/ 1280×720@ 30fps MJPEG
1024 x 768@ 30fps MJPEG/ 800 x 600@ 30fps MJPEG
640×480@ 30fps MJPEG / 320×240@ 30fps MJPEG
|Camera Board Assembly technique||SMT (ROSH)|
|Interface||USB 2.0 High Speed|
|Lens Parameter||Size: 1/4, Iris: F2.8, Focus: 3.2mm, FOV: 60Degree|
Relative Illumination (Sensor): 70%
IR Filter: 650±10nm
|Power consumption||150mW （VGA）; 200mW （QSXGA）;|
|Module Size||38mm × 38mm （compatible 32X32mm）|
As an operating system I installed the MotionEyeOS again. It is a Linux distribution which turns your single board computer into a video surveillance system. For more details (installation, configuration) take a look at the previous project.
Many readers have asked me about a USB camera support in this OS. Usually all USB cameras working on Linux are supported. To be sure you should look if your camera works with v4l driver. I had no problems with the ELP module, it was automatically recognized by a fresh installation of the MotionEyeOS (release 20171008):
The screenshots below show the differences between Raspberry Pi camera module v1.3 and ELP USB camera. The biggest difference (lack of colors) is caused by Raspberry module NoIR filter to support additional IR LEDs for night vision.
If you plan to use a Raspberry as a surveillance video system, then I recommend to consider a USB camera. MotionEyeOS is compatible with majority of models and you can choose a quality to fit your project instead of being limited by only two choices of Raspberry Pi camera modules. Do not forget it allows you to keep the camera much further from the board (up to 16 feet/5 meters) and to re-use the camera with any other computer later.