Power Saving Tips
Posted March 9th, 2008 by Ken Dixon
Like many of us, I’m sure, I leave my Myth box on 24/7. This can result in significant power usage over a month, so I have put a bit of effort into reducing unnecessary waste. This article shows you how to measure power usage, gives recommendations when buying new hardware, and includes tips on reducing power wastage on existing hardware. Parts of this article have Ubuntu specific commands but the principles should work on any distribution.
How much power am I using?
This first step gives you a benchmark to measure any improvements against.
Method 1: Poor man’s Guesstimation
This method is one step above useless and not recommended.
Simply add up the maximum Wattage ratings on the backs of your devices
Divide the total by 1000 to get KW (Kilowatts). This can be extrapolated over an hour to give KWH (Kilowatt Hours) OR Units (on your power bill).
Simply multiply by 24 hours then by 31 days to give an estimate of a month’s use, and multiply by the cost per unit for a total cost per month.
e.g. in my case
TV = 241W
Computer Power supply = 380W
Amp power supply = 15Volts * 3Amps = 45W (simply multiply to get Watts)
Total = 666W
666W / 1000 = 0.666
0.666KWH * 24H * 31Days = 495.5KWH/Month
495.5KWH/Month * 0.18$/unit = $89.1/month
Disclaimer:
This is a very inaccurate method and will give a much higher number than is actually used, as the TV will not be full power all the time, especially when turned off. The PC is in the same boat, using the most power on boot up, then will settle (mine sits about 130W from a 230W PSU). You could factor in some of these variables to give a more accurate guesstimate, but you are seriously better off using one of the following methods.
Method 2: Clamp-meter, calculation via measured current(Amps) throughput.
This method, similar to the first, differs by using measured current to calculate power usage instead of printed maximum watt ratings. This method requires a clamp-meter: essentially a multi-meter with a clamp which allows you to measure the current running through a wire without having to cut the wire and have the multi-meter running in series. I obtained my clamp-meter from The Warehouse for $15, a very good price, as it acts as a basic multi-meter as well. While you’re at The Warehouse, get yourself a short extension cord as well. Now, unfortunately the clamp-meter cannot measure current when clamped over both phase and neutral wires, so they need to be separated.
Warning: do not perform this operation unless you are competent and understand the potential hazards (preferably EST-A certified as a minimum)
Make sure the extension cord is unplugged then strip away a section of the outer insulation, being careful not to damage any individual wire’s insulation.
Now that we have access to the individual wires, we can measure the current usage of any device plugged into it by putting the clamp on ether the Phase(brown) or Neutral(blue) wire. Plug in any devices you want to measure, set the clamp meter to amps, and observe the measured current.

Once we have the current, we can calculate the power usage.
i.e.
for a reading of 0.5A
1A * 240V(constant AC voltage for NZ) = 240W
240W / 1000 = 0.24KW
Extrapolated for an hour: 0.24KWH
Extrapolated for a month: 0.24KWH * 24H * 31days = 178.56KWH/Month
In Dollars:
178.56KWH * 0.18$/KWH(unit) = $32.14/month
Disclaimer:
This method, vastly superior to the first, can be very useful in measuring the effectiveness of the implementation of any power saving techniques used, by measuring the before and after current throughput.
However it lacks the ability to track usage over time (although these variables could roughly be incorporated into the equations), which moves us onto the third option.
Method 3: Power Meter (Highly Recommended)
A power meter option is by far the best option, internally using an amp meter as in method2, but does the calculations for you, and has the ability to measure over time.
These power meters are available at various prices from a few different places:
Jaycar for NZ$47.90
Dick Smith for NZ$29.95
The Warehouse for NZ$20.00
Usage:
Enter in the $ per unit, then plug it in series to your media centre multi-power-board, press the function key to cycle through the displays W/KWH/A and more, including total price since started.
It’s that easy!

