Thursday, January 22, 2015

Homemade Yagi antenna - design and model


In addition to the Gray-Hoverman antenna I designed and built, I wanted to construct a single-channel Yagi antenna to try and receive channel 19 - the one weak signal in my area.  As with the Gray-Hoverman design I used 4nec2 to design and model the antenna.


Here's the actual NEC file.  Feel free to download, use, modify, etc.  If you're interested in building this model, I suggest using this file and 4nec2 to get the exact dimensions of each element.

CM D--EVAL --num-cores=2 --uhf
CE
SY RAD=0.003175
SY FRAD=0.00215
SY DIPOLE_WIDTH=0.3
SY DIPOLE_HEIGHT=0.039
SY DIPOLE_A=DIPOLE_HEIGHT/3.41421356
SY DIPOLE_Z=DIPOLE_HEIGHT/2
SY DIPOLE_CENTER=0.013
SY REF_Y=0.296
SY REF_X=0.14
SY EL1_Y=0.261
SY EL1_X=0.07
SY EL2_Y_DIFF=0.008
SY EL2_X_DIFF=0.151
SY EL2_Y=EL1_Y-EL2_Y_DIFF
SY EL2_X=EL1_X+EL2_X_DIFF
SY EL3_Y_DIFF=0.008
SY EL3_X_DIFF=0.2
SY EL3_Y=EL2_Y-EL3_Y_DIFF
SY EL3_X=EL2_X+EL3_X_DIFF
SY EL4_Y_DIFF=0.002
SY EL4_X_DIFF=0.214
SY EL4_Y=EL3_Y-EL4_Y_DIFF
SY EL4_X=EL3_X+EL4_X_DIFF
SY EL5_Y_DIFF=0.013
SY EL5_X_DIFF=0.2
SY EL5_Y=EL4_Y-EL5_Y_DIFF
SY EL5_X=EL4_X+EL5_X_DIFF
SY EL6_Y_DIFF=0.007
SY EL6_X_DIFF=0.278
SY COND=2e+07
GW 1 1 0 -DIPOLE_CENTER/2 -DIPOLE_HEIGHT/2+DIPOLE_Z 0 DIPOLE_CENTER/2 -DIPOLE_HEIGHT/2+DIPOLE_Z FRAD
GW 2 9 0 -DIPOLE_WIDTH/2 DIPOLE_HEIGHT/2+DIPOLE_Z 0 DIPOLE_WIDTH/2 DIPOLE_HEIGHT/2+DIPOLE_Z RAD
GW 3 5 0 -DIPOLE_WIDTH/2 -DIPOLE_HEIGHT/2+DIPOLE_Z 0 -DIPOLE_CENTER/2 -DIPOLE_HEIGHT/2+DIPOLE_Z RAD
GW 4 5 0 DIPOLE_WIDTH/2 -DIPOLE_HEIGHT/2+DIPOLE_Z 0 DIPOLE_CENTER/2 -DIPOLE_HEIGHT/2+DIPOLE_Z RAD
GW 5 1 0 -DIPOLE_WIDTH/2 -DIPOLE_HEIGHT/2+DIPOLE_Z 0 -DIPOLE_WIDTH/2-DIPOLE_A -DIPOLE_HEIGHT/2+DIPOLE_A+DIPOLE_Z RAD
GW 6 1 0 -DIPOLE_WIDTH/2 DIPOLE_HEIGHT/2+DIPOLE_Z 0 -DIPOLE_WIDTH/2-DIPOLE_A DIPOLE_HEIGHT/2-DIPOLE_A+DIPOLE_Z RAD
GW 7 1 0 -DIPOLE_WIDTH/2-DIPOLE_A -DIPOLE_HEIGHT/2+DIPOLE_A+DIPOLE_Z 0 -DIPOLE_WIDTH/2-DIPOLE_A DIPOLE_HEIGHT/2-DIPOLE_A+DIPOLE_Z RAD
GW 8 1 0 DIPOLE_WIDTH/2 -DIPOLE_HEIGHT/2+DIPOLE_Z 0 DIPOLE_WIDTH/2+DIPOLE_A -DIPOLE_HEIGHT/2+DIPOLE_A+DIPOLE_Z RAD
GW 9 1 0 DIPOLE_WIDTH/2 DIPOLE_HEIGHT/2+DIPOLE_Z 0 DIPOLE_WIDTH/2+DIPOLE_A DIPOLE_HEIGHT/2-DIPOLE_A+DIPOLE_Z RAD
GW 10 1 0 DIPOLE_WIDTH/2+DIPOLE_A -DIPOLE_HEIGHT/2+DIPOLE_A+DIPOLE_Z 0 DIPOLE_WIDTH/2+DIPOLE_A DIPOLE_HEIGHT/2-DIPOLE_A+DIPOLE_Z RAD
GW 11 9 -REF_X -REF_Y/2 0 -REF_X REF_Y/2 0 RAD
GW 12 9 EL1_X -EL1_Y/2 0 EL1_X EL1_Y/2 0 RAD
GW 13 9 EL2_X -EL2_Y/2 0 EL2_X EL2_Y/2 0 RAD
GW 14 8 EL3_X -EL3_Y/2 0 EL3_X EL3_Y/2 0 RAD
GW 15 8 EL4_X -EL4_Y/2 0 EL4_X EL4_Y/2 0 RAD
GW 16 7 EL5_X -EL5_Y/2 0 EL5_X EL5_Y/2 0 RAD
GE    0
LD    5    0    0    0    COND
GN    -1
EK
EX 0 1 1 0 1 0 0
FR    0    7    0    0    500    1
RP    0    1    73    1510    90    0    1    5    0    0
EN


