DS1881--Clickless Dual Digital Attenuator--Experimenter's Board--Amazing IC!

Readers: If you'd like to build the DS1881 experimenter's board featured in this post, please go to PCBWAY's Community pages--gerber file; KiCAD 10 project/pcb/schematic/library files, a link to github repo with Proof of Concept sketches, an assembly B.O.M., and more, are here.  

You can also help out this blog immensely by checking out PCBWAY using the link here. Thanks!

=============

 Hello again!

I've breadboarded digital potentiometers before, only to find they make an ugly, audible "click" when changing resistance values when used in 30hz-20Khz AC circuits.

I recently stumbled upon an IC that purportedly does away with the click--Analog Device's DS1881--dual pots, I2C, log response--everything needed for an MCU controlled audio attenuator--but also sporting onboard hardware to detect AC zero crossings (like an old Akai sampler?) and change its resistance values quietly.

TLDR: Does the DS1881 work as advertised? Yep. 

Datasheet here.   





PCB DESIGN

"Not this post's project"

Instead of breadboarding (I hate breadboarding!) I created a simple DS1881 experimenter's board, used an Arduino UNO4 to generate the necessary I2C calls and vibe coded test sketches to create proofs of concept.

AI was a huge help (coding the test sketches) but also a burden (out to lunch--why the DS1881 was producing audible clicks when it shouldn't have-- in the end the bot's "answers" were nonsense, leading me down a lot of dead ends-- See the "How did it Sound" section below).  

The circuit fragment for the experimenters' PCB was stolen from the DS1881 datasheet; my test PCB offers additional circuit protection.


The  PCB:




For the op amps I used an MCP6004--DIP version--I had a whole tube of them.  

It's a rail-to-rail quad op amp, affordable and easy to use, but can only withstand 6VDC max at its rails without blowing up.....good choice for this application: the 6004 buffers the incoming signal (I added schottky diodes as well) to clamp AC input signals to about 0-5V.

Since I had an extra op amp stage I inverted and cap coupled one of the outputs--why not?

Power can be from wirepads (PWR-IN) or from a Eurorack style power 2x5 100 mil header (don't put power to both!!!).  

PWR-OUT  is +5 from the regulator, added it as a test point.

Audio ins and outs are on the top left "EYE-OH" 100mil edge pins; from the top: 

  • output for channel 1, 2.5V DC offset 
  • output for channel 0, Cap coupled
  • output for channel 0, 2.5V DC offset
  • input 1: used 4V P/P with 2V offset (worked for me--you might want to experiment with P/P and DC offsets)
  • input 0: ditto but for input 0.

For the 12V to 5V step down, I accommodated both a 7805 regulator (I have a box of them) and a low dropout, more "modern" choice: SOT-23-5 LP2895. If you build this board, please use one regulator or the other--don't use both!

USELESS BUILD PHOTOS

Always: happiness is new PCB's from this blog's patient sponsor, PCBWAY.


I used both THT and SMD for the project...sorry.  Grab the Kicad files (here) and modify away if you want....1001 uses.
.........built a bit of it, powered it up, and saw if there was a short. In this case, no short (yet).  Kept going.





Still no short! I had an ancient UNO-R3 I use only for getting I2C addresses (code here). Worked! Default with A0-1-2 pins grounded--I2C address for 1881 is 0x28.


I used an Arduino R4 for the rest of it--worked great for getting I2C calls into the test board quickly, then seeing serial output through the Arduino IDE.

Good to go! used a Siglent function generator for the test waves (4V P/P with a 2V DC offset) and a Eurorack patch cable to the bench BT mixer (here) to hear output--"seems working". Get the Coax to whatever boards here and here.

THE SKETCHES

Get them from Github: here.  

AD's I2C implementation for the DS1881 was simple; I vibe coded then debugged/modified the code--fast, fast, fast. The days of coding every line of anything may be gone for good.

For each .ino file you may need to drag the .ino into a new folder you create with the same name.

Simple stuff: take a look, experiment with different values, vibe code additional features, and have fun:

  • DS1881-diag.ino Run this first, the basic g/no go tool for the experimenter's board. Reveals if I2C can reach the DS1881, tells you via RS232 the IC's I2C address, does basic reads and writes to the DS1881's registers. Nothing for you to enter into serial monitor; the serial monitor's output tells you if your build works or is butt.
  • DS1881-enter-db-attenuation-value.ino. Entering a value 0 to 64 in serial monitor attenuates 0 and 1 channels by said DB.
  • DS1886-30ms-steps-100ms-hold.ino  Rapid attenuation followed by gain increase for both channels. So, a sort of poor man's tremolo. I wanted to see if fast fades caused clicking--so far, none heard. Suggestion: Mess with the ms values in the sketch to experiment with how fast I2C can control the pots and what sounds good to you.
  • DS1886-choose-zero-cross.ino The DS1881 fades inputs to -64db then the signal is gradually brought back to unity. Enter z into the serial terminal to toggle on and off the de-clicking algo inside the chip. This will give you a rough idea of how the DS1881 will sound vs. a digital pot that does not have a zero cross detection algorithm built-in.  

HOW DID IT SOUND?

At first--crappy.....no matter what I did I heard clicks. Hello? The whole idea: no clicks.  

Pouring over my circuit and code, many times--I think I got it right....but the IC wasn't working as advertised, so--did I?

Plugging everything into Claude, using every prompt I could think of, and adding the DS1881 datasheet to Claude.ai's RAG (Resource Augmented Goober-fication?), whatever, the chatbot told me that the audible clicks were just the way the DS1881 rolls and, like a bad marriage, I should just live with it.  

Did that sound right?

I took the project to my local group meetup--everyone meant well as always, but as far as a fix, no one (including me) had any idea why the DS1881 was clicking no matter what, I just got puzzled looks.  

Driving home it dawned on me--what if I set up the input signal wrong? Electronics is the same as US politics: always suspect stupidity. 

Went back to the bench and sure enough, I was not adding a 2V DC bias offset to the test input signal.  The datasheet clearly indicated that a bias offset was needed, but no, I booted it, which was confusing the hell out of the DS1881's anti-click algorithm.



I added a 2VDC offset and the IC worked--perfectly--no click, nice natural sounding butter-smooth fades, quick moves from -6 db to -60 db to whatever than back to mute--all without any distortion, clicks, clacks, or unwanted cross-tweeze. Musical. This is a really cool chip! 

Plugged this fix back into the LLM and it sort of said "oh yeh, my bad". Which is better, I guess, then a chatbot scolding me for being stupid.  



THE SHAMELESS PROMO


Quick word from this blog's sponsor! Once you have your design laid out, and want to see if it runs or is a smoking turd, RUN don't walk, to PCBWAY and get some prototype PCB's made....They also do great work with 3D printing, assembly and can even act as your OEM. You can support this blog by checking them out--link here--as well as the PCBWAY community (here).  And--best of all! for support you always get a friendly human, not a bot. Yes, it still can happen!


WHAT'S NEXT?


I am having a rev-2 experimenter's board fabricated as I write this. It allows the DS1881's two channels to be used as MCU controllable rheostats. 

I am not quite sure what I'd use that for, or if it will work at all, but that's the great thing about DiWHY in an era where small quantities of PCB's are available quickly and for little money; try it out, see what happens. 

Assuming I can get something useful out of this 2nd revision: it will show up in a future post, for sure, for sure. Update 8-15-26: posted! Go here.

See ya next time.
 

No comments:

Post a Comment