Silicon Chip0-110dB RF Attenuator for Signal Generators - August 2023 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Subscriptions: PE Subscription
  4. Subscriptions
  5. Back Issues: Hare & Forbes Machineryhouse
  6. Publisher's Letter: Interested in robots?
  7. Feature: How long until we’re all out of work? by Max the Magnificent
  8. Feature: The Fox Report by Barry Fox
  9. Feature: Net Work by Alan Winstanley
  10. Project: Wide-Range OhmMeter by Phil Prosser
  11. Project: 0-110dB RF Attenuator for Signal Generators by Charles Kosina
  12. Project: SPY-DER A 3D-PRINTED DIY ROBOT by Arijit Das
  13. Project: Universal Battery Charge Controller by John Clarke
  14. Feature: PAS CO2 Air Quality Sensor Module by Jim Rowe
  15. Feature: Circuit Surgery by Ian Bell
  16. Feature: Max’s Cool Beans by Max the Magnificent
  17. Feature: AUDIO OUT by Jake Rothman
  18. Feature: Make it with Micromite by Phil Boyce
  19. PCB Order Form
  20. Advertising Index

This is only a preview of the August 2023 issue of Practical Electronics.

You can view 0 of the 72 pages in the full issue.

Articles in this series:
  • (November 2020)
  • Techno Talk (December 2020)
  • Techno Talk (January 2021)
  • Techno Talk (February 2021)
  • Techno Talk (March 2021)
  • Techno Talk (April 2021)
  • Techno Talk (May 2021)
  • Techno Talk (June 2021)
  • Techno Talk (July 2021)
  • Techno Talk (August 2021)
  • Techno Talk (September 2021)
  • Techno Talk (October 2021)
  • Techno Talk (November 2021)
  • Techno Talk (December 2021)
  • Communing with nature (January 2022)
  • Should we be worried? (February 2022)
  • How resilient is your lifeline? (March 2022)
  • Go eco, get ethical! (April 2022)
  • From nano to bio (May 2022)
  • Positivity follows the gloom (June 2022)
  • Mixed menu (July 2022)
  • Time for a total rethink? (August 2022)
  • What’s in a name? (September 2022)
  • Forget leaves on the line! (October 2022)
  • Giant Boost for Batteries (December 2022)
  • Raudive Voices Revisited (January 2023)
  • A thousand words (February 2023)
  • It’s handover time (March 2023)
  • AI, Robots, Horticulture and Agriculture (April 2023)
  • Prophecy can be perplexing (May 2023)
  • Technology comes in different shapes and sizes (June 2023)
  • AI and robots – what could possibly go wrong? (July 2023)
  • How long until we’re all out of work? (August 2023)
  • We both have truths, are mine the same as yours? (September 2023)
  • Holy Spheres, Batman! (October 2023)
  • Where’s my pneumatic car? (November 2023)
  • Good grief! (December 2023)
  • Cheeky chiplets (January 2024)
  • Cheeky chiplets (February 2024)
  • The Wibbly-Wobbly World of Quantum (March 2024)
  • Techno Talk - Wait! What? Really? (April 2024)
  • Techno Talk - One step closer to a dystopian abyss? (May 2024)
  • Techno Talk - Program that! (June 2024)
  • Techno Talk (July 2024)
  • Techno Talk - That makes so much sense! (August 2024)
  • Techno Talk - I don’t want to be a Norbert... (September 2024)
  • Techno Talk - Sticking the landing (October 2024)
  • Techno Talk (November 2024)
  • Techno Talk (December 2024)
  • Techno Talk (January 2025)
  • Techno Talk (February 2025)
  • Techno Talk (March 2025)
  • Techno Talk (April 2025)
  • Techno Talk (May 2025)
  • Techno Talk (June 2025)
