Tuesday 28 March 2023

37 - Designing Attenuators without Maths

 When testing amplifiers you need to be careful you don't blow up your test gear! Modern items can often not tolerate more than a milliwatt of power at their input terminals and if you are testing a 10W amplifier you need at least a 40dB attenuator. Or a 40dB power tap - see the next article.

Also an attenuator of a few dB is often recommended between modules, such as between a driver generating 1W that feeds its signal into a 10W amplifier that has more than 10dB of gain. Such interstage attenuators improve matching as they make the SWR (the return loss) better.

We can either buy attenuators from Amazon/Ebay/Aliexpress/Bangood or make our own - they are made of three resistors that cost pennies.

Here are some that I have bought or been given;



SMA-JK Male to Female Stainless Steel RF Coaxial Attenuator Frequency Range DC-6.0GHz Attenuation Range (5db)

I bought three for under £25 I think they can cope with 2W






BECEN 40db 10 watt 10W SMA RF fixed attenuator 3GHZ Connectors 10 watt SMA male to female type

One 40dB type cost me £28.00












I don't know where these old BNC to BNC 20dB attenuators came from but they are useful as half my test gear uses SMA connectors and most of the rest (the older stuff) uses BNC connectors, I also have a Bird SWR/Powermeter that uses N-type and a couple of devices that use SO239/PL259 UHF connectors. I need a lot of adaptors!


So how do you make your own? a two resistor simple potential divider does reduce voltage but does not keep impedances at the destination port correct. Since most of our circuits are designed with 50 Ohm input and 50 Ohm output impedances we need three resistors to keep this true. 

You can design attenuators for use in 75 Ohm systems - used in broadcast Video and TV, you can even design attenuators for 600 Ohm circuits, used in professional line level audio but you can' mix and match, you need "50 Ohm" attenuators for 50 Ohm circuits



The maths behind the three resistor attenuators in either of the "Pi" or "T" configurations is not too bad but takes time. Better to use some of the inline calculators, or the tables in the back of the RSGB or ARRL handbooks. 

(there is a better one at https://leleivre.com/rf_pipad.html but we will learn more by using the first)


Note, we specified 50 Ohms and it calculated roughly 300 Ohms and 18 Ohms for the required resistors. Two questions remain, how inaccurate is it if we use preferred value resistors and what wattage do the resistors need to be if we apply 10 Watts?  (18 Ohms and 300 Ohms is actually 2.995dB with a return loss of -44.6 dB so that is not bad...)

We can use LTspice to answer this rather than doing a lot of maths. Before discussing LTspice, note that there are alternative circuits to the "Pi" circuit above, the three resistors can be arranged in a "Tee" shape, you need to recalculate the resistor values as shown, you.ll  find it needs an 8.5 and 140 Ohm resistors.

8.5 Ohms is a bit awkward - you could use two 18 Ohms in Parallel I suppose to get 9 ohms. I don't have any 140 Ohm resistors either but maybe a 100 Ohm in series with a 39 Ohm would do. Again, you need to know what inaccuracy is introduced by not having quite the right values and what power rating each resistor needs to be.

LTspice can take the pi attenuator circuit, apply a voltage with an internal impedance of 50 Ohms and connect a 50 Ohm load to the output. You can then measure the exact attenuation, the power consumed in each component and even the SWR (the return loss) for both the input and the output. You can vary the components to what is convenient and see if the performance (the accuracy) is ok. You can even run the circuit a thousand times with minor changes to the resistance values and this can tell you if 5% or 2% resistors are ok.

First I will show you how to use LTspice to show the "gain" (the attenuation) and the input and output return losses. The return losses can be converted to SWR if you prefer but accept for now that high return losses are low SWR and are a good thing. An SWR of 1.5 to 1 is a return loss of 14dB (see https://www.everythingrf.com/tech-resources/vswr if you want a useful chart).

The LTspice circuit below has a voltage source that MUST have a internal series resistance of 50 Ohms, likewise the load resistor on the right must be 50 Ohms. I have set the voltage source to have an AC value of 20V but you can use any value.

As well as setting a voltage source and load we must also tell LTspice what to do with the circuit. In this case I want an .AC analysis. This sweeps a range of frequencies - not that important for simple resistive circuits, we could have done a .DC analysis instead but the second type of analysis requires an .AC one to be done. The .NET analysis allows us to plot the S-parameters for this circuit, just like  nanoVNA would. You need to know that S21 is the "gain" which comes out at -3dB and that S11 and S22 are the input and output return losses.


After "running" the simulation you can rightclick in the white plot pane and select S21,S11 and S22 to be plotted, clicking on the names at the top reveals the exact value at the cursor. 

S21 is -2.9996 dB,   S11 and S22 are -89.39dB

Changing the resistors to 18 and 300 yields results of 

S21 is -2.9946 dB,  S11 and S22 are 44.578 dB, an SWR of  1.01 to 1

Changing the resistors to 18 and 330 Ohms yields

S21 is -2.86 dB,  S11 and S22 are 35.13 dB , an SWR of  1.035 to 1

And so forth! experiment!

To calculate the power you have to do an analysis over time and not a .AC sweep. This is the .TRAN analysis and once done, you can probe various resistors in the circuit to reveal what power they are consuming. To do this you run the simulation and hold down the ALT key whilst hovering over a resistor. Clicking will plot the power. Or use the .meas commands in the simulation.


Instantaneous power goes up and down as the input voltage goes up and down so you really need the average of this waveform. Alternatively hold down the control key and click on the label at the top of the plot pane it will calculate average power over the entire plot pane window.

An advanced use of LTspice is to get it to look at the simulation results and then do some calculations, this is down by adding lines beginning with .meas as shown. Once you add .meas lines to a schematic then after the simulation finishes there are messages added to the spice log file, erroneously called the spice error log. You can access this by hitting control-L after the simulation finishes or by accessing the top level View menu item and picking View Spice error log. For the circuit above you will see this;



Hence with nearly a watt in (0.9755992) you get nearly half a watt out (0.488965) - 3db!

The three resistors dissipate 166mW, 236mW and 83mW in R1, R2 and R3. So quarter watt resistors are sufficient to handle a watt of input. Making minor tweaks to the resistor values won't change this.

So there you are, a way of designing attenuators with no maths! as a short cut,here is a table I copied from the URL 


The work of John Dunn, you can reach him by emailing mailto:ambertec@ieee.org



Having said this article is about attenuators without maths it would be useful to finish with a more analytical approach. I am writing a spreadsheet that calculates things, you can look at the formula and notes to see how it does it. It is no more complicated than putting resistors in parallel and series.

The spreadsheet will end up here; attenuator.ods (in my goggle drive) It was created using libreoffice 7.5 - I am trying not to use Microsoft Office.