DIY Volume Control (Relay Attenuator)

I'm curious why you'd want to change the I2C address, though.
just for possible multichannel setups but you are kind of right, i could also do it this way:

design it as stereo and IF somebody really needs multichannel he can use something like https://de.aliexpress.com/item/1005004996004241.html

Yeah. That's commonly done. Get a linear ALPS RK271-series pot. But, of course, unless you get a motorized version you then also wave bye-bye to remote control.
ah another good catch, i didnt thought about the static position of the volume pot...

- i could disengage the volume pot once you used the remote control until you moved the manual pot to the same position the remote was set to, then it "engages again".... turning the volume put all the way down and up again would work too
 
for this reason i already wanted to provide clean 5V to the ULN2003, having a noisy power supply lane pretty close to the audio path might be better avoided if you can?
I'm also concerned for the exact same reason - using a 5V from SMPS to supply these relay driver chips instead of linear PSU
ULN2003 drops around 1.4V due to darlington transistors, I use ULN2803 (Cheap Chinese knockoff) and they drop 0.7V, enough to drive 5V relay. Probably these use single transitors instead of a proper Darlingtons as used in the original Toshiba chips
 
I'm also concerned for the exact same reason - using a 5V from SMPS to supply these relay driver chips instead of linear PSU
ULN2003 drops around 1.4V due to darlington transistors, I use ULN2803 (Cheap Chinese knockoff) and they drop 0.7V, enough to drive 5V relay. Probably these use single transitors instead of a proper Darlingtons as used in the original Toshiba chips
oh, good you mention the voltage drop, i wasnt aware, looks like i will need to provide 5V for 3V relays with a small voltage drop resistor to get to 3V

now thinking about it one could do this:
  • get one of these cheap 12mbit usb isolators, use this as input for the unit, if you wire things correctly this can also be used to program atleast the control unit
  • use the isolated side for the control arduino, in conjunction with a i2c isolator
  • split the power input before the isolator and route it to a high quality voltage regulator + some caps/filtering which powers the relays
  • now you can use one power supply, linear if you want and have everything powered by one power supply while majority of the (noisy) circuit is completely isolated
 
i also started doing the arduino project for the attiny controlling the relays
one thing i completely forget, you cant easly save the volume repeatedly without wearing out the eeprom... so i ended up doing it like this for now:
attiny starts muted
control unit could do it like this:
button to the control unit as power button, and the control mcu switching a relay after it has saved the current volume

i might also do a "base-board" for a raspberry pi pico or such or wiring seems to get quite messy

1. i2c display
2. i2c encoder
3. ir receiver
4. power button
5. 2x i2c outputs (preferably on seperate i2c channel) for relay board and input board
6. seperate 5V input
7. relay output

will use the same connectors as SparkFun is using for their Qwicc i2c system...

beside this the program for the attiny seems be very easy, tho i havent tested anything
https://pastebin.com/NvU6M0HC
 
- i could disengage the volume pot once you used the remote control until you moved the manual pot to the same position the remote was set to, then it "engages again".... turning the volume put all the way down and up again would work too
You could, but I think it would make for a really frustrating user experience, especially when you turn on the stereo the morning after a big party and the volume control won't let you turn the volume down until you turn it up past party volume first.

One could detect when the pot is being turned and just force the volume control setting to the position of the pot. But I still don't think that'd be a very intuitive setup.

But I'm certainly curious to hear what others think about this. I haven't been able to come up with a good solution, but that doesn't mean there isn't one out there.

  • get one of these cheap 12mbit usb isolators, use this as input for the unit, if you wire things correctly this can also be used to program atleast the control unit
  • use the isolated side for the control arduino, in conjunction with a i2c isolator
... or as we say on this side of the pond: I think you're trying to fill 20 lbs of sh*t into a 10-lb bag.

  • split the power input before the isolator and route it to a high quality voltage regulator + some caps/filtering which powers the relays
... and thereby voiding the isolation that you paid for with those fancy USB isolators. And never mind that those isolators usually work by transmitting RF across a capacitor, so following your own logic you're just replacing one noise source with another.