The big question is - after construction, how did it perform?  I compared the antenna to a Channel Master 4-bay antenna (CM4221), which is kind of an unfair comparison since the Channel Master is a wide-band antenna whereas the yagi is designed for one frequency.  Anyway, I mounted each antenna in the same location and used my TV to scan for all channels.  For each digital channel I wrote down the average signal strength.  My TV reports two signal numbers, the overall signal level in percentage, and the signal-to-noise ratio in decibels.  For both numbers, higher is better.

Channel CM4221 Yagi (ch. 19)
15 98% (32db) 98% (31db)
16 89% (26db) 89% (27db)
19 56% (15db) 62% (20db)
24 95% (29db) 98% (30db)
31 84% (25db) 76% (22db)
34 89% (27db) 78% (23db)
41 87% (26db) 87% (26db)
50 98% (32db) 62% (17db)

As you can see, at the design frequency (ch. 19) the yagi outperforms the Channel Master.  For the most part, all other channels the Channel Master outperformed the yagi (as expected).  I was surprised to see channels 16 and 24 where better than the Channel Master, probably because those channels aren't far off of the designed channel.

Even with the antenna specifically designed for one channel, I was disappointed with the results.  62% is very low, I expected at least 80.  But I think the main problem was the mounting location which was 1 foot away from and behind my house from the broadcast antenna.  I could move the antenna and try again, but it's actually moot.  In the few weeks it took me to design, build, and test this antenna, channel 19 installed a low power digital repeater closer to my house.  So I no longer need this dedicated yagi antenna.  I guess you could say it was obsolete before it was completed.  Oh well, good thing it was relatively inexpensive to construct.  I estimate the cost of materials at $20.


Here is a youtube video I uploaded showing design and construction of the antenna.


Here are download links useful to antenna modeling:
4nec2 - http://www.qsl.net/4nec2/
nikiml's python scripts - http://clients.teksavvy.com/~nickm/scripts.html
Optimized versions of the NEC2 engine - http://users.otenet.gr/~jmsp/

Homemade Gray-Hoverman antenna - design and model


I recently designed and built a homemade antenna for TV reception.  The design is called a Gray-Hoverman.  The idea behind this antenna is to replace my existing Channel Master 4-bay antenna (CM4221).  There is nothing wrong with the Channel Master antenna, mainly I'm just curious if I can construct a better antenna.  That's the type of nerd I am. :)

To design the antenna I used a free piece of software called 4nec2, which allows you to design and model (or predict) how the antenna will perform.  I also used some python scripts to optimize the design.  I'll include links to all the software below.  I'm not going to go into the details on antenna modelling and the use of 4nec2 as it's a very complicated subject that took me a while to learn.

The Gray-Hoverman design I came up with is optimized for my specific area.  The TV channels in my area that I care about are 15, 16, 19, 24, and 31.  So my design is optimized just for this range.

