- Health Is Wealth
- Posts
- [TUTORIEL] CCTV camera with Raspberry Pi
[TUTORIEL] CCTV camera with Raspberry Pi
In this new tutorial, we will together make our open source ehealth surveillance camera based on Raspberry Pi.Yes, we are talking about a real open source outdoor surveillance camera, capable of night vision and motion detection, all smart health connected to our Jeedom health home automation box.
Equipment
In order to get started in this project, we will need:
Raspberry Pi 3B + (important)
32GB SD card or higher
Cooling kit
A USB or RaspiCam camera
PVC tube, sleeve and inspection hatch 63 mm
POE Splitter
DC / DC converter LM2596HVS
Camera mounting bracket
Preparation of the Raspberry Pi
Let's get started, for that, we start by installing our cooling kit on our Raspberry PI with a little thermal paste.
Then on the SD card, install MotionEyeOs, it is an open source distribution specially designed to transform our Raspberry Pi into a smart health connected camera. For more information, visit the project's GitHub. Otherwise as an alternative, there are also Shinobi which also does the job very well.We use as usual Etcher who will take care of everything for us.
We then plug in his camera, here I opted for a pro model very close to what we find in commercial cameras. It is a 1080p 30 fps camera with automatic night vision system all on a single USB cable. One thing is sure with this little gem, quality and performance are there even in the darkest night.
To power our camera, we will use POE (Power Over Ethernet), this allows to use two pairs of RJ45 cable to pass a supply voltage there. This saves us from running two cables instead of one. And then understand that this saves us a lot of space in the assembly phase.In order to achieve this, it is imperative to use a Raspberry Pi 3B +, the only model fitted on the card with 4 GPIOs allowing us to easily recover the supply voltage of the RJ45 cable. The 4-pin socket is located under the GPIO, at its right end behind the USB ports.
The voltage supplied by the POE is between 5V and 48V. It depends on your power supply or your switch if it is designed with POE. In order to take this disparity into account, I will use a DC / DC converter to transform the POE voltage into 5V voltage which will be reinjected by the GPIOs.Here, the converter is based on LM2596 which are step-down converters. And more particularly the LM2596HVS (High Voltage) model which is capable of supporting up to 57V input. The card is equipped with a potentiometer intended to precisely regulate the output voltage. I used this module with an output voltage set to 5V. When the adjustment is complete, remember to fix the potentiometer screw with a drop of varnish.All that remains is to secure the assembly in a heat-shrink tubing.On the other side, there is a POE injector which here will inject 48V into the network cable.
The housing of our ehealth surveillance camera with Raspberry Pi
For the case, I started with a PVC pipe that we find in DIY stores with a diameter of 63 mm, which corresponds very little to the width of the Raspberry Pi. To this, we add two sleeves of coupling and a sealed inspection hatch.We start by cutting the plexiglass to obtain a 63 mm diameter disc that we will slide into the sleeve. The separator inside the sleeve will serve as a support in order to glue the assembly.For the pipe, I cut a section of 20 cm. At one end, I created a notch to pass the jack connector of the Raspberry Pi.And for the inspection hatch, I do the same thing in order to be able to remove and put the Raspberry Pi back in its housing once it sticks.
The hard part is made for the case, the rest is more aesthetic than functional. I then reduced the size of the front sleeve so that it does not appear in the field of view of the camera. With a piece of pipe cut in half, I put on a kind of cap aimed at protecting the camera's field of vision as much as possible from dust and water.
Inside, there is a piece of spring-shaped pipe that allows me to properly place the USB camera at the bottom of the case so that it does not move.The whole will be painted black in order to make it more discreet and to give a professional look.
All that remains is to add sachets of anti-humidity granules, a fixing foot, a waterproof PG13 end piece to route the network cable and paint the whole in black.
MotionEyeOs configuration
I said above, with MotionEyeOs we have the possibility of motion detection. It is thanks to the Motion software, it will compare the successive images and determine the number of different pixels and depending on the threshold, trigger a motion detection.The configuration is relatively simple to handle. We start with the system configurations, then add its camera, here a USB camera.
The rest of the settings are up to you. For my part, I activated the motion detection. This will trigger several things.First, send an event to Jeedom via the API. Then it will record the entire sequence and send it to my NAS.
Jeedom configuration
The simplest part, here, we will simply recover the RSTP streaming stream to make it appear on the dashboard. It will also be an opportunity to retrieve the motion detection information, for example to trigger an MMS sending with a photo.
Conclusion
Here we are with our IP surveillance camera with night vision and motion detection, all open source based on Raspberry Pi. Count a hundred euros for the equipment, probably less if you already have equipment at health home.
In any case, it was a real challenge for me to launch our partner CONRAD without whom nothing would have been possible. And we find ourselves very quickly in a new tutorial.
AB SMART HEALTH health home & BUILDING REVIEW