Use Digitally Controlled Pots as Inexpensive Adjustable Gain Cells

Back at the previous job, I supplied customers with literature, samples, and excellent applications help regarding the use of DCPs (digitally controlled potentiometers). I remembered a zany idea I'd had back then when I saw a recent press release from Microchip about its new series of DCPs (the MCP41HVX1). The parts would work with signal voltages of ±18V and could settle to a new setting in around 5μs — perfect for audio.

(Source: Microchip)

(Source: Microchip)

My zany idea was this: Use the pot to adjust the level of audio (not especially unique) but do that based on its level (somewhat more unique). The intent here is to make an automatic level control (ALC) or an automatic gain control (AGC), two slight variations on a well-known circuit function.

Normally, this is done in a purely analog function. You monitor the audio level with a circuit that produces a DC voltage proportional to the average level of the audio. A precision full-wave rectifier circuit followed by a simple RC filter will work, though you have to tinker with the time constant to optimize performance. Then, use that control voltage to act upon some sort of a voltage variable gain control cell. That can be done several different ways.

You could use an incandescent lamp or an LED shining on a CdS photocell as a voltage-controlled variable resistor. Or you can use an N-channel JFET similarly. It's fairly linear as long as you keep the drain-to-source voltage quite low. Use either of these as part of an op-amp gain stage. There's the Gilbert cell. There are (or were) a few ICs available that were intended as combination microphone preamps and AGCs.

(Source: Wikipedia)

(Source: Wikipedia)

My plan was to use a small microcontroller (MCU) that had a built-in ADC and SPI port. I'd use the ADC to monitor and digitize the audio. Or if there were bandwidth/processing speed limitations in the MCU, I'd add a similar circuit to that one described above to rectify and filter the audio and then digitize what would be a slowly varying DC voltage. I could probably use a much shorter time constant than in the all analog version. Then, the SPI bus would tell the DCP what setting to go to.

This would eventually become part of some guitar stompbox widget that I was (or perhaps still am) working on. Some advantages of this design: I'm not dependent on a sole manufacturer of an AGC IC. I can tweak the “RC” time constant called out above via software changes as needed — adjusting attack and release time would be very easy.

A disadvantage: I'd have to write code. Unless I can get Max Maxfield or Rich Quinnell to do that part for me.

So, let me know if this would work or not.

17 comments on “Use Digitally Controlled Pots as Inexpensive Adjustable Gain Cells

  1. amrutah
    June 29, 2013


       The idea is really awesome, but it will be more of hardware controlled gain.  To adjust the gain, everytime I would have to rotate the pot.  It will be very difficult to adjust the gain using software.

  2. D Feucht
    June 29, 2013

    @ Brad – Clever idea, Brad. Anything with a multiplier in it gets my attention.

    I am presently using the MCP4131-103 (10 kohm) as a gain adjustment in a pulse generator isolation amplifier. My only concern about its performance was whether it would bandwidth-limit (or in this case, risetime-limit) the response because of parasitic IC capacitance. It seems to be okay in my case (at a couple of microseconds risetime, at 5 A out), though I would like to see Microchip and others provide some dynamic parameter specs on these kinds of devices so that we can use them in faster (and faster) circuits.

    Ultimately, the fastest variable-gain circuits are translinear circuits (Barrie Gilbert, again) as used in oscilloscopes.

  3. jkvasan
    June 30, 2013


    Even Microchip suggests gain adjustment through it its digipot ics in its app notes for opamps.

    However, you may not get a smoothly varying cotrol as these are taps on a larger resistor, though equispaced.

    It would be more convenient to have a good FET in the feedback loop and adjust its  gate voltage and hence drain-source resistance by PWM or DAC from a microcontroller. This would give the much needed seamless audio level control.

  4. amrutah
    June 30, 2013


       But I believe that using the DAC and generating a PWM control signal would be a costly solution..

  5. David Maciel Silva
    June 30, 2013

    Brad is a good idea,

    Jkasan, it would make the whole using a PGA control is a power circuit to output amplified?

    Maybe the control is more easy.

  6. Brad Albing
    June 30, 2013

    @JK – I could do this with the JFET, of course – I'm just looking at different ways to do this, and maybe find a way that doesn't require selecting and matching FETs – assuming I want to make several channels and have them perform the same way.

  7. Brad Albing
    June 30, 2013

    Yep – Barrie's multiplier ckt is pretty sweet. I was looking for something lower cost and not as high performance (as I didn't need especially high performance).

  8. jkvasan
    July 1, 2013


    DACs are nowadays built-in inside mcus. This way, the pricing is shared by the chip on the whole.

    PWM is the cheapest way of generating analog voltage just with an RC network and a buffer amp. It has its own shortcomings, though.

  9. jkvasan
    July 1, 2013


    PGAs are good. But they do not provide continuously variable gains. You may get x1,x2,x4,x8 and so on.

    Nowadays ADCs and MCUs are with PGAs inside.

  10. jkvasan
    July 1, 2013


    I missed it. Multi-channel gain adjustments may result in variations if FETs are unmatched.

    What is the step resolution of gain you are targetting?

  11. David Maciel Silva
    July 1, 2013

    Correct JKASAN,

    Even with a control curve would be too inaccurate to use them,

    The best solution is then MCU+DIGITAL POT +  OPAMP + POWER DRIVER?



  12. Brad Albing
    July 1, 2013

    @JK – Probably 1 or 2dB per step – wouldn't need to be especially fine steps and wouldn't need to be that many steps – just intended for a guitar gadget.

  13. jkvasan
    July 2, 2013


    May be what I am going to suggest is not a right one.

    Is it possible that a common voltage is generated combining each channel output and fed to the amplifier as a ??common mode voltage?? This would normalize all channels to the same dB.

    I am referring to a technique used in ECG amplifier – it is for getting better CMRR , though.


  14. jkvasan
    July 2, 2013


    The combination you mentioned could be anytime the right one as it gives the much needed flexibility. You could implement digital filters on the fly. Calibration can be done without any trimpots to turn. However, if you ask me about the clarity of sound and user experience, I would always support a full analog system as its performance is unbeatable in many ways.

    I love my AM valve radio.

  15. Netcrawl
    July 2, 2013

    @Jayaraman you have a point here but there are still plenty of good reasons why some like digital pot, the space constraints and reliability issues of a analog system is just an immediate issues. Today a common volume-control interface for modern devices like gadgets buttons, this provides an inexpensive, useable solution without a bulky mechanical pot and much reliable.

  16. Netcrawl
    July 2, 2013

    @Jayaraman, DCP offer a much greater advantages for audio volume control applications, especially in mobile devices like smartphones or even AM/FM radios, it can replace those bulky mechanical pots and meet those mechanical tracking issue found in analog system. 





  17. RedDerek
    July 3, 2013

    I remember when the digital pots came out and they started to get me thinking of the fun stuff to develop. The software development stopped me as well. Going back years further, I was involved with developmental concepts using optics for feedback for a lamp. I will put this down as part of my blog list to do.

Leave a Reply

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