MCU code for R2R volume

Hi,

There are a few volume control devices out there that have an MCU controlling six relays in an R2R network, can anyone share an example of the code used to switch the relays, I have read that the timing and sequence of the relays switching needs some TLC otherwise you can get unwanted noise in the audio, there was a mention of "carefully switching relays off before others on" and "special milli-second based timing of the relay state transitions".

I'm building a network-only R2R volume for my own Roon system and I don't want to reinvent the wheel.

Thanks for looking.

Cheers
Richard
 
Here is a thread about something similar.
Pop/click free HW-based relay attenuator V3
You will find details and a schematic that shows a hardware implementation.
From this hardware you can deduct a software code doing the same thing.
You will find too, my opinion: It is all BS, it will click and pop, whatever you do or claim, relays are too slow, bouncy, unequal about switching speed.
A better approach is using MDACs or FET switches.
 
"Zipper" is the abrupt repeated 1dB changes of a continuous switch.

When you have just 6 relays, there will be times you cut-out 16dB a little faster than you cut-in 1+2+4+8=15dB, and have a many-dB transient. Does not sound like a zipper. Sounds broken.
 
Last edited: