How the Surface RT became the most reliable Server in our house (Co-starring: Azure and Windows Phone)

I loved my Surface RT from the beginning. The reason why I preferred the Surface RT over the Surface Pro was that the Surface Pro was too small for me as a Notebook, and too heavy as a tablet. So I was always the Notebook+tablet-guy, and not the one-device-for-all-guy. But you know, this might change with the Surface 3.

Ok, now to this story. When I bought the Surface 2 (RT) in 2013, my Surface RT was a bit unused, as the new version was more light-weight and faster. But I haven’t sold my Surface RT, cause I think it’s still an awesome device. My wife and our kids also loved that device, especially for viewing family-pictures, but they also preferred my new Surface 2. So the Surface RT was a bit unused these days. But since 3 months the Surface RT is again the new superstar in our house.

It all started in early spring this year when we had a lot of break-ins in South Germany, and so in the street I’m living with my family. We already had the issue before the break-ins started that we were not able to see who’s on the other side of the front door. So with that break-in-wave I decided to put some cameras around our house, and I had some requirements:

  • Everyone should be able to see who’s behind the front door
  • Everyone should be able to see around the whole house from inside
  • Cameras should have infra-red-support for night vision.
  • I want to access the cameras from everywhere around the world

I asked an electrician for an offer. But it was just too expensive, and additionally he said he needs to slit some walls, which would cause even more costs as additional work is needed to fix all that. Beside those points my “Nerd”-adrenalin was increasing with every day while I was thinking about my requirements. And so I came up that this project is a totally great project for me – just for me (and you, my faithful blog-reader). So I planned to do the whole stuff on my own.

The whole project can be split up into four parts I want to show you now:

  • Installing the IP-Cameras
  • Surface RT as a Central Point
  • Surface RT connected to Microsoft Azure
  • Windows Phone as a Client

So let’s start with Part I

Part 1/4 – Installing the IP-Cameras

After I looked at the footprint of our house intensively, I planned to install 7 IP Cameras. That number of cameras is necessary to see every area around our house. I drilled holes, crimped RJ45 network cables (yes, I didn’t want to use WiFi for that project. Reason is just to keep electric smog as low as possible), branched off additional plug sockets etc. In the end I had the seven cameras connected to my home network via ethernet-switch. The picture below shows this.

Part1_IPCams

After a lot of research I decided to buy IP Cameras from Vivotek, I took the model IP8332. I tested quite a few, and those where in my point of view really good ones and worth the price. They have a 1280×800 resolution, infrared and they support Power-over-Ethernet. Below a picture of two cameras under the roof framework in 4m height (yes, this project also required to buy a new ladder. :-))

IPCamerasUnderRoofFramework

Part 2/4 – Surface RT as a Central Point

After I had installed all cameras, I wanted to have a central point in our house where anyone could view them all. Especially the camera at the front door. And that’s where my Surface RT came into the game. I connected the Surface RT also to the same network the IP cameras are in, like shown below.

Part2_SurfaceRTasCentral

It took me about 3 hours to build an app that grabs the Video-Streams of my seven cameras, that never closes and that is always running. I placed the Surface RT on a sideboard that stands at a central point in our house. Every time you go to the front door, you’ll pass that point and you can see who’s outside. Here’s a picture what it looks like:

SurfaceRTAsCentral

Clicking on one Camera-image will zoom it up to 100% of the screen (of course with a nice animation). In addition I added a USB-to-Ethernet-Adapter to the Surface RT, as we’re turning off our WiFi during the night. But of course the device should still run.

So now I already met three requirements:

  • Everyone should be able to see who’s behind the front door
  • Everyone should be able to see around the whole house from inside
  • Cameras should have infra-red-support for night vision.

Only one requirement is missing

  • I want to access the cameras from everywhere around the world

I thought that’s an easy one, but there was a problem. Let’s look at that problem in an excursion

Excursion: IPv6 and IPv4

My provider gives my only a physical IPv6-address, but no physical IPv4-address. This is called Dual-Stack-Lite (more here on Wikipedia). When I call an IPv4-server, that call goes in the first step via IPv6 to a proxy of my provider, and from there with a physical IPv4-address to the target host. Unfortunately that IPv4-address is shared with many other users. I never noticed that while I was using the web as a client. But now I wanted to serve the camera-images from my Home-Network.

First trial was to do a Port-forwarding on my Router to the IP-Addresses of my cameras. But the problem is, I don’t have a physical public IPv4-address. My IPv4-address is shared with many other users, and it’s the address of the proxy. I’m not able to reach my home-network with IPv4, the call will end at the proxy!