I've said it before and I'll say it again: I think you think too much and I think you worry about things that need absolutely zero worrying about. But, hey... It's your project.

It's true that switching digital logic makes some noise. But all that noise is contained inside the MCU. It's not like the old PC XT days where the 14.something XTAL sat outside next to a divide-by-3 CPU clock generator on a motherboard that was laid out to be a digital bounce house. If you have decoupling capacitors on the supply lines to the MCU that switching noise won't make it onto the PCB in any appreciable amount.
The digital outputs on the MCU are latched by a flip-flop. Look into how those work. They use positive feedback to ensure that the output stays firmly locked at either GND or VDD until the MCU tells it otherwise. So there's no switching noise there either as long as the outputs are static.
The transistors in the relay drivers will make some thermal noise (MOSFET) or shot noise (BJT) because you can't have heat or current flow without some randomness in electron movement. This noise could in theory couple from the relay coil to the switches. In theory. In practice, the noise will be really, really small. Probably on the same order of magnitude as the thermal noise of a 10 Ω resistor. And it would need to couple through a capacitor that's tiny (pF). This compared with the resistors in the attenuator which will be several kΩ in most cases and are in series with the audio path. For real? This keeps you up at night?

You could argue that talking to a port extender will make some noise. But you only do that when you update the volume setting. Do you really care about some indiscernible noise at several hundred kHz at that point? At all other times, you could put the MCU to sleep. It doesn't make any noise when it sleeps.

i might also do a "base-board" for a raspberry pi pico or such
Or maybe design a PCIe card for a PC. I dunno... I'm not really sure a modern PC has enough compute power to read an encoder and control some relays. Please help me. 😉

Seriously, I was able to do the exact same tasks as you some 15+ years ago in an Atmel ATmega165P without resorting to any fancy tricks. Any of the MCUs on the market today would be able to handle this task. So compute power should be the least of your concerns.

