Hello again.
In the past I've breadboarded digital pots to find in some cases they make an audible "click" when changing resistance values.
I recently stumbled upon an IC that did away with the click--Analog Device's DS1881--dual pots, I2C, log response--everything needed for an MCU controlled audio attenuator--datasheet here.
Does the 1881 work as advertised? Yep.
Instead of breadboarding (I hate breadboarding!) I created a simple experimenter's board, used an Arduino UNO4 as a programmer and vibecoded test sketches to test the IC and create proofs of concept.
 |
| What I don't want.... |
AI was both a huge help (coding the test sketches) and also a huge burden (being out to lunch about why the device was producing audible clicks when it shouldn't).
The circuit fragment the PCB is based upon is in the datasheet; my test PCB is pretty much a copy with some additional circuit protection.
The Kicad PCB:
For the op amps I used an MCP6004--DIP version because I had a whole tube of DIP 6004's.
It's a rail-to-rail quad op amp, affordable and easy to use, but can only withstand 6VDC max at its rails or the IC gets fried.
Good choice for this application, the 6004 buffers the incoming signal (I added shottkey diodes as well).
Since I had an extra op amp stage I inverted and cap coupled one of the outputs, because, why not?
Power can be from pads or from a Eurorack style power header. For the 12V to 5V conversion, I added both a 7805 (I had a lot) and a LP2895. If you build this board, use one regulator or the other--don't use both!
USELESS BUILD PHOTOS
 |
As always, happiness is new PCB's from this blog's patient sponsor, PCBWAY.
|
 |
| I used both THT and SMD for the board. Strange, I know, but, what do you want for $5USD. Grab the Kicad files (here) and modify away if you want....MIT license, baby! |
 |
| I have started to build a bit, power up, and see if there is a short. Then build more. |
 |
| Getting the address, I have an original UNOR3 for that. Default with A0-1-2 pins grounded is indeed 0x28 |
 |
| For the firmware upload I used a new Arduino R4--worked great for loading I2C into the test board quickly, and seeing serial output without a lot of hassle. |
 |
| "seems working"--used a siglent function generator for the test waves (4V P/P, 2V DC offset) and a connector to the project here to hear output. |
THE SKETCHES
Get them from Github:
here.
AD's I2C implementation for the DS1881 is wonderfully simple; I vibecoded then debugged and tweaked what the bot conjured.
For each of these .ino files you may need to drag the .ino into a new folder you create with the same name as its ino file.
These sketches require the serial monitor tool in Arduino IDE.
Simple stuff--take a look, experiment with different values, 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, the IC's I2C address, can the IC do basic reads and writes. Nothing for you to enter into serial monitor; the serial monitor's output tells you what you need to know.
DS1886-30ms-steps-100ms-hold.ino Rapid attenation followed by gain increase. So, a sort of poor man's tremelo. I wanted to see if fast fades caused clicking--so far, no. Mess with the ms values to experiment with how fast I2C can control the pots.
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 declicking 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.
Plugging everything into
Claude, using every prompt I could think of, and adding the DS1881 datasheet to Claude.ai's whatever, the chatbot seemed to indicate that the audible clicks were just the way the DS1881 is 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? Went back to the bench and sure enough, I was not adding a 2V offset to the test input signal, which was confusing the hell out of the DS1881 IC. The IC's datasheet was clear that a DC offset was needed for the input signal.
I added the DC offset and the IC worked--absolutely perfectly--immediately--no click, nice smooth fades, quick moves from -6 db to -60 db to whatever than back to mute--all without any clicks. Very musical. This is a really cool chip!
THE SHAMELESS PROMO
Quick word from this blog's sponsor! Once you have your design working in Falstad, run, don't want 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 (link
here)
WHAT'S NEXT?
I am having a second experimenter's board fabricated. It will allow the DS1881's two channels to be used as a rheostat. I am not sure what I'd use that for, or even 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: whatever happens will show up in a future post. See ya next time.