Ok, so only IPv6 will work.

Second trial was to use IPv6. But then the next problem popped up. The whole mobile communications network in Germany (and also in other/most parts of the world) runs still with IPv4. So to access IPv6-stuff from my mobile, I need to go through another proxy that does the translation from IPv4 to IPv6 and back.

Puh, what a mess. When you read in forums about private NAS (Network attached storage)-systems, you’ll find a lot of that IPv4/IPv6-stuff. But I didn’t like the existing workarounds, and I came up with another idea.

I had the idea of the Hollywood-principle that you might know from developing applications: “Don’t call us, we call you”

Part 3/4 – Surface RT connected to Microsoft Azure

Yes, due to the IPv6/IPv4-issue, I’m not able to access my Home-Network from the Internet in an easy way. But I can upload things from my Home-Network to the Internet. So I had the idea to upload compressed images from my 7 cameras every second. So I need a service that does that job.

As I already had a 24h/7days-running-Surface RT-device, I thought maybe the Surface RT could do that job in addition – beside displaying live-images of the 7 cameras.

But where shall I put those images? For me Microsoft Azure seems to be the perfect place. I could create a secure Azure Website or any other client.

Yeah, that sounds good. I decided to go that way down the road. I extended the Windows Store App running on my Surface RT to upload compressed camera images every second to Microsoft Azure. The connection is done via https. The picture below shows the architecture:

Part3_UploadToAzure

As the camera-images are very small, I thought Azure’s Blob Storage would be a bit overkill for that scenario. So I decided to use Table Storage on Microsoft Azure. I created a simple table that contains the current images of all seven cams. And my Surface RT uploads those images every second. And guess what: My Surface RT does this job without break since three months. And everytime we’ve a visit in our house, people say: “Wow, how crazy is that”. And they think the Surface RT is just displaying a live-view of the cams, but you know now, it’s doing more.

(Btw: The costs for Microsoft Azure are below 2€/Month. If you’ve a MSDN-Subscription, you’ll have 150$ for free)

Part 4/4 – Windows Phone as a Client

Now I’ve all my current camera-images available in Microsoft Azure. So I can do whatever I want with them. I decided to create a Windows Phone App just for me. So I can connect with my Windows Phone to the fresh data on Microsoft Azure that is provided by the most reliable server in our house, the Surface RT. The image below shows the final architecture.

Part4_WindowsPhoneClient

The Windows Phone App does a polling on Microsoft Azure. That’s not the best battery-saving-way, but fine if you just want to view if everything is alright at home. Below is an image of my Lumia 920 that runs the application:

WindowsPhoneAsAClient

Summary

As you can see, the Surface RT, Microsoft Azure and Windows Phone are doing their job really really well. It was simple to build up that architecture, and I was able to fulfill all the requirements I had:

  • Everyone should be able to see who’s behind the front door
  • Everyone should be able to see around the whole house from inside
  • Cameras should have infra-red-support for night vision.
  • I want to access the cameras from everywhere around the world

Alright, after a break when I bought the Surface 2 my Surface RT is used again and more than ever before. And everyone in our house is loving it. Today even my youngest daughter (1,5yo) runs to the Surface RT when the doorbell rings to look who’s waiting behind the front door.

Thanks for reading,
Thomas

Share this post