As an example of how much power you might expect to use, I have had a power meter on my set-up for 45 days. Here is the result:
Set-up(with power saving features implemented):
MythTV computer:
- 80Plus 230W PSU
- AMD Athlon64 3000
- Nforce3 MB
- Nvidia 6600GT
- 20GB PATA
- 160GB PATA
- 320GB ESATA
42″ LCD
5.1 Surround Amp
Sub woofer
After 1081 hours (45 days) at $0.18 per unit, the total is $36
Now we can see how much power we are using, it’s time to do something about it.
Hardware Considerations
Rule of thumb: heat = wasted power
This applies to every electrical device (apart from maybe an electric heater), so in general when shopping for parts to be used for a MythTV box, don’t get the ones with the fattest heat sink and the biggest fans.
PSU:
One of the best ways of reducing excess power wastage is to swap out your old computer power supply with a more efficient one. The industry has set up a standard called 80plus for power supplies which have be certified as 80% or greater efficiency.
I went for an Antec 380W
As a bonus, greater efficiency produces less waste heat to be extracted, ultimately creating a quieter machine.
GPU:
The graphics card can drain a lot of power even when doing nothing, and unless your MythTV box is doubling as a games machine, you don’t need an excessively powerful graphics card. Any card which is passively cooled is likely to be relatively low power and quiet as a bonus.
Here is a fairly recent list of graphics cards and their power ratings.
Integrated GPU:
In general, integrated GPU’s are a good idea, commonly lower spec, and without the overhead of a separate card. Check out the bottom of this page for a comparison of some modern integrated graphic motherboards.
CPU:
This used to be a no-brainer. However, with the introduction of the core2 architecture from Intel, the power efficiency race between AMD and Intel has tightened.
http://www.neoseeker.com/resourcelink.html?rid=127530
Software
Got your hardware? Time to mess with the software.
Info:
For good information and handy tips on saving power, install Powertop.
For Ubuntu:
sudo apt-get install powertop
Run using the command:
powertop
CPU frequency scaling:
Frequency scaling is available for most modern CPU’s and is an easy way to save power.
This option seems to be on by default in Ubuntu. However, it seems to be lacking in the latest Mythbuntu distribution.
An easy check is to use Powertop, or run the command:
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
If it complains about no directory, then it is not enabled; otherwise it will list available frequencies for your CPU.
If it is not enabled, for Ubuntu and AMD CPU’s, try:
sudo apt-get install powernowd
and try again
Spin Down HDD:
Spinning down hard disk drives when not in use is not only good for your power bill, it’s also good for the drives.
USB/SATA/ESATA
These types are all lumped into the same group as they come under SCSI control, and are not as well supported as a PATA drive but can be spun down.
http://www.nslu2-linux.org/wiki/FAQ/SpinDownUSBHarddisks (p.s. NSLU2 is a fantastic little device)
Here is the script I use to spin down my ESATA drive, which is a slight modification on one found on the NSLU2 site:
#!/bin/sh
disk="sda"
interval=600
state=`grep " $disk " /proc/diskstats`
count=$interval
up=1
while [ true ]; do
sleep 10
count=$(($count-10))
newstate=`grep " $disk " /proc/diskstats`
if [ "$state" = "$newstate" ]; then
if [ $count -lt 0 ]; then
count=$interval
if [ $up = 1 ]; then
#echo -e "spin-downt" `date`
sync
state=`grep " $disk " /proc/diskstats`
hdparm -y /dev/$disk &>/dev/null
up=0
fi
fi
else
#echo -e "drive is upt" `date`
count=$interval
state="$newstate"
up=1
fi
done
PATA:
hdparm can be used to spin down these drives.
Simply add your drives, and time (in 5 second units, i.e. 120 = 10 minutes) to /etc/hdparm.conf
i.e.
sudo nano /etc/hdparm.conf
/dev/hda {
spindown_time = 120
}
/dev/hdc {
spindown_time = 120
}
Make sure it’s running on start up by running:
sudo update-rc.d hdparm defaults
It’s on all the time anyway, why not use it for … ?:
Strictly speaking, these suggestions may not save any power. However, it may make better use of your ‘already on’ MythTV machine. So if your Myth box is on all the time anyway, why not have it doing something useful? Here are some suggestions:
File Server:
Very easy and practical to share files with the rest of your network. Simply enable SAMBA and/or NFS and share any files you might want access to at any time (i.e. Movies/Music folder).
Web Server:
Just install Apache and:
MediaWiki, for a flexible home page.
Trac, for a software development management system.
P2P:
Share some files. Simply find a P2P application that can run in daemon mode:
amule
torrentflux OR torrentflux-b4rt
and watch Deluge for daemon support in future versions.
Router:
Might be an option for those without one already.
VOIP Server:
Set up MythPhone and save money on your phone bill.
Distributed processing:
Find ET, cure cancer and many more. Don’t waste those spare clock cycles, install BOINC on your MythTV box and use them.
If you have implemented frequency scaling, you should set ignore_nice_load, to stop the BOINC daemon from messing with your CPU clock frequency.
Do this in Ubuntu by by using this command:
sudo sh -c 'echo "echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/ignore_nice_load" > /etc/rc.local'
External Device Power Off:
When you’re done watching TV for the night, you can switch off your TV and still be left with a wall of standby lights using more power than you might think.
I decided to do something about it the other day, by purchasing a USB controlled multi-board from Jaycar for $47.
At the time I envisioned powering down a USB port via software, thus completely switching off any devices attached to the board (i.e. TV, Amp, Sub woofer).
Unfortunately after getting the multi-board home I discovered it detected the VBUS voltage or absence of it to determine whether to switch off the mains ports.
Switching off VBUS via software proved a very unlikely prospect. However, I invented a dodgy hack of a workaround.
It goes something like this:
1. Buy a cheap USB optical mouse.
2. Dismantle the mouse
3. Find your device location:
cd /sys/bus/usb/devices/
ls
Plug in your dismantled mouse, then relist
ls
There should be two new directories. The one you want is the device directory which looks something like 1-2, cd into that directory then the power subdirectory:
cd ./1-2/power
Use the commands (as root user):
echo -n 2 > ./state
for off, and
echo -n 0 > ./state,
for on
This should turn the LED of the mouse off and on.
Note: this may not work for all controllers (did not seem to work for the Nvidia Nforce3 controller).
4. Use a multi-meter and find a ~5V and ground rail on your dismantled mouse which switches off when the device is suspended.
5. Get yourself a USB cable (or socket), strip the insulation and solder the black(gnd) and red(+5V) wire to the correct rails
6. Physically disable the LED, and buttons on the mouse (to avoid any mouse type issues).