By Charles Kosina Features and Specifications Usable frequency range: DC to 100MHz Input and output impedance: 50W Attenuation range: 0dB to −110dB in 1dB steps up to 2MHz; reduced maximum attenuation at higher frequencies (see Fig.2) Attenuation error: typically ≤0.5dB (see Fig.1) Power supply: 5V/100mA Fits in the same diecast case as the AM/FM Signal Generator from May 2023 0-110dB RF Attenuator for Signal Generators This RF Attenuator was designed to accompany my recently published AM/FM Signal Generator design (May 2023). However, you could combine it with just about any signal generator to provide easy output level adjustment over a wide range. W e often need a very low amplitude RF signal to test, align or adjust a radio. Unless you buy an expensive signal generator, the chances are that your generator’s output level is far too high for such a task. My recent AM/FM Signal Generator design has an output near 0dBm, which translates to about 220mV into a 50W load. To reduce this to 1µV RMS (eg, for testing a radio’s sensitivity), we need 107dB of attenuation. The simplest way to achieve this is to buy off-theshelf fixed attenuators. These are available from 1dB to 40dB and cost a few pounds each. They have SMA connectors on either end, and you screw them together to give the required attenuation. Variable digital attenuators are also available (reviewed by Practical Electronics last year, October and November 2022). These have a maximum attenuation of about 30dB and can be adjusted in small steps, eg, 1dB or 0.5dB. Combining one of these with a few fixed attenuators is one possible solution. 26 However, I decided to design my own attenuator as it is pretty straightforward; it’s basically just a string of fixed attenuators, each consisting of three resistors, selected in combinations using relays. This works fine at low frequencies – for example, below 2MHz – but once we get much higher than that, the signal will sneak through by various paths to make a 1µV output difficult to achieve. Practical Electronics | August | 2023 Parts List – 110dB RF Attenuator 1 double-sided plated-through PCB coded CSE211003, 76 x 95.5mm, available from the PE PCB Service. 1 diecast aluminium enclosure, 119 x 93.5 x 34mm [Jaycar HB5067 or Altronics H0454] 1 5V 100mA+ regulated DC power supply (eg, USB charger with adaptor cable) 1 0.96-inch OLED screen module with I2C interface and SSD1306 controller (OLED1) 1 mechanical rotary encoder with integrated pushbutton switch and 20mm total height (RE1) [eg, Bourns PEC11R-4215F-S0024] 10 EC2-5NU DPDT 5V coil relays (RLY1-RLY10) 1 10μH axial RF inductor (L1) 1 28-pin DIL IC socket (optional, for IC1) 1 PCB-mount DC barrel socket with 2.1mm or 2.5mm inner pin diameter (CON1) 1 2-pin, 2.54mm pitch-polarised header and matching plug with pins (CON2) 1 3-pin, 2.54mm pitch-polarised header (CON3) ● 2 SMA edge connectors (CON4, CON5) 2 2x3-pin header (CON6; optional, for programming IC1) 1 4-way female header socket (CON7; for OLED1) 1 large knob to suit EN1 4 12mm-long M3 tapped metal spacers Does this Attenuator achieve such a task? Yes and no. At 2MHz and below, the maximum attenuation is 110dB, but once we get to 75MHz, the attenuation is only 81dB. So for a 0dBm input, the lowest output level is 20µV RMS. However, adding one fixed 30dB attenuator to its output lets us get to 110dB and still gives quite a bit of adjustment range, so I consider that reasonably good. This is because, at higher frequencies, stray capacitance and inductance become more significant. In addition, circuit board tracks act as antennas and radiate energy that is picked up further downstream in the attenuator string. Professional signal generators with attenuators use extensive internal shielding to reduce such effects. For home-built equipment, this is somewhat impractical. That is why I did not build this Attenuator into my Signal Generator but rather in a separate diecast aluminium enclosure. There is far too much RF floating around in the signal generator, which would make it difficult to isolate the attenuator section. Fig.3 shows the attenuator circuit. The signal is fed in via CON4, then Fig.1: the attenuation settings are very accurate at low frequencies down to about 90dB, with a maximum error of only 1dB. The +0.5dB blip between 6dB and 8dB could be due to measurement error. Practical Electronics | August | 2023 2 10mm untapped spacers 4 M3 x 6mm panhead machine screws 4 M3 x 8mm countersunk head machine screws 2 M2 x 16mm or M2.5 x 16mm panhead machine screws and nuts (to match OLED mounting holes) 4 M3 flat washers Semiconductors 1 ATmega168 or ATmega328 8-bit microcontroller programmed with CSE211003.hex, DIP-28 (IC1) 1 LP2950-3.3 or similar 3.3V LDO regulator, TO-92 (REG1) 10 PMV15UNEA, PMV19XNEA or similar avalanche-rated N-channel MOSFETs, SOT-23 (Q1-10) [Mouser Cat 771-PMV15UNEAR or element14 Cat 3268027] 2 2N7000 N-channel MOSFETs, SOT-23 (Q11-Q12) ● Capacitors (SMD 0805 6.3V+ X7R ceramic unless stated) 1 10μF M3216/1206-size 1 1μF 4 100nF 3 10nF Resistors (all SMD M2012/0805 1% thick film) 2 820W 5 18kW 2 4.7kW 1 1kW ● 2 470W 2 270W 4 220W 2 180W 4 100W 2 68W 8 56W 1 33W 1 18W 1 12W 1 5.6W ● omit if the debugging interface is not needed passes through ten switched attenuator sections using DPDT relays (RLY1 to RLY10) before reaching output connector CON5. These sections attenuate by 1dB, 2dB, 3dB, 5dB, 10dB (twice) and 20dB (four instances). The ideal resistance values for these attenuators are not in the standard range, so I have chosen the closest standard values, which do result in slight inaccuracies. With a relay de-energised, the signal just passes through the normally-closed sets of contacts. If it is energised, the signal instead passes through the resistive attenuator section. Fig.2: the actual attenuation for a selected value of 110dB between 2MHz and 75MHz. As the signal frequency increases, parasitic capacitances on the circuit board result in more of the input signal leaking through to the output. 27 A rotary encoder is used to adjust the amount of attenuation required, in either 1dB or 5dB steps, toggled by pressing the encoder’s integral pushbutton switch. The firmware in the ATMega168 or ATMega328 microcontroller translates the attenuation to switch in the appropriate set of relays. For example, to select 35dB, relays 3, 6 and 7 would be energised. To prevent relays chattering while the shaft encoder is turned, there is a short delay after the number is selected before the appropriate relays are turned on and off. Each relay’s coil is switched using a small signal MOSFET. You might have noticed that there are no diodes to absorb the back-EMF of the relay coils at switch-off. This is a bit unusual, but it does cut back on the number of components. This only works if the MOSFETs are rugged enough to withstand the voltage spikes caused by the relay coil magnetic fields dissipating. See the section below on ‘Avalanche-rated MOSFETs’ for more details on this. As with my other designs, I have added a simplified RS-232 interface for debugging using MOSFETs Q11 and Q12. These may be omitted if you don’t plan to use that interface. The Attenuator is powered from a standard 5V DC mobile phone charger (or other USB power source). While this could be obtained from an Fig.3: the entire circuit of the 110dB Attenuator. The main section consists of 10 switched attenuators, each made from three resistors, one relay (RLY1-10) and one MOSFET (Q1-Q10) to drive the relay. The transistors are driven by microcontroller IC1, which also monitors the rotary encoder and pushbutton, and communicates with the OLED to show the current attenuation setting. 28 Practical Electronics | August | 2023 output socket on the Signal Generator, I decided to use a separate supply to reduce potential RF leakage. You will note that the photos show an additional DC socket. This is for powering an external amplifier that was used for measurement. Inductor L1 is in series with the incoming supply to further reduce any outside RF. This seems to be effective, as powering it from a battery of three AA cells made no measurable difference in readings. The same 0.96-inch SSD1306-based OLED screen is used to display the attenuation value as in the Signal Generator. A 3.3V regulator generates the OLED supply rail. The I2C interface requires pull-up resistors to +3.3V. As the SDA and SCL outputs on PC4 and PC5 of IC1 are open drain, there is no problem with the 5V-powered micro interfacing with the OLED. I chose NEC EC2-5NU relays. They are DPDT types with 5V-DC-rated coils. These are readily available and have good isolation. The measured capacitance between open contacts is 1pF, which does not sound like much. Still, the reactance at 75MHz is −j × 2122W, which is effectively in parallel with the 220W resistor in 0 – 100dB Digital Attenuator Practical Electronics | August | 2023 the 20dB sections, slightly reducing the attenuation. The measured attenuation tracks the set attenuation fairly closely at 2MHz and below, as shown in Fig.1. I took these readings with the tinySA spectrum analyser. The noise floor of the tinySA is about −90dBm, so I used a 30dB low-noise amplifier (LNA) to measure down to −110dBm. The measured value varied slightly on each pass, so I averaged several readings. Once the frequency gets above 2MHz, the accuracy drops off, and Fig.2 shows the maximum attenuation achievable up to 75MHz. To get a lower signal level at the higher frequencies, you will need to put a fixed 30dB attenuator on the unit’s output. Avalanche-rated MOSFETs Avalanche-rated MOSFETs (such as those specified in the parts list) must be used to ensure longevity. This is easy to check by searching the device data sheet for the avalanche energy rating (usually expressed in mJ). When a MOSFET’s drain-source rating voltage is exceeded, it can enter avalanche breakdown, similar to a zener diode. In this mode, the channel conducts current until the voltage drops. The problem with this is that a typical MOSFET is made of many (usually thousands of) cells, and there’s no guarantee that each cell will break down at the same voltage. That means the energy may pass through a very small proportion of the MOSFET area, causing intense local heating and possibly failure. Also, the avalanche current is not conducted through the normal channel but rather through a ‘parasitic bipolar transistor’ formed by two semiconductor junctions within the MOSFET. This also has the effect of concentrating the current into a smaller area than usual. Avalanche-rated MOSFETs solve this by two methods. First, they are designed and manufactured in such a way to minimise the variation in breakdown voltages between individual cells so that the current is spread out. Second, after being manufactured, they are tested by being forced into avalanche breakdown with a pulse of energy at least as high as specified in the data sheet. Any ‘weak’ devices that cannot handle this fail and are discarded. Only the survivors go on to be sold. We’ve calculated the energy pulse from the relay coils in this design at around 1mJ. The MOSFETs we have specified have single-pulse ratings of around 15mJ. They only need to handle one pulse every few seconds, so this should be well within their capabilities. 29 If substituting MOSFETs, opt for a minimum avalanche rating of 10mJ. For more information about this topic, see the excellent PDF from Infineon at: https://bit.ly/pe-aug23-inf Construction The unit is built into a standard aluminium diecast box, available from Jaycar and Altronics (the same one used for the recently-described AM/ FM Signal Generator). It’s best to prepare this before assembling the PCB. I sprayed mine black to improve its appearance. I printed the Attenuator’s label (Fig.4) on to photographic paper and added a 1.5mm-thick protective clear polycarbonate sheet on top – cut to the same size as the label. You can download this artwork from the August 2023 page of the PE website: https://bit.ly/pe-downloads Fig.4: the front panel label for the Attenuator. The number and size of cutouts have been minimised to prevent RF leakage into or out of the case. Fig.5: luckily, there aren’t too many holes that need to be cut in the diecast case. They can all be drilled, except for the rectangular hole for the OLED. There are various ways to make that; just be sure to do it slowly to avoid it becoming jagged or oversized. 30 The PCB attaches to the inside of the case using 12mm threaded spacers. If you can’t get these, use 10mm threaded spacers with an added nut to extend them to 12mm. I also sprayed the screws through the front panel black to improve the overall appearance. The required cutouts in the enclosure are shown in Fig.5. For best accuracy, locate the reference point in the bottom left and drill this to 3mm diameter. Then attach the blank PCB to use as a template. Square it up, drill the opposite corner and secure it with another screw. Now drill the other mounting holes. The encoder location on the PCB has a small hole in the centre on the PCB. Drill the panel through this using a 1.5mm-diameter drill bit, then drill holes in the case corresponding to the four OLED mounting holes to 2.5mm. Remove the PCB and enlarge the hole for the shaft encoder to 14mm diameter. It needs to be that large so that the PCB can be manoeuvred into position. Increase the size of the OLED mounting holes to 4mm and use the outside of these to mark the cutout needed. How you make the cutout depends on the equipment and skills that you have. Perhaps the simplest approach is to drill a series of reasonably small (say 3-4mm) holes around the inside of the perimeter. Join these with a file until the centre part drops out, then use a larger flat file to smooth the edges until they are straight and the hole is just large enough. Finally, drill two 7mm holes for the SMA connectors on the front and a hole for the DC connector on the back. There is not much room for this connector; it should be 7mm up from the bottom of the case. I also placed a small toggle switch next to the DC connector for the power, but that is optional. PCB assembly Most of the components mount on a double-sided PCB coded CSE211003 that measures 76 x 95.5mm and is available from the PE PCB Service. Fig.6 shows where the parts go. The resistors and capacitors are mostly SMD M2012/0805 or Practical Electronics | August | 2023 www.poscope.com/epe - USB - Ethernet - Web server - Modbus - CNC (Mach3/4) - IO Fig.6: the resistors, capacitors and MOSFETs all come in SMD packages but are pretty easy to solder. The micro, regulator, relays, headers and rotary encoder are through-hole parts. Fit all the SMDs first, then the through-hole parts from lowest profile to tallest, with the edge connectors last. Be careful to orient the microcontroller and regulator as shown. M3216/1206 size, while the transistors are in SOT-23 packages. Solder all the SMDs first, followed by the throughhole components, then the SMA connectors, and the rotary encoder last. There are options for other 3.3V regulators if the LP2950-3.3 regulator is not available. Some have different pinouts, so check this if substituting. If your replacement regulator has a reversed pinout, you can mount it on the opposite side of the board. The OLED screen plugs into a 4-pin socket strip. Although four mounting holes are provided, attaching it with two screws and two 10mm spacers is adequate. The holes in the OLED may be either 2mm or 2.5mm, so use either Practical Electronics | August | 2023 M2 x 16mm or M2.5 x 16mm machine screws and nuts. Using it It’s about as easy as it gets. Simply power the unit up, use the rotary encoder to dial in the amount of attenuation required while checking the screen display, then ensure your input and output cables are connected to the correct sockets. Remember that pushing down on the rotary encoder knob switches between adjustment steps of 1dB and 5dB. Reproduced by arrangement with SILICON CHIP magazine 2023. www.siliconchip.com.au - PWM - Encoders - LCD - Analog inputs - Compact PLC - up to 256 - up to 32 microsteps microsteps - 50 V / 6 A - 30 V / 2.5 A - USB configuration - Isolated PoScope Mega1+ PoScope Mega50 - up to 50MS/s - resolution up to 12bit - Lowest power consumption - Smallest and lightest - 7 in 1: Oscilloscope, FFT, X/Y, Recorder, Logic Analyzer, Protocol decoder, Signal generator 31