In the previous tutorial, we discovered how to get the official camera (v2.1) up and running for the Raspberry Pi Zero W and send images to the Home Assistant server via MQTT messages. Today, I propose to go further and finalize this project. Everyone does not necessarily want to develop the software part of their camera. There are some very good projects for the Raspberry Pi. First of all MotionPi and MotionEye are two web interfaces for the Motion project. We have already talked about it in several tutorials. ZoneMinder that dates a bit. For this project, I propose to test the Kereros.io project developed in Belgium by Cedric Verstraeten.io (Cédric’s website is here). Kerberos.io is an open source project totally free and free. Cedric has added an online storage of images and videos that allows him to finance future developments and other projects. Activation of this feature is absolutely not required. It simply allows you to view the images recorded by the Raspberry Pi remotely from a web browser (and make the project live). Kerberos.io is a very advanced project that supports all Raspberry Pi models (from model 1 to PiZero W), Armbian distribution (which we will test soon), CSI cameras, USB cameras and IP cameras. .
The benefits of Kerberos.io for a DIY security camera project
First of all, Kerkeros.io is a little more accessible for beginners. If you are new to the Raspberry Pi world and therefore to Linux, there is enough to learn without having to solve library installation problems. Then, Kerkeros.io installs and configures itself in a few minutes. Cedric adapted the source code of the Etcher project, this software edited by Resin.io, which became a few months the reference to install the Linux distributions of our Mini PCs on an SD board. The web interface is modern, clear and almost entirely in French. Outputs are numerous (in addition to the pay cloud storage service):
- Storage on the SD board in the folder /etc/opt/kerberosio/capture/ . It is possible to add a stamp with the date and time of the shooting
- Video: a video stream in mp4 format (codec h264) is available. The video files are stored in the /etc/opt/kerberosio/capture/ default folder. Ditto, we can add a date stamp on each image of the video. It will be possible to recover the video stream very easily from Jeedom or Domoticz for example on port 8889
- GPIO: it will be possible to trigger the high setting of a pin for a certain duration. For example, it will be possible to trigger the lighting of a projector, to light a red LED to indicate that the video system has detected a movement …
- TCPocket, to send a message on a TCP / IP socket. Ideal to trigger the execution of a script from a Python program or Nodejs hosted on a home server. Start a treatment on an ESP8266 …
- Webhock, allows to trigger a treatment via a URL. Kerberos.io sends a JSON document containing several pieces of information (region, number of saved images, path to the keyframe, date / time). Attention, no image is sent
- Finally, we can trigger the execution of a local script if the previous outputs are not sufficient!
That’s it, in addition to supporting all Raspberry Pi models (from model 1 to PiZero W), Armbian distribution (which we will test soon), CSI cameras, USB cameras and IP cameras, Kerberos.io also works on Docker and can be installed on a Linux PC by compiling sources.
Current limitations of Kerberos.io
Since nothing is ever perfect, Kerberos.io still has some gaps. Here are a few
- There is no multi-camera display on the Dashboard
- The dashboard display takes a few seconds (RPI Zero W requires!)
- Only one detection zone available
- No audio recording
- The vertical timeline is a bit confusing. It loads down the page which takes a little time. We have a preview of the last two clips. We gain visibility and speed with a display in the form of thumbnails
If you like coding, you can join the development team on GitHub. The home page is here.
Installing Kerberos.io using KiOS
There are several methods to install Kerberos.io
The first method is to start from a Raspbian Stretch installation (how to do without a keyboard or screen) and then install the Nginx / PHP machine and server. It’s feasible, just follow the tutorial step by step here. However, I encountered two errors. The libpng12.so.0 library does not seem to be installed on Raspbian Strech. It must be installed manually using the sudo apt-get install libpng12-0 command. Then I came across an Illegal instruction message that prevents the startup of the machinery. An issue was recently opened on GitHub. The error was caused by the SSL 1.0.0 library that is no longer accessible under Raspbian. Kerberos version 2.5.0 corrects the problem but the fix arrived too late to be included in this tutorial. This method will be the subject of a future tutorial.
In the meantime, I propose to install Kerberos using KiOS. It is an out-of-the-box version based on an adaptation of Etcher. Just be guided and the system is ready in 5 minutes (well everything depends on your internet connection :)).
Go to this page to download the version that corresponds to your environment (macOS, Windows x86 or 64-bit PC, Linux x86 or 64-bit PC)
Then follow the steps of burning the SD board using the images below. It is best to assign a fixed IP address to the RPIZero. It is much more convenient to connect to the administration interface, retrieve the video stream on a home automation server such as Domoticz, Jeedom, Home Assistant.
KiOS first retrieves a very simplified image of Rapbian and starts flashing the SD board. It is automatically ejected at the end of the burn.
First start of KiOS on the Raspberry Pi Zero W
Connect the camera to the Raspberry Pi and insert the SD board into the player of the RPIZero W. Turn on the power. Wait until the LED is no longer flashing (if you do not have a connected display or you do not have a mini HDMI to HDMI adapter). Open an internet browser and connect to the IP address that you have assigned to the RPIZero simply. Kerberos.io loads a Nginx / PHP web server. At first start, choose your language
Then choose a username and password
And now, it’s ready !
By default, the Raspberry Pi’s camera (RaspiCamera in Settings) is selected. The surveillance camera is directly exploitable. We will see in more detail in a next tutorial all the settings available to us. It’s time to go to the box and the assembly!
To realize this project of surveillance camera, I preferred to use an Asian clone equipped with two LEDs which will allow us to have a system of night vision on about ten meters. To learn more about the compatible 5MP NoIR camera, you can read this comparison test with the official Night Vision v2.1 module.
- Raspberry Pi Zero W
- NoIR compatible Raspberry Pi camera module
- 8x M2x5 self-tapping screws
- Flexible camera adapter tape compatible RPI to RPI Zero W (if not included in the camera kit)
- 2x screws M6 (round head)
- 2x M6x25 butterfly nuts
- 1x screw + nut M4x20
3D printed case for NoIR camera and Raspberry Pi Zero W
Not having found a camera suitable for NoIR cameras with LED, I opened Autodesk Fusion 360 and took my mouse by the hand! The case is pretty basic. The idea is to start from a box that receives the camera module. The front of the case lets out the optics and the two infra-red LEDs for night vision. The camera module rests on 4 feet in the bottom of the case. The Raspberry Pi Zero W is placed above the NoIR camera module. It can be fixed with 4 M3 screws. The hood is closed with 4 M3 screws (at each corner). A bracket will fix the case to the wall with 2 screws or a double-sided tape. An articulation system consisting of a vertical axis and an arm can direct the camera to the area to be monitored. Night lighting is automatic. Each aid being lit using a photo-resistance. Here are some 3D images in different directions.
Here’s how to assemble the camera:
- Begin by pre-drilling with a 2mm diameter drill the mounting holes of the Raspberry Pi and the fixing of the hood. PLA remains a hard material. Even with self-tapping screws, it’s quite difficult to screw.
- The camera takes place in the bottom of the case. It comes in support on the 4 lower legs. The front panel is pierced with several holes (optical, 2x LEDs, 2x photo-resistors, 2x LEDs for later use for example connected to WiFi, LED flashing red to indicate that the camera works).
- The RPI ZeroW is placed above the camera. It comes in support on the 4 legs longer. It can be fixed by 4x M2x5 screws. Each leg is pre-drilled taking into account the inter-axis at the four corners of Pi0. It will be necessary to be careful not to fold the ribbon under penalty of breaking it (sorry, I’m stingy with the PLA).
- A side hole opposite the micro-USB OTG connector will power the RPiZero in 5V / 3A.
- The case is closed using hood screwed by 4x M3 screws at angles
Next, attach the swivel arm to the hood base using a M6x25 screw and a wing nut.
- Insert the M3x20 screw into the rotation shaft housing. Insert the axis of rotation on the mounting foot. You can use a nut or wing nut to lock the position of the axis of rotation.
- Finally, you can fix the other side of the swivel arm on the vertical axis of rotation using a M6x25 screw and a wing nut.
This case allows to fix the camera to the wall. The camera can then be oriented on its vertical axis and inclined with the articulated arm.
All the files are at your disposal so that you can modify and improve the box to your needs. At the moment the files are hosted on the blog and Thingiverse as well.
- F3d file for merge 360
- STL files for 3D printing
That’s it, I hope this project has made you want to immerse yourself in the exciting world of Raspberry Pi and 3D printing! Next time, we’ll do the same thing with an Orange Pi Lite (or OPI Zero if it arrives fast enough). I took advantage of the sales of November 11 to order this USB camera with night lighting. Just wait until she arrives. In the meantime, I will continue to play with Kerberos.io to go a little further in the features.
As it is the period of Black Friday and Christmas, we find a lot of sales on 3D printers, it is a good gift idea to start in the DIY!
- Get Started with HC-SR04, measure distance by ultrasound. Arduino code example
- ESP32, GPIO pins and associated functions. I/O, PWM, RTC, I2C, SPI, ADC, DAC
- ESP32-CAM pinout and equipments. ESP-EYE, AI Thinker, TTGO T-Camera, M5Stack Timer Camera …
- ESP32-CAM. Which model to choose? ESP-EYE, AI Thinker, TTGO T-Camera, M5Stack Timer Camera …
- M5Stack Atomic GPS. ESP32 TinyGPS++ tracker, GPX export on SD card, visualization on Google Maps or VSCode
- Home Assistant. Install the snap on Synology NAS on an Ubuntu Virtual Machine