Readers: If you'd like to build the DS1881/ATTINY1616 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 a sample sketch and C++ library for the DS1881, 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!
===============
I had so much fun with the DS1881--see this previous post--that I made another breadboard-bustin' experimenters' board for this cool digital potentiometer.
![]() |
| "DS1881-as-rheostat expermntr. brd." |
The board deviated from the example found on the last page of the DS1881's data sheet: I added an on-board MCU (ATTINY1616) and exposed the IC's potentiometer pins as well as GPIO on the PCB's edge connectors. Gone were the op amp buffers. My idea: see if using the pot's L/W/H (low, wiper, high) pins as a rheostat could yield cool things like I2C controlled active filters.
I also uploaded the DS1881's datasheet into Claude Code and told the bot to create a C++ .h library file for the experimenter's board, something I had never tried before.
Did it work?
At first--nope.
Eventually, yes.
THE USELESS BUILD PHOTOS
![]() |
| Double happiness is new PCB's from this blog's patient sponsor: PCBWay! |
![]() |
| No smoke yet.... |
![]() |
| The DS1881's I2C address is configured through hardware. If you build this project jumper or short the 0x28 or 0x29 pins to choose its I2C address. |
![]() |
| For proofs-of-concept I am using MCUs that support UPDI (ATTINY generation 2 and 3) more and more often. UPDI is super easy--one wire for data and one for ground to blast firmware into the MCU--see the video here. Serial monitoring isn't through USB however--for that I exposed the TX /RX and ground pins on edge connectors which got fed into a NUC Linux PC running minicom. |
CLAUDES AND SODS
Normally I would have read, re-read then re-re-read the DS1881's datasheet; over the coarse of a few days create a C library file for it. Not this time--my tech friends told me to get with the program and get AI lazy.
Fair enough.....I used Claude Code to create a C++ .h driver file for this project:
- Installed Claude Code
- Logged in using my Claude account.
- I created the local directory for the project, cd'd into it then typed claude.
- Using "browser Claude", I talked the bot through what I was trying to do.
- The bot helped me create the Claude.MD file, necessary for project sanity, which I saved in the project root directory.
- I uploaded the DS1881 datasheet PDF into the same directory.
- I didn't record the prompts I used for the initial build, but it was something like read the datasheet PDF and create a single .h file C++ library for the DS1881; use Arduino wire for I2C Hardware abstraction, and create an Arduino INO file to sweep each pot from 0db to -60db every 300ms then sweep back from -60db to 0db.
- I discovered a free tool to see Claude prompt histories (here) ex-post-facto.
- This tool works great, but at this point I'm too lazy to dig back through the Claude directories and get you guys the actual prompts. Maybe later.
As already mentioned, the hardware, library, and test sketch didn't work at first. Using a DVM there was no change in resistance between H0/W0, W0/L0, nor the H1/W1,W1/L1 pins.
Meaning: As a rheostat the DS1881 wasn't working.
Begged the question: can the DS1881 be used as a rheostat at all? I thought so, and AI said it should work, but I didn't see a smoking gun in the DS1881's datasheet.
So--to be sure, I emailed Analog Devices, who got right back to me--yes this should work; if I coded my firmware right, I should see resistance values of about 40K to about 4K across H0/W0 or W0/L0 as I swept the DS1881's digital pots using I2C.
However, the DVM always showed about 30K no matter what; it was broken, but why?
I fired up my logic analyzer:
![]() |
| After years of using cheap, crappy logic analyzers I spent a small fortune upgrading to a saleae. Worth it? Every dime. |
The I2C data stream revealed that the DS1881 I2C initialization was working, but after that, nothing--no I2C traffic to sweep the pot's wiper.
Good news in a way--it meant that I2C was basically working, the chip was being initialized, but still--the damn thing didn't work.
Hello?
I reported this observation--initializes OK but no sweep--back to Claude Code. The bot revised the .h file and the ino sketch.
Took the bot like 5 minutes. Would have taken me a few days.
Uploaded the revised code and .ino into the ATTINY1616 and--it worked.
WAIT! FROM THIS BLOG'S SPONSOR:
....why bother breadboarding when you can throw your ideas into Kicad, gerber-a-roni, ship them off to PCBWAY, and get 5 or 10 boards back to mess with.
That's what I did here and overall a huge timesaver. No messing with SMD to THT adapters. No junky dupont cables breaking. No being off by one 100 mil pin and frying your expensive IC.
PCBWAY is super fast and their prices are so affordable breadboarding sometimes makes little to no sense.
NOW WHAT, DR. SHANNON?
No photos, but I breadboarded a few circuit ideas using the rheostat--voltage dividers, op amp gain, an active filter--using the exposed DS1881 pot pins.
I could type on and on about this, but I'll spare all of us all a lot of time: to me, there was nothing I could come up with using the DS1881 as a rheostat that I couldn't do more efficiently with more "traditional" voltage or current controlled variable resistors like OTA's or Vactrols.
The DS1881 shines doing what it was designed to do--an I2C controlled stereo attenuator with a nice sounding log curve and a anti-click algorithm baked in its hardware.
Beyond that, not so sure.
I think that's where I will leave things this time before the DS then.....
THE CLAUDE CODA
| Along with my hero, Bob Widlar, Claude Shannon (the original Claude!) was one of the most brilliant and colorful tech dudes of all time. Fascinating guy....Wikipedia here. |
Reviewing Claude's Code: the library looked a lot more professional and succinct vs. what I would have coded by hand, employing extensive bitmasks, many more #defines than I would ever have used, and everything else C++ that drives me nuts.
I need to test each method, but haven't yet. Something about Claude Code makes me feel--lazy.
Good enough?
The AI's output made me realize that I suck at Boolean Algebra so I got back into Claude Code and had the Claude whip up a Python/UV learning tool that (hopefully) will help me master bitwise statements in C and C++ some day.
This Python script was created with a single prompt--no revisions:
I need to learn bitwise operations in C and C++. This includes &, |, XOR, |=, ~= example statements like uint8_t commandByte = reg | (value & WIPER_VALUE_MASK); the learning tool should allow me to use single bytes (8 bits) and perform bitwise operations on them. Write a program in Python to help me learn the syntax of these C and C++ calls. Data entry and what is shown as the final output should entered and shown as Hex (0x04 for example) and bits (0b00001111)
The output came out better than I expected--it does a lot more than I would have thought necessary, and maybe is even fun to mess around with.
Get the bitwise learning tool from github, here. Get UV here. Get stoopid here. We're cooking with oil!
I'll admit it--Claude is smarter than I am, maybe some day I will catch up a little?
Nope.
See ya next time.




















