Designing a Headphone Amp Around the TPA6120

I really wished this information was more readily available when I built my amplifier circuit, which is the reason I’m writing this. After purchasing a pair of AKG K-240 Studio Headphones, I decided I wanted a headphone amp to help drive them, and decided to build one, more or less, for the educational value. Having built electronics kits in the past, I really didn’t want to just assemble a pre-existing kit. After reading about various OpAmps, I settled on the TPA6120. This IC operates between 5V and 15V, a fine range to power with 9V batteries. It also has a very fast slew rate 1300V/μs, low noise, and a low THD rating.

Update: Given the difficult to mount SO-20 PowerPad package TI uses for the TPA6120, I now offer a breakout board at AstrusLabs.com.

I should mention before continuing, this information applies to headphone amp design, and I cannot comment on it’s compatibility with other applications (such as guitar or microphone preamps). If you’re interested in driving something other than headphones, I suggest you look into the specific design considerations for your application.

 As a starting point, I referenced the four stage C-Moy amplifier design:

Figure 1: Left Channel Amplifier Circuit

(A) Input Stage


A potentiometer (or pot for short), R1, is used as a voltage divider to control the volume on the input side. The pot is chosen based on resistance and number of turns. The resistance of the pot should be significantly higher than the output impedance of the source (i.e. the MP3 player plugged into the amp).  The number of turns determines the resolution, a 10 turn 1kΩ will allow for more sensitive fine tuning than a single turn 1kΩ pot.

I used a pair of 2.2kΩ single turn trim-pots I pulled from an old Behringer Amp; which seem to work well for me, but may or may not fit your needs.

(B) Filter Stage


The filter stage serves to protect the amp and headphones from a DC biased input. The job of the capacitor (C1) is to block DC, and the job of the resistor (R2) is to set a predictable high pass cutoff frequency. Together these two components function as a highpass filter. The cutoff frequency should be below 20Hz (the lower extent of human hearing), and is found using the equation:

rc_filter

where fc is the cutoff frequency, R is the resistance of R2 in Ohms, and C is the capacitance of C1 on Farads.

For reasons I will explain later, I chose values of 175Ω and 220μF for R2 and C1, resulting in a cutoff frequency of  approximately 7Hz, well below the 20Hz limit.

(C) Amplifier Stage


The amplifier stage is simply a non-inverting OpAmp configuration. There is a lot of information available elsewhere that would do a far better job than I could, explaining how this amplifier configuration works. The important thing here is the gain equation:

gain

This determines how much larger (or smaller) the output is compared to the input. Since the TPA6120 datasheet recommends a value of 1kΩ for the feedback resistor: I chose resistance values of 240Ω and 1kΩ for R3.1 and R3.2, respectively;  resulting in a gain of approximately 5.

Since the TPA6120 has a relatively low input impedance for an OpAmp, balancing the apparent impedance at the input is crucial to prevent a DC bias from forming at the output. This simply means that the resistance between each input pin and ground should be close to the same value. For this amplifier circuit, it means the resistances of R2, R3.1, and R3.2 are all related by the following equation:

resistance

This relationship (along with the availability of parts in my collection) is why a resistance of 175Ω was chosen for the filter stage; the capacitance was chosen based on what I had on hand.

It may be tempting to address this issue by adding a decoupling capacitor on the front end; however, the TPA6120 datasheet specifically recommends against this solution, since it may produce undesired oscillations on the output signal. The datasheet also offers a lot of other good design considerations, and I do recommend reading it over before modifying or designing your own amplifier.

 (D) The Driven Load


This portion of the circuit represents the impedance of the speakers being driven. In my case this would be the impedance of one side of a pair of AKG K-240 Studio headphones, or 55Ω.

 Other Considerations


While batteries do supply very clean power, I still found it necessary to use decoupling capacitors on the power pins to eliminate noise. As an added precaution I also wound the battery clip leads into twisted pairs to further cut down on RF interference.

 

 

Creative Commons License
Designing a Headphone Amp Around the TPA6120A2 Blog Post by Cheesed-Off.com is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

Cleanly Installing Steam for Linux Beta on 64-bit Debian

Cleanly installing on Debian Sid (or Wheezy)
If you wish to install the client on a Debian system without polluting it with Ubuntu packages and/or other external dependencies, here’s a quick HOWTO.

1. Make sure your apt-get understands multiarch if you’re on amd64

2. Install i386 packages that are available in Debian