That said, if you insist on using an evaluation board or Arduino/Pi/whatever SBC (I still don't see why), I do support designing an I/O board of sorts. This board could have the attenuator on it. It could also have connectors for the display, encoder, etc. Boards are cheap and much easier to manage than a medusa head of wires.

Tom
 
... and thereby voiding the isolation that you paid for with those fancy USB isolators. And never mind that those isolators usually work by transmitting RF across a capacitor, so following your own logic you're just replacing one noise source with another.
no i split the power before the isolator
one lane goes trough the isolator to control mcu (which also has a i2c isolator so "overall isolation")
one lane goes to a voltage regulator which powers the relay boards

tho i wasnt sure about the DC-DC converter myself, your argument exchanging one noise source for another is kind of right, also audibly i can say cheaper usb isolators are not top of the cream...

one other route would be utilizing either a voltage regulator for the control mcu or just relying on passive filters (LC filters and such)

You could, but I think it would make for a really frustrating user experience, especially when you turn on the stereo the morning after a big party and the volume control won't let you turn the volume down until you turn it up past party volume first.

One could detect when the pot is being turned and just force the volume control setting to the position of the pot. But I still don't think that'd be a very intuitive setup.

But I'm certainly curious to hear what others think about this. I haven't been able to come up with a good solution, but that doesn't mean there isn't one out there.
yea it comes with its culprits... i probably like the solution best where you have to turn the volume to zero to engage it again, just to avoid any volume jumps

but it looks like im going for a encoder, i just bought some and will see how they feel

Or maybe design a PCIe card for a PC. I dunno... I'm not really sure a modern PC has enough compute power to read an encoder and control some relays. Please help me. 😉

Seriously, I was able to do the exact same tasks as you some 15+ years ago in an Atmel ATmega165P without resorting to any fancy tricks. Any of the MCUs on the market today would be able to handle this task. So compute power should be the least of your concerns.

That said, if you insist on using an evaluation board or Arduino/Pi/whatever SBC (I still don't see why), I do support designing an I/O board of sorts. This board could have the attenuator on it. It could also have connectors for the display, encoder, etc. Boards are cheap and much easier to manage than a medusa head of wires.
just because its easy to implement imo, i dont mind cheap parts for the "dirty side", but yea main idea of the base board was to maintain some cable management
 
Some encoders have detents and some not. After playing with a few I liked the encoder without detents. For volume control with an encoder I found that the pulses from the encoder need to trigger a pin change interrupt as poling for the changes isn't good enough to catch oll the pulses and you get glitchy response.

And for reinventing the wheel, as I have posted before: https://www.diyaudio.com/community/threads/preamp-control-volume-input-mute-remote.326029/
But you learn a lot by experimenting with your own project so have fun.
 
And for reinventing the wheel, as I have posted before: https://www.diyaudio.com/community/threads/preamp-control-volume-input-mute-remote.326029/
But you learn a lot by experimenting with your own project so have fun.
yea imo thats what its about 🙂 thanks i will take a read

I prefer experimenting with stuff others pay for.
regarding which context? Having a cable salad in terms of arduino modules?

oh the first one kit looks half decent for the price but i prefer doing my own
 
no i split the power before the isolator
one lane goes trough the isolator to control mcu (which also has a i2c isolator so "overall isolation")
one lane goes to a voltage regulator which powers the relay boards
Which still voids the isolation. You get coupling between the two sides through the regulator. How are you connecting the grounds on each side of the isolator? Together? If so, your isolator will do nothing to prevent noise transfer because all the return current will still flow in the grounds. In fact, adding the isolator will likely make the coupling worse as it forces a larger loop area on the traces that go through the isolator.

And now I2C isolators too??

Dude. I strongly suggest that you sit down with a schematic and trace the currents (signal currents, power supply currents, and return currents). If you have any shared path between the two sides of the isolator you will not get isolation. In fact, the issue that you seem to worry about will be made worse by the isolators.

Don't get me wrong. I'm not against isolators. I think they have a very valid use case on USB, for example. But that's also a case where you can power one side of the isolator from the USB 5V and the other side from your own circuitry. Grounds are kept separate. That gets you isolation.
In your case, however, you're worrying about something that doesn't need to be worried about and your worries are making you make decisions that will result in worse performance on the things that you worry about. Not to mention that you'll probably spend $100 on isolators that could be spent on better relays or better resistors ... ya know ... things that actually impact the audio performance. Or on a good encoder ... something that makes the attenuator more of a joy to use.

If you're worried about noise from the micro controller just shut it down when you don't need it. That's what the many levels of sleep mode are for. It doesn't make noise when it sleeps. It doesn't even snore...

Tom
 
  • Like
Reactions: benb and U102324
I have no idea how it works, but I doubt they really needed that FPGA.
To start with they have use gold contact relays. If any of the resistor values are too high for the fine adjustment part of the relay string, there can be direct capacitive coupling of relay coil turn-on/turn-off transients that couple into the high impedance resistor node. Making the overall impedance of the attenuator network lower, and using lower voltage relay coils can help. The other problem that make and break times of relays are not same. Don't remember which relays should switch first during a volume transition. Making and breaking multiple relays in the wrong sequence will make switching noise worse. Also, there are some volume level change points where several relays have to change at once. That can be a tricky transition to get through. It may be necessary to sequence relays such that any glitches will make a short dip in the volume rather that a short burst of volume.
 
  • Like
Reactions: tomchr
Which still voids the isolation. You get coupling between the two sides through the regulator. How are you connecting the grounds on each side of the isolator? Together? If so, your isolator will do nothing to prevent noise transfer because all the return current will still flow in the grounds. In fact, adding the isolator will likely make the coupling worse as it forces a larger loop area on the traces that go through the isolator.

And now I2C isolators too??

without i2c isolator the usb isolator is kind of useless, imo everything "ControlMCU" wise is completely isolated, i made a small diagram:

Screenshot from 2024-10-15 19-43-19.png



the relay boards are not isolated from the main power supply (PowerUsb/power over a usb socket) but the control mcu section is completely isolated from the remaining circuit that directly uses the main supply