(Update 03 Jan 2007: comments closed due to spam. Questions/Comments? Send 'em to devel at latke dot net. Thanks!)
My home stereo uses a pair of powered studio monitors, so I don't have an integrated amplifier/tuner. Instead, I have an old NAD Model 1000 stereo preamp, which is really just a fancy switchbox with a phono preamp (all discrete!), tone and volume controls, and a headphone jack.
One thing it doesn't have is a remote volume control. For a long time, this hadn't been a problem, since all I used the stereo for was listening to music. Now that we've got the TV, the Mac mini (used as the DVD player as well as a DVR with EyeTV) and the cable box hooked up to it, lack of remote volume and mute control has become quite annoying. (We HATE commercials.)
But I'm an engineer ... I can build my own remote volume control! And I did. Here's how.
First, a run-down of the features:
a) Use the remote's Volume Up and Volume Down buttons to increase or decrease the volume. When the volume is changed, the Gain: display and bar-graph meter are updated appropriately.
b) Use the remote's Mute button to mute or unmute the audio. When muted, an (M) annunicator appears in the display.
c) Use the remote's numeric entry (0 through 9) and ENTER buttons to directly enter a volume level (in the range 0 to 255). Numbers greater than 255 are ignored.
d) Use the remote's POWER button to turn the LCD backlight on and off.
Digital control of analog audio volume control is easy if you use a TI PGA2310 stereo volume control chip. It uses a simple 16-bit SPI interface to load two eight-bit gain-set words, one for each channel. The gain ranges from +31.5dB to -95.5dB in 256 0.5dB steps. The chip uses ±15V rails for its audio amplifiers and +5V for the digital section. (The much-cheaper PGA2311 uses ±5V analog rails.) Basically, each channel consists of a stepped attenuator where laser-trimmed resistors set the attenuation, followed by a variable-gain buffer. The buffer is capable of driving 600Ω loads, so an external line driver is not necessary (for single-ended applications).
I chose to use the Philips RC5 IR remote protocol, which I won't go into here as there are a whole bunch of other web references for it. I imagine that most universal remotes support it, certainly if you configure the remote to talk to a Philips TV set. Rather than use a discrete phototransistor to receive the IR light bursts and then demodulate it in a microcontroller, I chose to use an IR receiver module. These are simple three-pin jobs, with power, ground and data-out pins. Vishay offers a full range of receivers in all sorts of packages. However, Radio Shack stores stock their part number 276-640, which works well enough.
Finally, I use a microcontroller to decode the receiver's data bits and turn the keypresses into gain set values that are sent to the PGA2310. Pretty much any microcontroller with an interrupt input, an SPI port (you could bit-bang, too) and a timer should work.
Here's the guts of the box. Yep, it's a hack. I had the chassis lying around and used a step drill and a nibbler to cut out the holes and such.
I'm partial to the Silicon Labs 8051 micros. There's a bunch from which to choose, with various analog and digital peripherals as well as RAM and flash. The best thing about these parts is they all have in-circuit debug/emulation, and US$35 gets you a USB JTAG dongle, which is like two orders of magnitude less expensive than the old Nohau 8051 emulators.
I had a C8051F226 development board floating around that had a standard 16x2 LCD attached to it, so I figured I'd use the LCD to show the gain and mute status. I've already written code to interface to the LCD. Plus, the LCD was useful in trying to figure out what codes the keypresses actually generated. This was much easier than using a 'scope and counting transistions on the serial data line.
Here's the micro board. The 10-pn connector on the bottom (next to the LEDs) is the JTAG programming/debug header. The LCD is on the right. The +3.3V regulator is on the lower left. The devel board's expansion header is at the back.
So, there it is: IR receiver module, micro, LCD, analog volume control chip. One more point: the analog input comes from the NAD preamp's Tape 2 out (because it doesn't follow the volume control like the Outputs 1 and 2), which is unbalanced on RCA jacks. My speakers have balanced inputs on XLR connectors, so I used a couple of TI DRV134 balanced drivers for the outputs.
Here's the connector panel. The two RCA jacks are the inputs and the two male XLR jacks are the outputs. The RCA jack channel is the same as the XLR below it. I didn't bother labeling them as "left" and "right" because I adjust left and right identically; there's no balance control (although one could be implemented easily in the firmware, I chose not to do so because there isn't an obvious balance control on the remote). The jack on the lower left is the input for the wall wart. (Sorry about the crappy mechanicals here. Maybe I'll get a drill press and/or some punches for Hanukkah?)
For power, I use a 16VAC wall wart. On a piece of perf board, I built up a simple ±15V supply using a couple of 1N4004 diodes, 470 µF caps, and LM317 and LM337 regulators. I then put the PGA2310 and the two DRV134s the perf board, and wired up the serial signals back to the micro board. I also connected the +15V wire to the micro board's +3.3V regulator as well as the 78L05 regulator I use for the LCD (which also goes back to the analog board as the PGA2310's +5V supply). So the sandwich is pretty ugly, but functional, and when it's in a box, you don't see the ugliness.
Here's a close-up of the analog/power-supply board. The PGA2310 is on the adapter board in the upper left. The two DRV134s are in the middle left. The ±15V power supply is on the right beneath the connectors. The ribbon cable wiring to the micro board is at the upper left.
Here's a close-up of the driver chips and the PGA2310. Note that the PGA2310's package is not the same as the adapter board so a little creative pin-bending was necessary. (Don't be afraid of SMT!)
You can find a schematic here. Note that this is based on what I built using the micro devel board, which explains why the +15V is the input to both the +5V and +3.3V regulators. If I were to do a custom board, the +15V supply would feed a beefier +5V regulator, and that +5V regulator would be the input to an LDO supplying the +3.3V.
A micro port pin and a 2N2222A transistor are used to control the LCD backlight. Since the '226 device doesn't have PWM hardware, and I didn't bother to do one in software, the backlight is either full on or full off. Note that the backlight LED gets its current from the +15V supply, because the 78L05 can't do enough current for the backlight and everything else. (Again, had I not started with something I'd already had, I would've used a heftier +5V supply.) The LCD backlight specs 90 mA, so that means a 1-W 120-ohm resistor. I didn't have any available, so I paralleled four 560-ohm 1/4-W resistors.
Here's a close-up of the display. The IR receiver is in the hole on the upper left.
The firmware is here. I used the Keil C51 compiler and µVision 2 environment. It's reasonably well commented and hopefully you'll be able to understand why I do what I do.
Things to do, if sufficiently motivated:
a) Vary the backlight intensity using PWM.
b) Update firmware so it powers up to the previous volume level, rather than at zero.
c) Update firmware so that holding down Volume Up and Down buttons for a "long" time should increment/decrement volume level quicker.
d) Make a PCB and a nicer box.
e) Maybe set up to use the Apple Front Row remote?
f) Add relays or FETs to prevent power-on/off glitches from sending potentially damaging "pops" to the speakers.
Summary: now we have a convenient volume control for the stereo and TV. It's got very low distortion and noise, and a nice display. Enjoy!
DISCLAIMER: please don't e-mail me with questions like, "How do I do this with a PIC (or other micro)?" since I haven't used any other micros in a long time. Please don't ask me for detailed help regarding how IR remotes or LCDs work; as I said, there are a lot of web resources.
WARRANTY: there is none. I don't guarantee this to work at all, or work well enough for your particular application. I believe the schematic to be correct, and the firmware compiles using the Keil 7.04 compiler and loads into the 'F226 device using the SiLabs IDE. If you blow up your stereo, I'm sorry but it's not my fault. If you incorporate it into a product which you then sell, and the product explodes in a customer's face, I am not responsible and will be held harmless from any and all legal liabilities.
LICENSE: I can't keep track of which open-source license is which, so here's the deal. This code is © 2006, Andy Peters, ASP Digital. Feel free to use it and/or modify/extend it in any way you wish, with the following requirement: if you re-publish it or any derivatives anywhere, my copyright notice must be retained. If you find it really useful, please consider picking something out of my Powell's Wish List (enter andy@latke.net in "Your friend's email address." If you find any bugs, please tell me.
Good night, and good luck.