apt-get install libgl1-mesa-glx:i386 libgl1-mesa-dri:i386 libcurl3-gnutls:i386 libogg0:i386 libpixman-1-0:i386 libsdl1.2debian:i386 libtheora0:i386 libvorbis0a:i386 libvorbisenc2:i386 libvorbisfile3:i386 libasound2:i386 libc6:i386 libcairo2:i386 libcups2:i386 libdbus-1-3:i386 libfontconfig1:i386 libfreetype6:i386 libgcc1:i386 libgcrypt11:i386 libgdk-pixbuf2.0-0:i386 libglib2.0-0:i386 libgtk2.0-0:i386 libnspr4:i386 libnss3:i386 libopenal1:i386 libpango1.0-0:i386 libpng12-0:i386 libpulse0:i386 libstdc++6:i386 libx11-6:i386 libxext6:i386 libxfixes3:i386 libxi6:i386 libxrandr2:i386 libxrender1:i386 zlib1g:i386

If you are using an NVidia card with the proprietary drivers (I didn’t need this):

apt-get install libgl1-nvidia-glx:i386

3. Choose a directory for Steam, such as /opt/steam

mkdir /opt/steam
cd /opt/steam

4. Download Steam and Ubuntu packages

wget http://media.steampowered.com/client/installer/steam.deb
M=http://ubuntu.wikimedia.org/ubuntu/pool
wget "${M}/main/libj/libjpeg-turbo/libjpeg-turbo8_1.2.1-0ubuntu2_i386.deb"
wget "${M}/main/e/eglibc/libc6_2.15-0ubuntu20_i386.deb"
wget "${M}/universe/j/jockey/jockey-common_0.9.7-0ubuntu11_all.deb"

5. Extract everything in /opt/steam

dpkg -x libjpeg-turbo8_1.2.1-0ubuntu2_i386.deb /opt/steam
dpkg -x libc6_2.15-0ubuntu20_i386.deb /opt/steam
dpkg -x jockey-common_0.9.7-0ubuntu11_all.deb /opt/steam
dpkg -x steam.deb /opt/steam

6. Fix the steam script so that it understands $STEAMLIBS

sed -i 's@/usr/lib@$STEAMLIBS@' /opt/steam/usr/bin/steam

7. Create a custom launch script with the following contents and put it anywhere:

#!/bin/sh
BASE="/opt/steam"
export STEAMLIBS="${BASE}/usr/lib"
export LD_LIBRARY_PATH="${BASE}/lib/i386-linux-gnu:${BASE}/usr/lib/i386-linux-gnu"
export LC_ALL="C"
exec "${BASE}/usr/bin/steam" "$@"

Use chmod ugo+x filename.sh to make the script executable

8. Run

9. Fixing the cursor theme

Steam overwrites the X11 Cursor theme when it launches. This is a problem with Gnome and other WMs/DMs that do not set a cursor theme. You can overcome this for Gnome by setting a mouse cursor theme.

To fix this issue, become root and put the following into /usr/share/icons/default/index.theme (creating the directory /usr/share/icons/default if necessary):

[Icon Theme]
Inherits=Adwaita
Note: Instead of “Adwaita”, you can choose another cursor theme (e.g. Human).

Alternatively, you can create a symlink ~/.icons/default that points to the entry for your cursor in /usr/share/icons, for example:

mkdir -p ~/.icons
ln -sT /usr/share/icons/Neutral_Plus ~/.icons/default

If the cursor gets stuck pointing in the wrong direction after exiting Steam, a workaround is to run
xsetroot -cursor_name left_ptr

Credit to Sam Hocevar for steps 1 thru 8 and credit to the ArchWiki for step 9

Reverse Scrolling In Debian Wheezy

This works in Debian Wheezy to reverse the scroll direction (aka Natural Scrolling):

echo "pointer = 1 2 3 5 4 7 6 8 9 10 11 12" > ~/.Xmodmap && xmodmap ~/.Xmodmap

No reboot required. Reverting is as easy as running the command above again, but swapping the 5 with the 4 and the 7 with the 6.

Credit to Andy C’s Weblog

So the site’s focus might be changing…

I recently got Cheesed Off™ with google’s integration of everything into social, with heavy “peronalized” suggestions, results, ads, etc. accross all of their properties. Not to say I didn’t see this coming, I really didn’t expect it to be such an annoyance. At any rate I’m contemplating making this a personal blog since I don’t really post anything here anymore.

Cheers,
~Spoonless