A regular Hack A Day reader sent in a tip about an LM386 stero amplifier with digital volume control. The resulting build is very professional and could easily be adapted into a slick iPod dock build.
We’ve seen a few LM386-based amplifiers over the years including one that fits inside a 9V battery, but this is the first implementation of digitally controlled volume we’ve seen. The volume control of this amp uses the DS1868 dual digital pot IC in place of the usual 10K pot providing 256 steps between zero and full volume. The DS1868 is controlled by a PIC μC with a 3-wire serial connection, although this could be implemented on any microcontroller.
Although the code provided with this build outputs volume as a linear function, it would be trivial to implement a logarithmic volume output. Because the ear perceives loudness on a logarithmic scale, this would be a great way to adjust audio volume and provide a more fine-grained control. Of course this could be implemented with a logarithmic pot, but where’s the fun in that?
Check out a video of the amp after the break.
[youtube=http://www.youtube.com/watch?v=O38PZX__r4g&w=470]
” Of course this could be implemented with a logarithmic pot, but where’s the fun in that?”
in saving $$? in reducing component count? signal path length?
damn, i’ve been wanting to do that for a while.
there are, however, a few digital poti ICs with a pushbutton interface which would make the µC unnecessary.
also, since the resistance ladder is hardwired into the IC you’d lose MUCH of the pot’s resolution if the µC code is set to logarithmic.
Something like a MAX5456 or MAX5457 is cheaper, doesn’t need a uC, and is log tapered.
But hey, if that’s what he had on hand, good for him. Plus, he can make the uC do neat things like time-of-day volume constraints.
Nice build with the LCD.
However I noticed that the datasheet for the DS1868 reads:
NOTES
2. Resistor inputs cannot exceed VB – 0.5V in the negative direction.
Since audio is an AC signal, it will go above and below ground. When I built one of these as a volume control I had the digital pot in series with a fixed resistor of the same value so that the audio would ride on a DC bias.
It reminds me of a pre-amp I did long years ago with a TDA1524 driven by a MX7226. As I was far from playing with µC, I drove the DAC through a PC parallel port
You can approximate a log response from a linear taper digipot using a single resistor: http://www.edn.com/article/505259-Tack_a_log_taper_onto_a_digital_potentiometer.php
Pretty sure that IC was not made for audio applications mainly because it does not have zero crossing detection. Without it, you can get clicks and pops when changing volume levels.
A good project but can be improved with something like the PGA2310. Which of course is more expensive…
@effigy: If you want ever want to remote-control your DIY audio gear, you use this instead of a pot. :) Plus you never have to worry about the pot getting scratchy…
Though there are dedicated I2C volume control chips, which I would highly recommend instead of a digital pot like the DS1868. Most have other nice functions (clickless volume changes and mute, bass, treble, stereo expansion, etc.) And if memory serves, some are about half the price of the DS1868.
I did a simple board/code for the PGA23xx series a while ago, if anyone is interested. It *is* rather expensive though. I should sell some of my spares…
http://audio.gotroot.ca/minivol/
Don’t those little white thingys have their own volume controls? LM386…volume?
Get a real amp, real source, of real sound. Then hackaway!