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.

Comments

  1. effigy says:

    ” 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?

  2. kikkoman says:

    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.

  3. zing says:

    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.

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

  5. ftorama says:

    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

  6. Randy says:

    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

  7. Adrian says:

    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…

  8. Chris says:

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

  9. error404 says:

    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/

  10. echodelta says:

    Don’t those little white thingys have their own volume controls? LM386…volume?
    Get a real amp, real source, of real sound. Then hackaway!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 93,903 other followers