Hacker News new | ask | show | jobs
by zamalek 227 days ago
The digipot is vaguely similar to how a R2R ladder DAC works. There are two resistor values used: R and 2R. The "interesting part" of the circuit has bits x 2R resistors in parallel. One end of each resistor (let's call it input) is connected directly to the digital bit from the PWM sample.

Then there is the series bits x R resistors. The output of each 2R resistor is connected in-between the two resistors that straddle its bit position. So:

    Out
    |
    R
    +-2R-bit0 
    R
    +-2R-bit1
    ... 
    R
    +-2R-bitN
And that's it (apart from pull-up/down resistors)! Due to the way that resistors in series and parallel work, each input step in the ladder provides twice the voltage of the previous if powered: it's base 2 enshrined in a physical object.

These are relatively uncommon because they are highly sensitive to the resistor (and trace) tolerance, but this circuit is my Euler's identity of electronics: it very literally bridges the digital and analog worlds.

1 comments

I saw the diagram in the original blogpost, laughed, but after a bit of sketching it out I think we're both wrong. R/2R ladders are useful in DACs (and are really cool there) but don't look like they're used in digipot applications.

It seems like actual digipot ICs use the "2^n discrete resistors" approach. The IC used in this project is a MCP4141 which explicitly states in section 5.1 of its datasheet that for 7-bit (8-bit) devices there are 128 (256) resistors in a string between the terminals.

I'm a bit surprised this seems to be the best approach, but with IC manufacturing the joint problems of "a bunch of identical components" and "wiring it all up" are much less of a problem than if you were to wire this up by hand.