To utilise this function I wrote a short shell script called /usr/bin/powerswitch.sh:
#!/bin/bash
USBDEV="/sys/bus/usb/devices/1-1/power/state" #This is your modified mouse device, modify path to suit
cat $USBDEV | while read line
do
if [ $line == 0 ] #Toggles between on and off
then
echo -n 2 > $USBDEV
else
echo -n 0 > $USBDEV
fi
done
It will toggle the power state of your mouse, replace USBDEV variable with the location of your mouse, and make executable
sudo chmod 755 powerswitch.sh
make sure only the owner (root) has write privlages, this is important as not doing so would create a serous security hole. Unfortunately root privlages are required to run this script, in order to run it with out entering a password each time,
add to /etc/sudoers (you will need root privileges):
MythTVUserName ALL=NOPASSWD: /usr/bin/powerswitch.sh
using the correct user name requiring access.
For the convenince of the remote, do:
cd ~
nano .lircrc
and add an entry:
begin
remote = mceusb
prog = irexec
button = Green
config = sudo /usr/bin/powerswitch.sh
repeat = 0
delay = 0
end
I have used the Green button (appropriately), but you can choose whichever free button you desire by changing the “Button =” variable.
Conclusion:
There are many ways you can reduce your power wastage. Many are not covered here (such as the promising Mythshutdown). However, there is always a wealth of information on the issue with the open source community more than happy to share that wealth. Simply look.
The fact is there is a price for the ability to run this fantastic software the way it should be run, and, let’s face it, the price of electricity in New Zealand (and elsewhere) is going to keep on climbing.
Factoring in these considerations when buying hardware, and implementing some of the software techniques will save you money in the long run, and will also play a small part in reducing the impact we have on our environment.
Give it a go.