📜 ⬆️ ⬇️

Video surveillance on orange pi zero - cheap and not at all angry

Recently I set myself the task of implementing video surveillance with the following characteristics:

  1. Low power consumption
  2. The minimum size of a device that will receive video from a camera (or several cameras). With such a small size, so that you can, for example, cram it into an installation box of 10-10 cm or even hide it in a wide cable channel (!)
  3. IP-cameras will be connected via wi-fi, that is, it is impossible to determine who watches / writes video from them. They can be powered from the public network, whether it be access lighting or sockets in the office
  4. There must be a video recording (in my case - on a microsd card), you must be able to view the video via the Internet from anywhere in the world as well as through the mobile application
  5. Of course, it should be possible to remotely configure the entire system - add new cameras, copy-delete recordings, have access to all settings.
  6. The minimum cost! How so? Without this, nowhere

To implement this idea, the choice fell on the following components:

1) The cheapest single-board computer with wi-fay on board, on which you can roll some arm linux distribution kit - for example, my favorite debian. Malinka is expensive, but orange pi zero on ebay will cost you only 900 rubles (a few months ago I bought it at all for 700 rubles). Here is a link to ebay - here.

image
')
2) Actually, wifi ip-cameras - nowhere without them. Small, dome, ceiling. And at least 720p - usually for video surveillance in office-porch conditions more and is not required. The price of the issue is about 1500 rubles per camera. What to go far, here on aliexpress - here

image

3) MicroSD card 32 GB. Why 32 and not more or less? Because for my case, you need to be able to unwind the video from two cameras for a few days ago. Well, therefore, another 300-400 rubles.

4) Power adapters for single board and for cameras.

So what has been done. Having received the treasured parcel at the post office, I took out an orange monolayer, inspected it and first thought, damn it, but there is no video output here. How to install debian and video surveillance software and make initial settings? Immediately I remembered that on Malinka there was always the usual composite AV, but here it is not. Well, it can not be that the manufacturer does not leave such an opportunity as to connect on the composite - I thought, and went to Google to watch the pinout of the GPIO. Yeah, the second pin is land, and the 9th is tv-out.

Solder av-socket. Now let's use the AV-> VGA adapter (you guessed it, you can also buy it on aliexpress, a useful thing) and connect to our monitor. But we will not include anything yet - after all, we have not yet prepared a microsd card.

Go to the website www.orangepi.org and download the distribution package of the Debian xfce desktop, write it to the map with the win32 disk imager or etcher program. We stick the flash drive into our orange, turn on the monitor, connect the power adapter and ... nothing. This is what newcomers most often encounter - a single-board computer does not boot in any way, but only mockingly glows with a yellow diode. What is it? Incorrectly recorded card (maybe), non-working single-board (hardly, after all, we just unpacked it), no signal from the video output? The most common problem is nutrition. Orange pi, like the raspberries and other monoplatniks, is very picky about the power supply - the adapter should be 5 V / 2 A, if the adapter is weak and the power sags in the first seconds of switching on the single-board device, then it will not work and it will not work. So use a good powerful power supply, not charging from your old android.

We connect a good power adapter, we see how the debian boot went. We see the desktop - great! Now you need to configure the device so that it works through wi-fi. We go to the network connections, create a new Wi-Fi connection, enter our login password from the home-office Wi-Fi - now the device is in our local network and has access to the Internet! Now we need to get rid of the monitor.

In order to be able to see the desktop remotely, the vnc viewer program will help us, and the single-board program will help us with the vnc server. Typically, this thing is already built into the debian, which is distributed by the manufacturer of single-card data, you only need to configure it - enter the authorization parameters, etc. Making sure that we now have access to the desktop inside our local network, we remove the monitor, hide the device in a box / cable channel / somewhere else, and tune everything else through the vnc viewer, while behind a familiar computer.

A zoneminder was selected as the surveillance software. Why precisely he? Free, flexible, easy to configure, and available in arm-version for our single-board with debian. This software works on php / mysql, so the first thing you need to install the necessary packages:

sudo apt-get install php5 mysql-server php-pear php5mysql php5-gd 

Next, we need to add a line to /etc/apt/sources.list:

 deb http://ftp.debian.org/debian jessie-backports main 

We execute an update:

 sudo apt-get update 

And finally, for the sake of which we all started it:

 sudo apt-get install zoneminder 

When the console tells us that zoneminder is installed, we’ll go on to configure it. The configuration process is described in detail on the official zoneminder website, it makes no sense to list all of its items in this article, so we’ll decide that a dear reader has coped with this, and now if we type in our computer’s web address / zm web browser in the browser. Here we need to add the ip-addresses of cameras, set video recording parameters and so on.

image

Now we can watch video from cameras through the browser from the internal network, and both through the wired network and via Wi-Fi.

image

But the task was to watch the video over the Internet from anywhere in the world - and this we have not yet implemented. So let's implement! At least two options come to mind:

  1. Go through the remote desktop like a timviewer. Alas, a timuver more or less correctly works only on “raspberries”, here even with a tambourine and spells nothing can be achieved
  2. We have a dedicated ip, go to the settings of the router, forward the necessary ports, configure the virtual server, now we can see the zoneminder admin, for example, at our_white_ip : 123. This is good, but what if there is no dedicated ip?
  3. If there is no selected ip, then remember about vpn and dyndns. A large number of articles, including those on Habré, are devoted to this. Look for and find information.

Now it remains to add the ability to watch videos from the phone. Downloading for our android application zoneminder client mobile (easy to google), and for iphone - Surveillance Pro.

image

image

Total, for several thousand rubles, we get our own mini-server of video surveillance, which can be easily hidden in the cable channel and which consumes electricity for a penny, a couple of wireless cameras, and the ability to always watch from a computer or phone from any place where there is Internet. what happens in your office / garage / porch.

Source: https://habr.com/ru/post/454132/


All Articles