Stereo Amplifier With Digital Volume Control

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.


10 thoughts on “Stereo Amplifier With Digital Volume Control

  1. 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.

  2. 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.

  3. Nice build with the LCD.
    However I noticed that the datasheet for the DS1868 reads:

    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.

  4. 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…

  5. @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.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.