DIY Volume Control (Relay Attenuator)

Hello, after looking around for options i would like to build my own volume control, relay based one seem to be one of the best and they allow me to play around with arduino again

some features im looking for

  • atleast 1db steps
  • 2x2 XLR Balanced Inputs
  • 2x2 XLR Outputs

Microcontroller for:
  • Display
  • Rotary encoder
  • Remote
  • Mute Button
  • Input Select Button
  • Output Select Button
  • Saving Volumes for each input

If Possible:
A "desktop unit" controlling the main unit (IR?)

imo the most flexible i stay with a relay board that basicly just contains the relays, i might do a seperate controller board (or wire it individually)

Questions i still have
1. i saw a design with 6 relais (-1db, -2db, -4db, -8db, -16db, -32db) but it seems this design has up to 6 resistors in series, isnt a shunt stepped attueuator "better" with only two resistors?
2. which type of relais/resistors? pref 0,1% precision
3. any recommendations or ideas are welcome 🙂 also when people are interested i buy a few boards more...
 
Last edited:
  • Like
Reactions: eclipsevl
08012014008.jpg

Something like this? Seven relays uses a normal pot into an A to D input and need not remember the setting. 128 steps & mute. follows the pot taper, log or lin
 
  • Like
Reactions: Ghoostknight
So, i was looking around a bit

is there another circuit than this: https://www.amb.org/audio/delta1/ ?

as i see it the signal goes over 6-8 relay contacts + resistors

if i understand the schematic correct basicly every relay acts as passtrough in idle and switched there is a voltage devider to reduce volume by 0,5db, 1db, 2db, 4db, 8db, 16db, 32db , the circuit makes sense but i read something about a circuit only having 2 resistors in the path, is this only possible with a 24pole switch attenuator?


also i would like to buy pcbs preassembled by JLCPCB, can you recommend resistors that are available at LCSC.com for this? tho i also wanna include a optional trough hole option to upgrade the resistors later on...

pcb will definitely be produced in 2Oz copper
and relais are so far omron g6k-2f
 
still questioned whether i should do a input switch board and attenuator board seperately, i guess its more universal this way

then i also could include connectors on the input board (or atleast the option to solder some)

also still questioned whether i should do in this case TRS or XLR balanced... (or both?)
 
Hi,

I have a similar project with 1dB steps, -63dB max attenuation:
1728031026517.png


The MCU can handle potentiometer, encoder and i2c control. For the input/output selection and more control I was thinking to have another module. Not everyone needs multiple inputs/outputs 🙂
also i would like to buy pcbs preassembled by JLCPCB, can you recommend resistors that are available at LCSC.com for this? tho i also wanna include a optional trough hole option to upgrade the resistors later on...
In such case it will be much easier if you put 2 resistors in parallel to obtain necessary value.
 
  • Like
Reactions: Ghoostknight
In such case it will be much easier if you put 2 resistors in parallel to obtain necessary value.
oh will try this, tho if it doesnt work out i will just add a troughhole option and see where i will source them

The MCU can handle potentiometer, encoder and i2c control. For the input/output selection and more control I was thinking to have another module. Not everyone needs multiple inputs/outputs 🙂
im not much worried about the mcu/software part, cool project todo something once again with arduino/platform io 🙂

tho i was also playing around the idea to have an tiny mcu on each board that can be communicated with over i2c or such, its either this or mcu rdy inputs for each relay, probably with transistor, would like to use optocouplers but they are either 50mA (vs 100mA relays) or with transistor output..

What mcu do you use on your board that can switch the relays directly (as it seems), or what is the second chip?
EDIT: is it something like an ULN2803 darlington transistor array chip?
 
Last edited:
In my experience you need an MCU with open collector output and using 12V relays, which draws the least current. MCU spec maximum current per port not by I/O kindly check what the total current and power consumption is if all relays are pulled in, will the port handle it. I think not, therefore it is best to add transistor interface with each of the relays.

When I designed my attenuation I found that you can hear the transition at the high end of the relays because let us assume you up the volume between the second last and last step i.e. dropping out relays 1,2,3,4,5,6 and pulling in relay 7 the result is very audible in that presents a loud pop on the speakers (very loud).

I have not been able to solve that because it is a function of relay timing and large chunk of attenuation. You may need to experiment with the control code to mitigate this, maybe by dropping the relays in succession from LSB to MSB and turn on the last relay 7 so the transition would be a linear regression rather than an impulse.

This was particularly annoying using headphones because you can hear a tick, tick going from soft to loud then soft to loud each time you turn the volume up or down. It irritated me so much in the end that I diverted to a normal volume control and the switcher lies in the cupboard.

