Monday, May 16, 2016

PoE Terrestrial TV

Living in a valley doesn't lend itself to very good terrestrial TV or radio reception, and running several hundred feet of RG7 coaxial cable to an unamplified antenna just doesn't do the trick either. To solve this, and get a few other snazzy features in the process I employed a cheap USB ATSC tuner dongle, a Raspberry pi, some passive PoE injectors, and about 350 feet of UV resistant CAT5 cable.
Raspberry Pi with tuner and buck regulator in project box

The ATSC dongle, raspberry pi, and PoE breakout (along with a 5V switch-mode buck regulator) were shoved in a small waterproof project box with a grommet around the hole for the coax and ethernet cables. This was then attached to a tree with a spring to keep it off the ground. The antenna is a magnetic loop antenna for VHF/UHF signals (although it should be an OK receive antenna for almost any RF band where the wavelength is much larger than the antenna diameter). This antenna is omnidirectional when mounted horizontally as it is in the picture. A simple PVC pipe mount and some bailing wire was used to attach it to the tree.
Antenna and Pi with tuner attached to a tree
I discovered that 12V into the end of the CAT5 was not quite enough to end up with 5V at ~2A after the buck regulator at the end of the cable and resulted in the Raspberry Pi boot-looping. Increasing the input to 24V with a boost converter did the trick however and the Pi booted happily. It seems to be drawing about a third of an amp at 24V at the end so the loss is about 30% which isn't too bad given the length of the cable. Below is the 12V fuse panel this is all connected to in a shed which had a few solar panels and a battery for other purposes already. In the long run a grounding rod and some lightning arrestors are in order to prevent damage to electronics inside the house, as well as for safety.
12V fuse panel connected to solar panels and a battery,
boosted to 24V and then put into passive PoE.
After the Pi booted up I discovered that while I was able to talk to it over the Ethernet cable, I was getting about 60% packet loss which wasn't going to cut it for video streams. To solve this I moved the switch that was originally on the end of the CAT5 run halfway up the hill into another waterproof project box with it's own pair of passive PoE breakouts. This solved the packet loss problem completely and I'm now able to saturate the 100mbit/s link with no packet loss. Thus the real world limit for 100mbit Ethernet is about 200 feet, which is shy of the 100 meters claimed in the specification. Longer distances could be achieved with shielded cable and 802.3af PoE instead of passive PoE which claims two of the four twisted pairs for power only.
Ethernet switch with passive PoE hookups
and buck regulator (switch is 5V)
On the software side of things I chose a wonderful application called TVHeadend to allow for an easy IP based interface to the tuner card complete with a named channel list, electronic program guide (EPG), and DVR capabilities. On the Viewer's side I'm using Kodi along with the TVHeadend plugin which makes for a very pretty and responsive 10-foot interface to all of TVHeadend's capabilities. Aside from the occasional glitch in video due to low signal strength, 1080p video streams are viewable flawlessly and reach up to ~12mbit/s. All of the video and audio streams are sent over the air encoded in MPEG-2 and passed without transcoding to the viewer.

TVHeadend does support transcoding to newer, more efficient codecs, however the raspberry pi it's running on isn't capable enough to do this on the fly (hardware encoding/decoding isn't currently implemented in tvheadend), so MPEG-2 it is. A Pi can also be used as a viewer running Kodi, but you'll need to purchase the MPEG-2 decoder license from the Raspberry Pi Foundation to enable smooth playback.

ItemQuantityUnit Price (USD)Total PriceNotesLink
Raspberry Pi1$35.00$35.00I used model B rev1https://www.raspberrypi.org/
100mbit ethernet switch1$9.95$9.95passive PoE only supports 100mbit/shttp://amzn.com/B000FNFSPY
1000ft UV rated CAT51$67.99$67.99Only used ~350fthttp://amzn.com/B0092TJ4K2
CAT5 termination tools1$13.97$13.97If you don't already have thesehttp://amzn.com/B008UY5WL0
Passive PoE injector set2$6.99$13.98Includes injector/receiver pairhttp://amzn.com/B00NRHNPUA
5V 3A buck regulator2$7.68$15.36Up to ~26V input ratedhttp://amzn.com/B00VI0L94C
total$156.25

In the end this project allowed my parents to watch live local TV in HD with full DVR capabilities without the need for a subscription service even though they live in a valley. The total cost shown above doesn't include the enclosures, 24V power supply, TV tuner dongle (your needs will vary by country, they're all about $20-30 USD) and some other odds and ends such as heat shrink, mounting hardware, etc. Overall not a bad price considering a cable subscription can run more than that per month. Supplement this with other online media sources and you've got a zero or low subscription cost entertainment solution.

No comments:

Post a Comment