Quantcast
Channel: User Interface Rocker » WinRT
Viewing all articles
Browse latest Browse all 9

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

$
0
0

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 to small for me as a Notebook, and to 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) last year, 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 of 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


Viewing all articles
Browse latest Browse all 9

Latest Images

Trending Articles





Latest Images