In manual switching volume controls they use a make before break arrangements that seems to not have this problem. Also in volume control chips which has very fast switches internal, I do not hear this problem

Did I make myself clear on the issue and is it understandable.

EDIT: I tried placing all the switches in RAM and then outputted them as a single change, each time that the potentiometer moved but was a little sloppy or unresponsive because I waited until the pot position is not moving before sendng the new state to the relays which then activate it. It happened within a relay switching time but still remained audible. It was sort of acceptable when indicating the volume setting on display and when it stopped then switch all the relays at once so you kind of expected the pop.
 
Last edited:
You've probably figured this out already, but I'm just going to drop this in here to the benefit of those who read this thread years from now.

You basically have two fundamental options for the attenuator:
  • Potentiometer / resistor ladder
  • Binary weighted
The resistor ladder option uses one relay per step, so if you want, say, 120 dB attenuation in 0.2 dB steps that gets really, really expensive. But nobody says the steps have to be the same size, so you could do something like -120 dB to -60 dB in 6 dB steps and 1-2 dB steps thereafter. That would cut down on the number of relays. This style of attenuator would be guaranteed to have no missing codes, i.e., the attenuation would be monotonically increasing for each step.

If you're going for lower cost, a binary weighted attenuator makes more sense as it only uses log2(N) relays, where N is the number of steps. So that 0 dB to -128 dB attenuator in 0.5 dB steps suddenly only takes up 8 relays (log2(256) = 8). But then you can't guarantee an even step size or no missing codes.

It seems the -120 dB or -128 dB values are pretty common for the highest attenuation in DIY builds and I think that's simply because 2^7 = 128. But I am willing to bet that most relay based attenuators will struggle to get even 80 dB of attenuation due to the capacitive coupling through the relays, so the lower steps are really wasted. The other aspect is that the resistor ratios in the attenuator steps get pretty extreme at -64 dB and beyond, which will impact the DNL of the attenuator, i.e., you start to get uneven step size and might even start seeing missing codes and such. I'm not suggesting this is a problem per se, but the step size vs attenuation setting is something that I would measure.

There are some great attenuator calculators out there that will give you standard resistor values for a binary weighted attenuator. Here's a good one: https://www.vaneijndhoven.net/jos/attenuator-calculator/index.html. You'll notice that you need to get resistors from the E96-series to maintain better than ±0.5 dB DNL.

Then there's the matter of relay control. You will likely have to write the code such that extreme clicks and pops are avoided, especially on the 2^x boundaries (so step 31 to 32, for example).

I doubt you'll be able to drive a relay directly with a micro controller. You might find some uC that has some high-current outputs. And maybe one of these outputs can drive a relay directly. But be a bit careful and read the data sheet. The uCs I've seen with high-current outputs have typically had a limitation on the total output current that can be provided, so you might find that you can drive 1-2 relays but driving all 8 will blow the uC. This is where relay drivers such as the ULN2003LV come in.

I love these kinds of "simple on the surface" types of projects. They allow for much geekery. Have fun! And choose some good metal film resistors for the attenuator steps.

Tom
 
i think i know what you mean but what schematic are you referring to i think there are multiple ways

relay arrangment:
-32db -16db -8db -4db -2db -1db

relay 6 active would mean -1db
so if you switch from -2db (relay 5 active) to -1db (relay 6 active) you could use your mentioned "make before break" method

Or do i have a misunderstanding how this circuit works: https://www.amb.org/audio/delta1/ (left side "schematic")
 
  • Like
Reactions: U102324
I have not been able to solve that because it is a function of relay timing and large chunk of attenuation. You may need to experiment with the control code to mitigate this, maybe by dropping the relays in succession from LSB to MSB and turn on the last relay 7 so the transition would be a linear regression rather than an impulse.
According to Benchmark, who uses a relay attenuator in their HPA-4 headphone amp / preamp, getting rid of that zipper noise was quite an ordeal. They claim to have some secret sauce in an FPGA to ensure that there're no pops when you turn the volume control. I have no idea how it works, but I doubt they really needed that FPGA.

Tom
 
  • Like
Reactions: U102324
And I agree with you totally if you had a 128 step attenuation with .5 dB steps you will not hear the transition, but now that is expensive and high end in more ways than one.

When I was at HP all the equipment had 0.1 dB dedicated on chip step attenuation and 10dB relays for those 10 dB jumps and you could audible hear the physical clicks of the relay at each 10 dB steps selecting the next range.
 
Last edited:
You've probably figured this out already, but I'm just going to drop this in here to the benefit of those who read this thread years from now.

