Does anybody happen to remember any calculators of that sort? Even if there's no longer an active link, if you do remember whose it was there's a chance it could be found in the archive.

Thanks

- Home
- Design & Build
- Software Tools
- Once upon a time Series, Shunt and Ladder attenuator calculator for selectable (ie. ≥ 24, ≤24) steps

You are using an out of date browser. It may not display this or other websites correctly.

You should upgrade or use an alternative browser.

You should upgrade or use an alternative browser.

- Thread starter Hearinspace
- Start date

Does anybody happen to remember any calculators of that sort? Even if there's no longer an active link, if you do remember whose it was there's a chance it could be found in the archive.

Thanks

And run the following code (input your desired values where it says #example usage):

from math import sqrt, pow, log10

def calculate_attenuator_resistors(num_steps, db_per_step, total_attenuator_impedance):

attenuation_ratio = pow(10, db_per_step / 10)

total_attenuation = pow(attenuation_ratio, num_steps)

resistance_ratio = sqrt(attenuation_ratio)

current_resistor = total_attenuator_impedance / ((1 - resistance_ratio ** num_steps) / (1 - resistance_ratio))

print("Step\tResistor Value (ohms)")

resistor_values = []

for step in range(1, num_steps + 1):

print(f"{step}\t{current_resistor}")

resistor_values.append(current_resistor)

current_resistor *= resistance_ratio

print("Resistor Values:")

for resistor_value in resistor_values:

print(resistor_value)

# Example usage

num_steps = 60

db_per_step = -2

total_attenuator_impedance = 100000

calculate_attenuator_resistors(num_steps, db_per_step, total_attenuator_impedance)

Trying to make the first post as short as I could I deleted the rotary word thinking it wasn't essential in thinking of value calculations. I'd forgotten about relay based circuits.

Nevertheless, now there are other suggestions for relay based attenuators (thanks Mark!) the thread may be more generally useful.

The original reason i asked is because these days 24 steps seems to have become the de facto standard for calculators based on rotary switches, but the best deals at surplus storefronts are often on old overstock custom types from OEM or MIL shelves.

For example, one local place has a bin of 32 position switches with heavily tarnished or dirty contacts but with 5$ price tag might be worth mixing and matching some of their parts to make up a good working unit. Mulling it over and poking around on the web it's clear most don't consider other than 24 steps a possibility.

. . . . and to answer swich401's first question, . . . . All three.

Thanks

After clearing the instruction on line one , I tried to run a direct copy and paste of your code from above but got errors of unexpected indent and expected indent. On following the prompts eventually got to 'attenuation_ratio' is not defined. Haven't tried past that. Does a direct copy and paste work on your machine?

Thanks

- Home
- Design & Build
- Software Tools
- Once upon a time Series, Shunt and Ladder attenuator calculator for selectable (ie. ≥ 24, ≤24) steps