Here's the actual NEC file.  Feel free to download, use, modify, etc.  If you're interested in building this model, I suggest using this file and 4nec2 to get the exact dimensions of each element.
CM D--EVAL --num-cores=2 --uhf
CE
SY GAP=0.086
SY RAD=0.003175
SY FRAD=0.00229
SY SRAD=0.00635
SY SX=0.121
SY SY=0.642
SY SZ=0.054
SY COND=2.0e7
SY L=.1629
SY W=0.109
GW    1    1    0    -GAP/2    0    0    GAP/2    0    FRAD
GW    2    11    0    GAP/2    0    0    GAP/2+L    L    RAD
GW    3    11    0    GAP/2+L    L    0    GAP/2    2*L    RAD
GW    4    11    0    GAP/2    2*L    0    GAP/2+L    3*L    RAD
GW    5    4    0    GAP/2+L    3*L    0    GAP/2+L+W    3*L    RAD
GW    6    11    0    GAP/2    0    0    GAP/2+L    -L    RAD
GW    7    11    0    GAP/2+L    -L    0    GAP/2    -2*L    RAD
GW    8    11    0    GAP/2    -2*L    0    GAP/2+L    -3*L    RAD
GW    9    4    0    GAP/2+L    -3*L    0    GAP/2+L+W    -3*L    RAD
GW    10    11    0    -GAP/2    0    0    -GAP/2-L    L    RAD
GW    11    11    0    -GAP/2-L    L    0    -GAP/2    2*L    RAD
GW    12    11    0    -GAP/2    2*L    0    -GAP/2-L    3*L    RAD
GW    13    4    0    -GAP/2-L    3*L    0    -GAP/2-L-W    3*L    RAD
GW    14    11    0    -GAP/2    0    0    -GAP/2-L    -L    RAD
GW    15    11    0    -GAP/2-L    -L    0    -GAP/2    -2*L    RAD
GW    16    11    0    -GAP/2    -2*L    0    -GAP/2-L    -3*L    RAD
GW    17    4    0    -GAP/2-L    -3*L    0    -GAP/2-L-W    -3*L    RAD
GW    18    30    -SX    -SY/2    SZ    -SX    SY/2    SZ    SRAD
GW    19    30    -SX    -SY/2    SZ*3    -SX    SY/2    SZ*3    SRAD
GW    20    30    -SX    -SY/2    SZ*5    -SX    SY/2    SZ*5    SRAD
GW    21    30    -SX    -SY/2    SZ*7    -SX    SY/2    SZ*7    SRAD
GW    22    30    -SX    -SY/2    -SZ    -SX    SY/2    -SZ    SRAD
GW    23    30    -SX    -SY/2    -SZ*3    -SX    SY/2    -SZ*3    SRAD
GW    24    30    -SX    -SY/2    -SZ*5    -SX    SY/2    -SZ*5    SRAD
GW    25    30    -SX    -SY/2    -SZ*7    -SX    SY/2    -SZ*7    SRAD
GE    0
LD    5    0    0    0    COND
GN    -1
EK
EX    0    1    1    0    1    0    0
FR    0    17    0    0    476    6
RP    0    1    73    1510    90    0    1    5    0    0
EN


The big question is - after construction, how did it perform compared to the Channel Master antenna?  I mounted each antenna in the same location and used my TV to scan for all channels.  For each digital channel (including those beyond what I care about) I wrote down the average signal strength.  My TV reports two signal numbers, the overall signal level in percentage, and the signal-to-noise ratio in decibels.  For both numbers, higher is better.

Channel CM4221 Gray-Hoverman
15 98% (32db) 98% (33db)
16 89% (26db) 89% (27db)
19 56% (15db) 43% (12db)
24 95% (29db) 98% (30db)
31 84% (25db) 84% (25db)
34 89% (27db) 92% (28db)
41 87% (26db) 89% (27db)
50 98% (32db) 98% (30db)