You basically have two fundamental options for the attenuator:
  • Potentiometer / resistor ladder
  • Binary weighted
The resistor ladder option uses one relay per step, so if you want, say, 120 dB attenuation in 0.2 dB steps that gets really, really expensive. But nobody says the steps have to be the same size, so you could do something like -120 dB to -60 dB in 6 dB steps and 1-2 dB steps thereafter. That would cut down on the number of relays. This style of attenuator would be guaranteed to have no missing codes, i.e., the attenuation would be monotonically increasing for each step.

If you're going for lower cost, a binary weighted attenuator makes more sense as it only uses log2(N) relays, where N is the number of steps. So that 0 dB to -128 dB attenuator in 0.5 dB steps suddenly only takes up 8 relays (log2(256) = 8). But then you can't guarantee an even step size or no missing codes.

It seems the -120 dB or -128 dB values are pretty common for the highest attenuation in DIY builds and I think that's simply because 2^7 = 128. But I am willing to bet that most relay based attenuators will struggle to get even 80 dB of attenuation due to the capacitive coupling through the relays, so the lower steps are really wasted. The other aspect is that the resistor ratios in the attenuator steps get pretty extreme at -64 dB and beyond, which will impact the DNL of the attenuator, i.e., you start to get uneven step size and might even start seeing missing codes and such. I'm not suggesting this is a problem per se, but the step size vs attenuation setting is something that I would measure.

There are some great attenuator calculators out there that will give you standard resistor values for a binary weighted attenuator. Here's a good one: https://www.vaneijndhoven.net/jos/attenuator-calculator/index.html. You'll notice that you need to get resistors from the E96-series to maintain better than ±0.5 dB DNL.

Then there's the matter of relay control. You will likely have to write the code such that extreme clicks and pops are avoided, especially on the 2^x boundaries (so step 31 to 32, for example).

I doubt you'll be able to drive a relay directly with a micro controller. You might find some uC that has some high-current outputs. And maybe one of these outputs can drive a relay directly. But be a bit careful and read the data sheet. The uCs I've seen with high-current outputs have typically had a limitation on the total output current that can be provided, so you might find that you can drive 1-2 relays but driving all 8 will blow the uC. This is where relay drivers such as the ULN2003LV come in.

I love these kinds of "simple on the surface" types of projects. They allow for much geekery. Have fun! And choose some good metal film resistors for the attenuator steps.

Tom

i think the most sensible thing is 64db with 1db steps, it also saves some relays which i consider a good thing since the binary type of attenuators seem to be relays in series in the signal path...

and yea im glad i found this kind of project, perfect for me as a beginner i would say and i finally wanna get a preamp, so i can let digital volume run at max, its also quite surprising what you can save here, the cheapest volume controls in this fashion seem to start at what? 500+ euro 🙁

i will probably go with the ULN2003, nice and easy hehe 🙂 the central location of all transistors also let me experiment better with physical isolation

5v power supply terminal + one mcu input per relay
i guess that way i could also use these before the inputs: https://www.aliexpress.us/item/32879970752.html
(if you ask why, just so i can isolate all the mcu stuff completely from the board containing the audio signal)
not sure yet if i will actually do a MCU board, its easlly done with such "arduino modules" if i can just hook up the outputs to the relays


probably the perfect remote button wise: https://www.aliexpress.us/item/1005007067037955.html , tho its a bit ugly.. 😀
 
I have an audiophile quality relay based attenuator that is fully balanced, and has many features. Arduino Mega driven. See:
start at post #508 for the last design.
 
I have an audiophile quality relay based attenuator that is fully balanced, and has many features. Arduino Mega driven. See:
start at post #508 for the last design.
cheers, thanks 🙂 i might get some ideas i will have a look 🙂

Did you try around with different resistors for attenuation? still wondering which ones i should take

abit expensive but i dont mind a 20-30 euro bom, i was looking at these: https://www.hificollective.co.uk/components/resistors.html
 
Try RN60 resistors. Here is my volume control.
and i thought there are not many projects like this 😀 i will have a look thanks 🙂

it seems you went in the end with a opamp design as volume control, was it a big improvement? or did you notice flaws with the relay attenuator like being sensible to different cables or such?

what me interest the most is that these relay attenuators act completely passive, so they dont will add anything by opamps/tubes/distortion etc

form sonic descriptions these ones https://www.hificollective.co.uk/components/kiwame.html kind of intriqued me
tho im unsure of the performance of carbon film resistors, carbon comp seems quite bad self-noise wise, but also many swear by it sonic-wise and they are relatively cheap (and oversized, 2W if that really matters)