Comments (22)

  • Cyrill Reply

    I hope that there is the special sign at your front door which states that you are using surveillance cameras. Otherwise you would breach German privacy laws ;-)

    Nice work!

    August 20, 2014 at 12:06 am
    • Thomas Claudius Huber Reply

      Hi Cyrill,

      yes, there is. A small one, but I have one. Anyway, thanks for the hint.

      August 20, 2014 at 7:32 am
  • bulls96 Reply

    Could you share your windows RT and windows phone apps that you used?

    This is a great project!

    August 20, 2014 at 12:10 am
    • Thomas Claudius Huber Reply

      Hi bulls,
      I still need to polish them a bit, as I’ve hardcoded my Azure-Keys etc.

      August 20, 2014 at 7:32 am
  • vj Reply

    awesome

    August 20, 2014 at 1:46 am
  • juan Reply

    Hey
    this is pretty cool application. Congrats!. I’ve been searching for a similar solution with out too much succcess (tried dropcam but didn’t like it and they don’t take non-us clients). Do you think you can share the code for the surface RT and the windows phone app?
    cheers

    August 20, 2014 at 4:59 am
  • frank quednau Reply

    Another project that shows what is possible with today’s technology. Nice. Azure would have the delivery tech too in the form of message queues, but considering your reqs. Polling seems fine ;)

    August 20, 2014 at 7:02 am
  • Mik Reply

    cool!
    this is the next level:
    http://www.codeproject.com/Articles/10248/Motion-Detection-Algorithms
    Your RT could do that, and send you a message if it detects motion outside your house.
    keep on rockin’
    Michael

    August 20, 2014 at 8:09 am
  • How the Surface RT became the most reliable Server in our house (Co-starring: Azure and Windows Phone) Reply

    […] /* 0) { ratingctl00_cphMiddle_cphContent_tr3w45fwwvre_itemRating = result['Rating']; SetCurrentRating('ctl00_cphMiddle_cphContent_tr3w45fwwvre_itemRating_pnlHolder', result['Rating'], "disabled fullStar", "disabled emptyStar", true); if(votesCountctl00_cphMiddle_cphContent_tr3w45fwwvre_itemRating!=null) { votesCountctl00_cphMiddle_cphContent_tr3w45fwwvre_itemRating ++; SetVotesCount('ctl00_cphMiddle_cphContent_tr3w45fwwvre_itemRating_lblUsersRated', '(' + votesCountctl00_cphMiddle_cphContent_tr3w45fwwvre_itemRating + ' votes)'); } SetRatingCookie('r', 'i35947', '1'); } else if (result['Status'] == 1) { alert('The session has expired. Please refresh the page to be able to vote!'); } } /* ]]> */ (0 votes) 0 comments   /   posted by Silverlight Show on Aug 20, 2014 Tags:   windev , wpdev , winrt , thomas-huber Read original post by Thomas Huber at User Interface Rocker Blog […]

    August 20, 2014 at 9:22 am
  • Michel Renaud Reply

    That is one cool setup, and what great reuse for your Surface RT! I’m setting up two cameras in my condo (WiFi) and using a WHS server to monitor and record on motion detection. Not nearly as cool as your setup, but it’s fun tinkkering with that stuff!

    August 20, 2014 at 11:05 am
  • Richard Bushnell Reply

    Really cool! I need to do something like that.

    August 20, 2014 at 2:57 pm
  • Jason Reply

    That is an epic solution!

    August 20, 2014 at 5:38 pm
  • Frank J Garcia Reply

    An excellent setup you got prepared!

    August 21, 2014 at 12:11 am
  • 1Bravo Reply

    Hi Thomas! This is a amazing! I’m in the same boat looking for surveillance system and nothing satisfies me until I saw your article.

    Can’t wait to see if you can make the RT app available. I will gladly pay for it :)

    Would you mind sharing some love in Reddit as well?

    Someone posted an article about your project here:

    http://www.reddit.com/r/Surface/comments/2e4pi6/surface_rt_used_in_a_security_system/

    – Thanks in Advance –

    August 21, 2014 at 1:21 pm
  • Bert Convy Reply

    It’s 3 years later, can I buy the app yet? RT devices are around $35 and consume very little power. It would be great to repurpose them for CCTV, but no apps. Every IP camera I find wants to install x86 software, or has a browser codec that Windows RT cannot load. I can do almost anything on my Lumia 950XL or my i7, but RT devices are perfect for this. I want to mount one to the inside of the front door. thanks

    February 13, 2017 at 6:19 am
    • Thomas Claudius Huber Reply

      Hi Bert,

      no, the app is not available for purchasing. It was too much effort to support several cameras. If you’re a developer, you might be able to do it yourself by using the MJPEG-Stream of your camera, which is quite simple to read.

      February 13, 2017 at 10:44 am
  • Peer Reply

    Hi Tomas, any code snippets, when no apps available. I’ll be happy having your source, this will be much easier to modify existing code, than writing new code ;)

    thx in advance

    December 27, 2017 at 10:16 pm
    • Thomas Claudius Huber Reply

      Hi Peer,

      unfortunately no code snippets available for this. Never found the time to polish it up and make it cam independent.

      Sorry,
      Thomas

      February 19, 2018 at 8:09 pm
  • Antonio Reply

    I am trying to do this exact thing with an old Surface RT laying around. I have 8 cameras and would like to use the RT as a viewing point for all the cameras. Any suggestions on how I can do that? Even if it’s not ‘polished’ I would still like to be able to get something that kind of works.

    April 17, 2018 at 6:42 pm
    • Thomas Claudius Huber Reply

      Hi Antonio, what cameras do you have?

      If they support an MJPEG-Stream it’s quite simple. Get that stream, grab the images and display them in an Image element. This is how I did it.

      May 14, 2018 at 9:02 pm

Leave a Reply to Cyrill Cancel reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.