Monday, January 17, 2011

Really Remote Live Internet Video Streaming on a Budget

The I.T. industry is made up of lots of companies who declare themselves to be solution providers of varying sorts but I wonder how many times a prospective customer really goes to one of these firms and says "I have a problem" and how many times the provider actually has to go off and come up with a solution.

Not too long ago I was presented with an interesting problem that really needed a solution. And an inexpensive one at that.

A good friend of mine asked for my assistance with an I.T. problem he had. He farms for a living and was wondering if some modern technology could take some of the hassle out of his job, in particular the need to be out late or very early checking on livestock during lambing/calving season. He recently built a new shed for baby animal production and wanted to setup a CCTV type system that would let him keep an eye on the beasts over the Internet. We got to talking about his requirements and it quickly became obvious that an IP camera accessed via the Internet was the best fit for his needs. Of course, it's not as easy as simply buying one of these and turning it on, and due to the agricultural nature of the environment there were some unique challenges to be dealt with that you wouldn't encounter in an office setting.

Problem Number One: No Power.
That's right, the first issue to be addressed was that the shed is quite remote and used to house farm animals so there's no electricity supply. Any equipment that was to be installed needed to get power from somewhere therefore some research had to be done. I had a feeling that the answer lay in the caravan/motor home world so I took a look at how electrical power is delivered in those situations. A car battery or similar is obvious, but you don't just remove the plug from your kit and wire the battery up directly, instead a piece of equipment called an inverter (or more accurately, a DC/AC inverter) is attached to the battery and then provides power via a standard 3 pin plug. Inverters are used in caravans and the like to power electrical items like TV's, DVD players, lights, and so on, and are able to provide a fair bit of power over extended periods; running a router and a camera for days and days without charging is no problem to a setup like this.

Problem Number Two: No Internet
Like I said, the shed is off the beaten path so there's no phone line to provide nice and easy broadband Internet access. The quick solution to this is mobile broadband from one of the mobile companies and luckily 3G coverage on O2 and 3 Ireland was available. To be able to use a Mobile USB Broadband setup required a router with a USB port and capabilities to use 3G to access the Internet. The Zoom 4501 router was chosen as it is relatively inexpensive and has quite a good compatibility list for USB modems. 3 Ireland offer a Huawei modem that's on the list and it connected up the first time it was tried, though it did present a sneaky little difficulty later on.

Problem Number Three: DHCP
In my previous posting I discussed the problems with DHCP and broadband and accessing equipment like cameras over the internet without a static IP address. It was working on this project that I really learned about Dynamic DNS and its capabilities and for the most part DDNS worked perfectly. The only problem was with the default configuration of the USB modem which threw off the DDNS routing as it had its APN set to one of two options, and it was the second one I needed. A quick call to the good folk over at 3 Ireland tech support sorted this quickly.

With these challenges sorted out the solution was implemented. The equipment list is actually quite short and as solutions go it's simple, which is always the best kind of solution. A large car battery is connected to a DC/AC inverter to provide power to a router that uses a USB modem to connect to the Internet. Into the LAN port of the router is connected an IP Camera (with pan, tilt, and night vision capabilities) that also gets its power from the battery. The camera has a small webserver on board to enable access to the imagery, controls, and settings. The router has port forwarding enabled so that requests from the Internet are serviced by the camera. The router is also connected to a DDNS provider so that, even though the WAN IP address changes, users can access the camera via a URL.

Doing a small project like this is an absolute joy as there's a surprising amount to be learned along the way and there's a great kick to be gotten from seeing it work - which it does! I was concerned that there'd be major problems or that the end result would be of too low a quality to be useful but luckily it turned out fine.

Like any first attempt at something there are some things that can and will be improved. On the hardware side the camera is an entry level model so it would be the first target for an upgrade in order to improve quality and add in the ability to zoom (a function that adds quite a bit to the price) especially as now I know how the whole thing goes together and therefore the risk of failure is greatly reduced. I'd also change the model of router to one that had the 3G modem built in so all that was needed was a SIM from a broadband provider. The things I'd add in terms of hardware is a small solar panel to charge the battery continuously and a decent IR lamp to better illuminate the shed for night vision. In terms of software, or more accurately configuration, I'm planning on looking at what benefits can be gained from tweaking QoS settings on the router.

All too often I.T. ends up being an over-engineered solution to a non-existent problem. Thankfully this time the problem was real (and therefore worth solving) and the solution simple and inexpensive.

No comments:

Post a Comment