As you can see, the Gray-Homerman antenna matched or exceeded the Channel Master for almost all channels, even some beyond what the antenna was designed for.  Only at channel 50 was the Channel Master better.  [I'm ignoring channel 19 because that channel is weak and anything below 60% and my TV cannot lock onto the signal.]

Here is a youtube video I uploaded showing design and construction of the antenna.


Here are download links useful to antenna modeling:
4nec2 - http://www.qsl.net/4nec2/
nikiml's python scripts - http://clients.teksavvy.com/~nickm/scripts.html
Optimized versions of the NEC2 engine - http://users.otenet.gr/~jmsp/

Monday, November 24, 2014

Cree Light Bulbs - A company that stands behind their product


About 6 months ago I replaced all the light bulbs in our house with Cree LED light bulbs.  This is something I've wanted to do for a long time, but I was waiting for the technology to improve, and for the price to come down.  I saw several reviews online of the newer Cree LED light bulbs and was impressed with them from a technological standpoint.  I also like the "color" of the light bulbs, they are very close to incandescent bulbs, not the blue-tint often found in CFL and many LEDs.  They are also one of the most energy efficient bulbs at less than 10W for a 60W equivalent.  And lastly, the price is under $10 a bulb at Home Depot.

After replacing all the bulbs in my house, the bulbs worked great and looked great.  However, a few weeks ago one of the bulbs started to flicker on and off.  Whereas these bulbs have a 10 year warranty, I didn't keep the receipt because they were working great for months so assumed I didn't need them anymore.  So technically that was my fault and I should have to buy a new bulb.

I decided to call Cree sales and support and speak to them.  The nice representative said they would ship out a replacement bulb at no cost to me.  I didn't have to send the defective bulb back, provide proof of purchase, etc.  I was very impressed with this level of support.  They clearly stand behind their products.  If you are looking to replace some or all of the light bulbs in your house with LED bulbs, I highly encourage you to look at Cree (no pun intended).  They have an awesome product with great support!

Sunday, November 23, 2014

Raspberry Pi Media Center

Recently I created a Raspberry Pi DVR to record over-the-air TV.  I enjoyed working with the Pi so much that I wanted to do a second project and create a Raspberry Pi media center, more commonly called a Home theater PC (HTPC).  On my previous project I looked at many of the Linux distros available for the Pi, so this project was much easier.  It was merely a matter of putting together everything I learned from the first project.


Hardware
The hardware for this project was very similar to the first project.  I used another Raspberry Pi model B+, the same 16GB Samsung EVO micro SD card, the same 2 amp power supply, the same Rosewill RNX-N180UBE wireless network adapter, the same copper heat sinks, and the same case off etsy.  I felt the last hardware worked great, so I wanted to duplicate it.  The only new hardware I added was this wireless keyboard and trackpad to be able to control the media center (more on that later).


Software
Since this will be a media center I will be running XBMC, which basically means Raspbmc, OpenElec, or Xbian.  I previously tried all three distros.  I felt that Raspbmc was the oldest, slowest, and least desirable.  I really wanted to use Xbian, but it had problems for me (mainly the network adapter did not have drivers).  So I decided to use OpenElec.  Which is not so bad.  OpenElec is the smallest image of the 3 - I guess you could call it lean and mean.  It is also the most actively developed, which means it will probably run the best with the fewest issues.  As of now the latest stable image of OpenElec is 4.2.1, so that is what I used.

Installation is straight forward and simple.  Use Win32 Disk Imager to copy the image onto your SC card, boot the Pi, and follow the onscreen wizards to configure wireless network access.  Some more settings you might want to change in OpenElec are:
  1. The system name, so you can remotely access the machine via SSH.
  2. Enable Samba, to make it easier to access the machine by name instead of just IP address.
  3. Set one or more time servers so it has the correct time.  I used pool.ntp.org and time.windows.com.
  4. Set your timezone, also required to have the correct time.
In addition to these basic settings, there are some more advanced settings you might want to make:
  1. Under video playback, I set "adjust display refresh rate to match video" to always.  This should make video playback smoother.
  2. Disable any unused services, like Avahi (zeroconf) and Bluetooth.
  3. Disable control of XBMC over HTTP port 80, unless you want to use this feature.
  4. Enable overclocking.  I went for a more aggressive 900MHz CPU, 333 MHz GPU, and 450 MHz RAM.  As for temperatures.  At idle the Pi is 104° F, and playing a video it goes up to 111° F.  I know from previous tests the heatsinks reduce the temperature about 2° F.
  5. I personally set up a cron job to reboot the Pi every morning at 5 AM.  I figure I am asleep at that hour, so why not have it reboot itself to ensure any memory leaks do not get too large.  To create a cron job to do this you need to SSH into the machine.  Then type the command "crontab -e"  Add the line "0 5 * * * /sbin/shutdown -r now" and save the file.


MPEG2 License
The Raspberry Pi foundation sells a license key to enable MPEG2 hardware decoding for a small fee.  Here in the US, broadcast TV uses MPEG2 encoding.  Also, DVDs are encoded using MPEG2.  But the question is, do you need to buy this license?  Can the Pi still decode MPEG2 without the hardware encoder?  Can you overclock the Pi to better decode using software?  Well the answer is, you MUST buy this license.  Without the license, OpenElec will not even attempt to decode the video portion of an MPEG2 video.  The audio will play, but no video.  However, with the hardware license the Pi can play full HD MPEG2 videos with no slow down.  So if you plan to watch any MPEG2 content, you will need to buy the license.  It costs less than $5, so just go for it.


Remote Control
The remote control I purchased to control the media center was a mixed purchase.  One the one hand it works great.  Just plug the RF dongle into the Pi and the keyboard and mouse worked without any additional config.  I also love that the remote is RF wireless and not line-of-sight IR like all other remotes.  The downside is it's not the best as a media center remote.  First off, the touchpad is almost unusable.  Second, it lacks some common buttons that would be helpful - mainly Page Up and Page Down which make navigating XBMC easier, but also dedicated stop, play and pause buttons.

I was researching a replacement remote when I discovered something cool!  HDMI has something called Consumer Electronics Control (CEC).  This is basically a protocol that allows two devices connected via HDMI to talk to each other.  The Raspberry Pi running OpenElec supports CEC.  And it turns out my TV does to, although it was disabled by default.  When I enabled it CEC on my TV suddenly I could control XBMC using my standard TV remote control.  The buttons that work include up, down, left, right, enter, and escape for navigation as well as play, pause, stop, forward, and reverse.  So now with one remote I can control the TV and all aspects of XBMC.  I still have the other remote in the event I need a full keyboard or mouse, but CEC is definitely the way to go!


Results
I am very pleased with the results.  The Raspberry Pi makes a great low-cost low-power media center.  The ironic thing is, I connected this to a TV that is already a "smart" TV.  My experience is "smart" TVs are not that great.  Once you have used something like XBMC and see what a real media center could be like you won't go back to a "smart" TV.  The plug-ins available for XBMC make it a great media center.

Thursday, October 30, 2014

Nerdy Christmas Gift

Continuing the theme from the last post, here is a nerdy Christmas gift my awesome wife got me several years ago.  A set of drinking glasses etched with the writing "#include <milk.h>"  If this means nothing to you, then you can read this and this.


And yes, my favorite beverage is milk!

(Sorry, because of the curvature of the glass I can't get a single picture showing the whole thing)

Coolest Birthday Gift

Earlier this week was my birthday, and my wife got me the coolest gift a nerd could ask for.  A Lego Nintendo Entertainment System (NES).  This is not an official set, but comes from the creative mind of Chris McVeigh.  As someone who grew up in the '80s with Legos and video games, this was the perfect gift that combines those two.









Thursday, October 23, 2014

Raspberry Pi DVR - Addendum

I recently completed my Raspberry Pi DVR and put it into regular use.  But I quickly realized something was wrong.  Some recordings would work, but most recordings would fail 10, 15, 20 minutes in.  Every time it failed I noticed the same thing, if I SSH into the Pi and looked at the running processes, tvheadend was no longer running.  The mere fact that I can SSH in to the Pi means that the Pi itself and Linux were still running.  So what is happening, is tvheadend crashing?

The Problem
I started with the assumption that tvheadend was crashing, after all that seems the most logical explanation.  But where do I go from there?  I researched Linux logging and diagnostics to see if the system recorded more info about this problem.  Eventually I stumbled across /var/log/kern.log which is the log file for the Linux kernel.  Every time there was a failed recording, the following was logged:
Oct 20 20:10:00 garagepi kernel: [79819.240765] Out of memory: Kill process 2314 (tvheadend) score 922 or sacrifice child
Oct 20 20:10:00 garagepi kernel: [79819.240785] Killed process 2314 (tvheadend) total-vm:607540kB, anon-rss:404384kB, file-rss:384kB

Aha!  So the problem here is not that tvheadend is crashing, the problem is Linux ran out of memory so to keep the system up and running, it killed the process using the most RAM which was tvheadend.

Because the Raspberry Pi only has a paltry 512MB of RAM, tvheadend is able to consume that and more resulting in this problem.  But if we dig deeper, what is going on here?  Does tvheadend have poor memory management?  Does tvheadend have memory leaks?  Is the task of recording live TV just too much for the limited resources of Raspberry Pi?  Or is there something else going on here?  I think the answer is mostly in the "something else going on here" category.

Let us start off by looking at what tvheadend is doing.  Basically all it is doing is shuttling data from one pipe to another.  The "input" pipe is the digital TV stream coming in from the TV tuner.  For ATSC TV, this amounts to approximately 5GB of data per hour.  That data is then written (unmodified) to the "output" file.  In my setup, the output file is located on my NAS box, so the data must be transmitted over wifi to get there.  And therein lies the problem.  What if the Raspberry Pi cannot transmit that 5GB/hour of data over wifi fast enough?  Linux, like all modern operating systems, would allocate more buffers to hold that data until such time that it is written over wifi.  This means if wifi is too slow, tvheadend will continue to consume more and more system memory in the form of output buffers until such time as Linux steps in and shuts it down.


The Solution
Now that we know the problem, what can we do about it?  The short answer is, we need to improve the memory "situation" of the Raspberry Pi.  For this I made 3 major changes.

  1. The Raspberry Pi has 512MB of RAM, which is split between both the CPU and GPU.  By default the GPU takes 64MB of RAM.  Since this is a headless unit in my garage, let us change that so the GPU gets the bare minimum.  Editing the config.txt file, set "gpu_mem_512=16"  This gives 16MB to the GPU which is the minimum.  This frees up 48MB of RAM for the CPU.  One downside is the GPU requires more memory than 16 for HDMI output.  I have read that either 24 or 32 is the minimum required for HDMI output.  So if you want HDMI output then set this value accordingly.  Either way, this setting is the single largest way to free up memory.  No other step will come close to the 48MB this frees up.
  2. Second step is to stop any unnecessary background processes.  I am no Linux expert, so it was hard for me to know what to stop and how to stop it.  But doing some research, everyone suggests turning off the getty processes.  To do this edit the file /etc/inittab.  Scroll down and look for the "getty" lines.  Disable the getty lines by placing a '#' in front of that line.  Reboot and they are not disabled.
  3. The final step is to do anything possible to improve wifi speeds.  Faster wifi means fewer buffers.  On Raspbian there are at least 2 ways to check your wifi connection details.  The first is "iwconfig wlan0" and the second is "cat /proc/net/wireless"  Both show two numbers, the link quality and signal level - both measured 0 to 100.  Both numbers are important.  What you want to do is adjust the position of your wifi antenna to increase these numbers.  My starting signal level was low 50s, after adjusting the antenna I was able to reach the high 80s.  Just that little bit made a huge difference!  Timing the copy of a large file across wifi, with signal in the 50s it took 1 minute and 29 seconds.  With signal in the 80s that dropped to 4 seconds!  So without a doubt, wifi antenna placement is critical.  Before you start fine tuning your wifi, run the command "watch -n 1 cat /proc/net/wireless"  This will display the current wifi settings updated once a second.  This makes it easy to see signal levels as you move the antenna.



Conclusions
If you wish to undertake a project like this and turn your Raspberry Pi into a DVR, there are several things that I consider crucial to your success.

First, make the above changes to give the minimum memory to the GPU and shutdown any unnecessary processes.

Second, if at all possible, use the ethernet jack instead of wifi.  Wired is always going to be faster and more reliable.  So only use wifi if you have no other option.

Third, if you do use wifi be sure to turn your wifi for maximum signal strength and speed.  Consider one of those homemade wifi antenna reflectors (plans available on the Internet) to improve wifi signal.

Fourth, with wifi optimized if you still run into problems, consider recording the video locally.  You can record the video directly to the SD card or onto a USB thumb drive or external hard drive plugged into the USB port.  Whereas it is not ideal to record large files directly to flash memory, you may have no choice.  After recording you can always copy the file over wifi during idle time when it is no longer a time sensitive process.

Fifth, consider frequent reboots.  Linux is supposed to be stable over the long run, but this does not mean all daemons (like tvheadend) are.  I think I am going to set up a cron job to reboot the Raspberry Pi every night.  After all, it is not doing anything else at 3 in the morning, so why not reboot and help tvheadend to free up memory?