Surface Pro 4 Flickergate Got You Down? Need To Re-purpose Your Old Flickering Surface Pro 4?
I’ve recently needed to set up a home security system at home. Sure, I could have spent a small fortune on an NVR system (networked video recorder) with cameras and saved myself a bit of time. And if you’re not technically minded that’s exactly what I’d recommend to be fair.
But, if you don’t mind a bit of tinkering and you have a Surface Pro 4 with a broken screen (either due to flickering or because it’s cracked and doesn’t work properly) then this article might be of interest. It’s written based on my own experience, so there may be steps that you don’t need, or I may have missed some steps that you might need (though I suspect not, cos I started with nothing). Some of the items are definitely optional. In reality, you need a Surface Pro 4 (a 3 might work too, not sure, not tried). You also need a wireless router (preferably with some spare hardwired ethernet ports but not essential). Finally you’ll need a wireless camera. I’ll list the optional extras I used below.
Surface Pro 4 for Home Security – Will It Work?
One of the biggest questions I had when I embarked on this little experiment is whether or not the Surface Pro 4 processor and GPU is powerful enough to take on the role of decoding and storing video streams from security cameras. In my case, I actually only needed one security camera just to cover the back garden. Nevertheless, it’s still a fairly demanding application so I wasn’t sure if the Surface Pro 4 was up for it.
Turns out, that for one camera at least, the Surface Pro 4 is plenty powerful enough. I suspect, but haven’t tried yet, that it would cope with probably 3 cameras before getting too bogged down. It might do 4.
Don’t Use MS Windows For This
Now, to be fair, there are some good applications available for Windows and Home Security, such as Blue Iris for example. It’s fully featured and works well. But it requires a decent server to operate and the Surface Pro 4 is going to need all the help it can get.
Windows 10 requires a fairly sizeable amount of RAM and disk just to do its thing. RAM is going to be one of the biggest restrictions on this build so that’s why I recommend going with Ubuntu Server instead. For the surveillance software I’m going to use ZoneMinder.
ZoneMinder is free and open source. It runs on Linux. I did initially try to run it using WSL2 but I found that I couldn’t connect to the necessary ports through WSL. Seems there’s an ongoing issue with WSL2 networking where only the first port that’s opened can be mapped or something. I didn’t try to hard to fix it to be honest, I decided a vanilla Linux installation was better.
Advantages of a Surface Pro 4 Running ZoneMinder for Home Security
- It’s thin and light and can easily be hidden in a cupboard somewhere.
- Built in wireless (caveat, you’ll need to follow the instructions below to get it working though).
- ZoneMinder and Linux is free and Open Source.
- It’s power failure tolerant. (Though your cameras may not be)?
- Surface Pro 4 is cheap and plentiful on eBay if you don’t need a functioning touch screen – which you don’t for this.
Disadvantages of a Surface Pro 4 Running ZoneMinder
- RAM and CPU/GPU are not upgradeable
- Will probably only support up to 4 cameras – if that.
- Must use wireless network – unless you add a USB ethernet port (which is easy to do though).
- Limited hard disk space – but external hard drives can be bought and added.
- Linux and ZoneMinder can be hard to install and maintain. But don’t let that put you off – there’s a huge amount of information on the internet about them both and this article will get you up and running before you know it.
Preparing To Use a Surface Pro 4 with ZoneMinder for Home Security
OK, so you’re sold on the idea – let’s get on with How To.
What Equipment Will You Need?
- A Surface Pro 4. A Surface Pro 3 may work too but likely will not support as many cameras.
My Surface Pro 4 I am using is a Core i5 processor, with 128G NVME hard drive and 4G of RAM.
- USB3 Flashdrive (USB2 is OK, but 3 is significantly faster). 4 Gigabytes or bigger is recommended.
- A Linux (Ubuntu is what I use in this article) distribution. You do not need ZoneMinder yet.
- A Surface Pro 4 power adaptor of course.
- At least 1 IP camera that supports ONVIF protocol. I’ll list 2 that I’ve used successfully with ZoneMinder at the end of the article.
Optional Equipment That Might Be Required
- A computer monitor or TV that accepts HDMI inputs. This is required if your Surface Pro 4 screen is damaged and can’t be viewed. In my case my Surface Pro 4 literally had no screen at all.
- A MiniDisplay Port to HDMI adaptor if you’re needing the external screen as above. These are available from Amazon and are very reasonably priced. They’re plug and play.
- USB3 Hub with Gigabit Ethernet connection. This is only needed in a couple of scenarios;
- You want to use a wired ethernet connection for speed and stability
- Your TypeCover isn’t working (or you don’t have one) – in which case you’ll also need a USB keyboard. Because you need to boot from USB device to install Linux you can’t plugin your keyboard to the only USB slot on the SP4. Annoying, they should’ve at least provided 2 ports…
- A drill if you’re mounting outside on a wall. The physical installation of cameras is beyond the scope of this HowTo though.
- Ladders etc. See above list item though.
- Power near to the camera. Also, potentially enough ethernet cable length if your camera is going to be wired, not wireless.
I’ll list all these items with pictures and details at the bottom of the article.
Download Ubuntu Server and Flash to USB
The first step of the process is to grab a copy of Ubuntu Server;
Why Ubuntu Server? Why Not Ubuntu Desktop?
You can use Ubuntu Desktop if you want to. But it’s bigger, takes up more space on the hard drive, is a bigger download and most importantly it will boot up with a graphical user interface.
You’re using a Surface Pro 4 with a broken screen. So I’m assuming you don’t really want a graphical user interface (GUI). A GUI takes up unnecessary RAM and processing cycles that are best left for ZoneMinder to process camera data. There’s nothing you need to do that can’t be done from the terminal or web browser once it’s all set up anyway 🙂
There is one problem with Ubuntu Server though – and that is that it does not support wireless out of the box. If you’re using the USB3 Ethernet solution above that won’t be a problem, but if you’re relying on wireless you’ll need to pay attention to the part below about getting wireless working.
Install Ubuntu 20.04 LTS Server on Surface Pro 4
In a previous version of this article I had gone through step by step instructions on how to install Ubuntu Server on your Surface Pro 4. However, it since transpired that other articles I’m writing or have written also need to install Ubuntu 20.04 LTS Server on a Surface Pro, so I’ve pulled the instructions out of this article and into a separate standalone article. To see how to install Ubuntu Server on Surface Pro 4, including how to get Wireless networking working – please visit this article (will open in a new window/tab).
Installing ZoneMinder on Surface Pro 4
So, if you’ve made it this far you probably deserve a medal. This has been a long long post hasn’t it. It’s still going! But you’re over the brunt of it now, you’re almost there.
There’s a couple of ways you can install ZoneMinder to run on your Surface Pro 4, and the level of technical detail required depends largely on how you want to be able to access the system. I’m not going to go into detail about how to setup an NGINX server to act as an SSL gateway to provide secure connectivity because this article is getting too big. If you want to do it, let me know in the comments and I’ll write a guide if you can’t find what you need on the internet already.
I’m going to set it up so that you can access the ZoneMinder web interface using ZoneMinder itself with no SSL security. This is OK provided you only want to access ZoneMinder from inside your local network. Don’t open your ZoneMinder setup to the rest of the world if you haven’t got SSL protection.
Install Docker on Ubuntu 20.04 on Surface Pro 4
So, I use ZoneMinder on 2 different servers and I’ve used the Docker method on both systems. It’s by far and away the easiest way to install ZoneMinder and the database required to run ZoneMinder on Ubuntu Server on Surface Pro 4 machines.
Installing docker on our new Ubuntu server is easy. The following guidance is taken from the official Docker Docs site.
First we need to setup our new Ubuntu Server on Surface Pro 4 to use the official Docker repository. It’s simply a case of entering the following commands on the command line;
sudo apt-get update sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg-agent \ software-properties-common
Then, to make sure we’re getting the software from the official source, we add the Docker GPG key and check it using;
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo apt-key fingerprint 0EBFCD88
If the final command gives you no output then the key didn’t get installed correctly. Now, we can add the Docker repository to our Surface Pro 4’s Ubuntu Server software sources using;
sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable"
And finally we can install Docker with;
sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io
Allow non-root User to Run Docker Applications
You don’t need, or want, to have to run your ZoneMinder server as root. You only want to use the ‘root’ user (the administrator user) for administration tasks on the server itself. So to make it so that your normal Ubuntu server user can use Docker we need to give them permissions. This is straightforward;
sudo usermod -aG docker your-user
In my case, my normal user account is called steve so, the command I would issue is sudo usermod -aG docker steve – this tells your Ubuntu server to add the user ‘steve’ to the ‘docker’ group. Anyone in the ‘docker’ group is allowed to run docker!
You’ll need to log out of the console session and log back in for the new group permission to be added. You do not need to reboot – just log out and back in is fine.
Type the command;
docker run hello-world
If it works – you’re sorted. If you get an error you probably messed up the group permission step above, or didn’t logout and log back in again properly…
Install Docker Compose
Our ZoneMinder Docker installation uses a tool called docker compose to make life easier. So we’ll need to install that too. We can do that with the following commands;
sudo curl -L "https://github.com/docker/compose/releases/download/1.27.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose
SetUp ZoneMinder On Ubuntu Server on Surface Pro 4
I have tended to run all my Docker applications on my servers from a separate subdirectory – so I create a directory called, for example Apps using;
mkdir Apps cd Apps
Next we’re going to use Docker Compose to run our ZoneMinder container. We’re going to use the excellent docker container image maintaned by Dan Landon, which is available at https://github.com/dlandon/zoneminder and contains instructions for how to set it up on Docker. We’re going to use a slightly different way just because I prefer Docker Compose.
mkdir ZoneMinder nano docker-compose.yml
Then, copy and paste the following file contents into the nano screen;
version: '3.7' services: ZoneMinder: image: dlandon/zoneminder container_name: Zoneminder volumes: - ./config:/config:rw - /data:/var/cache/zoneminder:rw ports: - '8080:80/tcp' - '9000:9000/tcp' network_mode: bridge privileged: true shm_size: 2g environment: - TZ=Europe/London - PUID=99 - PGID=100 - INSTALL_HOOK=0 - INSTALL_FACE=0 - INSTALL_TINY_YOLO=0 - INSTALL_YOLO=0 restart: unless-stopped
Once again, indentation is vital because this is a YAML file. If you get the indentation wrong it won’t work.
There’s a few points to note here. Firstly, I have set up a mounted volume called /data – this is where my ZoneMinder installation will write it’s video and audio files. I’ve created this separately on an external spinning hard drive. SSD is not a good choice for storing the video files because it will wear out too quickly. I use a 4 Terabyte Western Digital Drive for this and I’ll go into more detail about how to format it and mount it in a moment.
You’ll also notice the ./config volume. You can ignore this – Docker will create this the first time you run the container and ZoneMinder will populate it. It will be a subdirectory in your Apps/ZoneMinder directory though so you can inspect its contents.
Don’t start ZoneMinder yet, unless you have your data drive setup, which we’re going to do now.
Setup A Data Drive For Your ZoneMinder Application
Before we start ZoneMinder for the first time, we need to make sure we can put it’s images and audio files somewhere, along with any other data files it needs. Depending on how many cameras you’re going to use and the resolution of those cameras, you may need hundreds of Gigabytes of storage. If you want to store them for weeks or months, you may need terabytes of disk space.
If you’re just going to be testing your setup you don’t need to set up a special drive yet. Just issue the following command;
sudo mkdir /data
This will create the data directory for you. This is needed whether you’re going to use external storage or not. So for now, if you’re just testing, you can ignore setting up an external drive and skip to the next section.
I use a Western Digital 4 Terabyte USB 3 2.5″ drive for storing my data on. It’s compact, uses very little power and it’s perfectly fast enough for what we’re going to do. However, you may find you’re limited to perhaps 4 cameras at most because this is a very lower powered solution (ie, the Surface Pro 4 running ZoneMinder at all is low powered). I run two cameras and it’s OK.
OK, so to setup the external disk you’ll need to plug in your disk into the USB port on the Surface Pro 4. Then issue the command;
You should see a drive, probably listed as /dev/sda somewhere in that list. The ONLY way to tell it’s the right disk is to look at the size. Make sure the size matches the drive (within a few Gigabytes) that you just plugged in. If it’s showing as /dev/nvme0n1 that’s the wrong disk. The one that starts with nvme is your Surface Pro internal disk.
In order for Linux to use the disk as storage for your ZoneMinder, you’re going to need to reformat it. This is dangerous and could cause data loss. Make sure you issue the commands for the right disk.
sudo mkfs.ext4 /dev/sda1
Now that we’ve formatted it, we want to be able to mount it. But we don’t want to rely on Linux always assigning it the /dev/sda1 device, because it might not. So we can instead use a Unique Universal IDentifier (UUID) to mount it where we want it. To find out the UUID of the drive you’ll need to do;
Then look for the ‘UUID=’ portion of the results which correspond to the drive you just formatted.
If you’re running these commands using an SSH terminal session, copy the UUID= section for later use. If you’re on the console using a keyboard, take a photo with your phone or write the UUID down. Next we need to make sure Linux can mount the disk every time we reboot (if it’s attached). To do this, we’re going to edit /etc/fstab ( FileSystem TABle ).
sudo nano /etc/fstab
At the bottom add the following line;
/dev/disk/by-uuid/THE_UUID_YOU_FOUND_HERE /data ext4 defaults 0 0
And exit the file. You can then issue the command;
sudo mount -a
to mount the external drive now. Next time you reboot it should mount automatically.
Before we start ZoneMinder we will need to know the IP address to point our web browser to later. To do that, type the following command;
Look for the line which starts with ‘inet’ underneath wlp2s0 in that output. In my case it’s 192.168.2.50/24 but yours will differ. Ignore the /24 on the end. But remember the number at the beginning – maybe write it down somewhere…
Now we can start ZoneMinder using the command;
from the Apps/ZoneMinder directory we created earlier. Once it’s finished installing and the screen has stopped scrolling, if everything went well you should be able to point your web browser to the new ZoneMinder installation.
Open up your favorite web browser and in the address bar type;
Change the 192.168.2.50 to be whatever number you found earlier.
Congratulations – You have successfully installed ZoneMinder on Ubuntu Server on Surface Pro 4 !!
Good Budget Cameras For ZoneMinder
It might seem a little weird to put the camera information at the end, but I suspect if you’re asking how to setup your Surface Pro 4 to run ZoneMinder you probably already know which cameras you want. But if you don’t, these are the two cameras I’ve used.
It’s worth noting that some reviews on Amazon suggest these cameras call home and have firmware bugs which can enable them to be viewed remotely without any password. I don’t know if this is true or not when using their own software and set up – but I do know it’s not true if you’re using ZoneMinder to provide viewing for the cameras. This is because, even if you want to view the cameras from outside your home network, you’ll be exposing ZoneMinder ports (which is secure) not the cameras ports.
It’s perhaps also worth mentioning that you will need an IP based camera that supports H264 or H265 and preferably ONVIF. You can’t use an analogue camera in this setup. If you want to use analogue cameras you’d need to look at a dedicated home security box for that. Which renders the whole point of repurposing your Surface Pro 4 as a home security recorder pointless…
So, here’s the two cameras I use with ZoneMinder and they both work quite adequately for budget home security cameras attached to ZoneMinder.
These are the main cameras that I use at home. You can easily recognise faces of people walking up the driveway to my front door, or trying to hop over the fence at the back. The SV3C ProHD cameras come with a built in microphone which is also compatible with ZoneMinder so you can record any conversations or sounds that might be happening too.
Do be aware that recording images and/or sounds might be subject to special legislation depending on where you are. Most places will allow you to record on your own premises if you’re not able to see anyone in public. But, recording sounds is not so easily controlled. Check your local laws and by-laws to make sure.
Anyway, these cameras have good infra-red night vision and the little LEDs glow red around the outside when they’re active. They’re not overly bright, but they’re enough to let someone know they’re being watched if they think that maybe the camera is a dummy. And if they check with their phone, they’ll certainly see them glow. So they’ll know they’re not fake camera housings.
These cameras also support PoE (Power Over Ethernet) which is how I use them. This means that when they’re attached to a PoE compatible hub, you do not need to run separate power cables as the ethernet cable itself will also supply power. This makes for a superb fitting outside with no cables visible and the camera can be located a long way away from any power source.
They’re easy to configure and provide 2 separate streams – one lo-res stream and one hi-res stream. I use the lo-res stream on ZoneMinder to provide the motion detection and then the hi-res stream is recorded if there is motion detected on the lo-res stream. This is fantastic for the Surface Pro 4 because processing a lo-res stream uses a lot less CPU power and means you can run more cameras at once.
I have found though that running 2 cameras with both streams is about as much as the Surface Pro 4 can handle, and if you watch the live stream at the same time you’ll definitely start the fans whirring but it does cope. You can probably tweak ZoneMinder and the camera output to go a little easier on the Surface Pro 4 processors by reducing the framerate and image resolution at the camera if you needed to.
I use this camera on a different ZoneMinder installation. I personally prefer the SV3C cameras although there are some advantages to these ieGeek Wireless cameras. Notably, they’re wireless.
Having said that, in our usage scenario we went with wired anyway. To my knowledge they do not support PoE (Power Over Ethernet) and require a separate power supply available even if you’re using them in wired mode.
They do work well in wired mode, providing decent image quality which is comparable to the S3VC cameras listed above at similar range. The night time infra-red also works similarly to the SV3C and provides reasonable quality night time surveillance.
But, beware with wireless. It works, but it requires a really good signal. And if you’re mounting outside on a brick wall (such as we were) the signal was marginal even though the wireless hub was only about 15 feet the other side of the wall. Hence, we went wired anyway. Like I say, it worked but I wasn’t happy with it.
Also, remember, if your Surface Pro 4 is using WiFi and the camera is using WiFi then you’ll have some potentially serious traffic problems and slow downs. If possible, run a separate WiFi SSID (on a separate channel if possible!) for the camera and Surface Pro to keep your other wireless devices, such as phones and streaming TV’s from competing for the airwaves.
Nevertheless, for budget home surveillance cameras that work with ZoneMinder, both these are good options;
So, does the Surface Pro 4 work as an affordable home security network video recorder? The short answer is yes, if you use ZoneMinder on Ubuntu Server. But I wouldn’t recommend any more than 2 cameras if you’re running them at High Definition 1080p. It might manage more at 720p but I haven’t tried.
It does have the advantage of being extremely slim, light and very easy to hide somewhere – potentially making it more secure. Also, being very lower power requirements it could work nicely for a security system for a caravan or #vanlife security system. Being so slim means you could potentially hide it somewhere to reduce the risk of it being discovered and therefore stolen as well. Of course, if the whole van is stolen then you wouldn’t have any footage to see where it went unless you managed to upload to the cloud as well. But for the average CamperVan security system it could work nicely without putting too much pressure on your limited electricity system.
Indeed, it’s the usefulness as a vanlife security system that made me investigate it myself because I’m hoping to convert a camper van soon… Watch this space for that one lol.