Silicon ChipEl Cheapo Modules 17: 4GHz digital attenuator - June 2018 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: I, for one, welcome our new farm robot overlords
  4. Feature: AgBots – robots working on the farm of tomorrow! by Dr David Maddison
  5. Project: The USB Flexitimer: accurately timed switching by John Clarke and Nicholas Vinen
  6. Project: Wide-range digital LC Meter by Tim Blythman
  7. PartShop
  8. Project: Switch on or off anything with a Temperature Switch by John Clarke
  9. Subscriptions
  10. Serviceman's Log: Repairing ‘proper’ stereo gear is satisfying by Dave Thompson
  11. Project: 800W (+) Uninterruptible Power Supply (UPS) Part II by Duraid Madina and Tim Blythman
  12. Review: Degen’s wind-up or solar-powered AM/FM/SW radio by Ross Tester
  13. Feature: El Cheapo Modules 17: 4GHz digital attenuator by Jim Rowe
  14. PartShop
  15. Vintage Radio: 1952 Astor GP/PS Hybrid Portable by Associate Professor Graham Parslow
  16. Product Showcase
  17. Market Centre
  18. Advertising Index
  19. Notes & Errata: 6GHz+ Touchscreen Frequency Counter / 800W+ Uninterruptible Power Supply / Deluxe Frequency Switch / USB Port Protector
  20. Outer Back Cover

This is only a preview of the June 2018 issue of Silicon Chip.

You can view 38 of the 104 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Articles in this series:
  • AgBots – robots working on the farm of tomorrow! (June 2018)
  • AgBots – robots working on the farm of tomorrow! (June 2018)
  • The farm of the future . . . Part II (July 2018)
  • The farm of the future . . . Part II (July 2018)
Items relevant to "The USB Flexitimer: accurately timed switching":
  • USB Flexitimer PCB [19106181] (AUD $7.50)
  • PIC16F1455-I/P programmed for the USB Flexitimer [1910618A.HEX] (Programmed Microcontroller, AUD $10.00)
  • Firmware (C and HEX) files for the USB Flexitimer [1910618A.HEX] (Software, Free)
  • USB Flexitimer PCB pattern (PDF download) [19106181] (Free)
Items relevant to "Wide-range digital LC Meter":
  • Wide-range digital LC Meter PCB with stackable headers [04106181] (AUD $7.50)
  • Wide-range digital LC Meter PCB [04106181] (AUD $5.00)
  • Pair of PCB-mounting right-angle banana sockets (red/black) (Component, AUD $6.00)
  • 1nF ±1% polypropylene (MKP) or C0G/NP0 ceramic capacitor (Component, AUD $2.50)
  • 20x4 Alphanumeric serial (I²C) LCD module with blue backlight (Component, AUD $15.00)
  • Case pieces for the Wide-range Digital LC Meter (PCB, AUD $7.50)
  • Arduino Sketch (.ino) and libraries for the Wide-Range Digital LC Meter (Software, Free)
  • Wide-range digital LC Meter PCB pattern (PDF download) [04106181] (Free)
Items relevant to "Switch on or off anything with a Temperature Switch":
  • Temperature Switch Mk2 PCB [05105181] (AUD $7.50)
  • PIC12F617-I/P programmed for the Temperature Switch Mk2 [0510518A.HEX] (Programmed Microcontroller, AUD $10.00)
  • Firmware (ASM and HEX) files for the Temperature Switch Mk2 [0510518A.HEX] (Software, Free)
  • Temperature Switch Mk2 PCB pattern (PDF download) [05105181] (Free)
Items relevant to "800W (+) Uninterruptible Power Supply (UPS) Part II":
  • 800W+ Uninterruptible Power Supply control shield PCB [11106181] (AUD $5.00)
  • Arduino Sketches (.ino) and library for the 800W+ Uninterruptable Power Supply (Software, Free)
  • 800W+ Uninterruptible Power Supply control shield PCB pattern (PDF download) [11106181] (Free)
  • 800W+ Uninterruptible Power Supply front panel artwork (PDF download) (Free)
Articles in this series:
  • 800W (+) Uninterruptible Power Supply (UPS) (May 2018)
  • 800W (+) Uninterruptible Power Supply (UPS) (May 2018)
  • 800W (+) Uninterruptible Power Supply (UPS) Part II (June 2018)
  • 800W (+) Uninterruptible Power Supply (UPS) Part II (June 2018)
  • 800W (+) Uninterruptible Power Supply (UPS) Part III (July 2018)
  • 800W (+) Uninterruptible Power Supply (UPS) Part III (July 2018)
Articles in this series:
  • El Cheapo Modules From Asia - Part 1 (October 2016)
  • El Cheapo Modules From Asia - Part 1 (October 2016)
  • El Cheapo Modules From Asia - Part 2 (December 2016)
  • El Cheapo Modules From Asia - Part 2 (December 2016)
  • El Cheapo Modules From Asia - Part 3 (January 2017)
  • El Cheapo Modules From Asia - Part 3 (January 2017)
  • El Cheapo Modules from Asia - Part 4 (February 2017)
  • El Cheapo Modules from Asia - Part 4 (February 2017)
  • El Cheapo Modules, Part 5: LCD module with I²C (March 2017)
  • El Cheapo Modules, Part 5: LCD module with I²C (March 2017)
  • El Cheapo Modules, Part 6: Direct Digital Synthesiser (April 2017)
  • El Cheapo Modules, Part 6: Direct Digital Synthesiser (April 2017)
  • El Cheapo Modules, Part 7: LED Matrix displays (June 2017)
  • El Cheapo Modules, Part 7: LED Matrix displays (June 2017)
  • El Cheapo Modules: Li-ion & LiPo Chargers (August 2017)
  • El Cheapo Modules: Li-ion & LiPo Chargers (August 2017)
  • El Cheapo modules Part 9: AD9850 DDS module (September 2017)
  • El Cheapo modules Part 9: AD9850 DDS module (September 2017)
  • El Cheapo Modules Part 10: GPS receivers (October 2017)
  • El Cheapo Modules Part 10: GPS receivers (October 2017)
  • El Cheapo Modules 11: Pressure/Temperature Sensors (December 2017)
  • El Cheapo Modules 11: Pressure/Temperature Sensors (December 2017)
  • El Cheapo Modules 12: 2.4GHz Wireless Data Modules (January 2018)
  • El Cheapo Modules 12: 2.4GHz Wireless Data Modules (January 2018)
  • El Cheapo Modules 13: sensing motion and moisture (February 2018)
  • El Cheapo Modules 13: sensing motion and moisture (February 2018)
  • El Cheapo Modules 14: Logarithmic RF Detector (March 2018)
  • El Cheapo Modules 14: Logarithmic RF Detector (March 2018)
  • El Cheapo Modules 16: 35-4400MHz frequency generator (May 2018)
  • El Cheapo Modules 16: 35-4400MHz frequency generator (May 2018)
  • El Cheapo Modules 17: 4GHz digital attenuator (June 2018)
  • El Cheapo Modules 17: 4GHz digital attenuator (June 2018)
  • El Cheapo: 500MHz frequency counter and preamp (July 2018)
  • El Cheapo: 500MHz frequency counter and preamp (July 2018)
  • El Cheapo modules Part 19 – Arduino NFC Shield (September 2018)
  • El Cheapo modules Part 19 – Arduino NFC Shield (September 2018)
  • El cheapo modules, part 20: two tiny compass modules (November 2018)
  • El cheapo modules, part 20: two tiny compass modules (November 2018)
  • El cheapo modules, part 21: stamp-sized audio player (December 2018)
  • El cheapo modules, part 21: stamp-sized audio player (December 2018)
  • El Cheapo Modules 22: Stepper Motor Drivers (February 2019)
  • El Cheapo Modules 22: Stepper Motor Drivers (February 2019)
  • El Cheapo Modules 23: Galvanic Skin Response (March 2019)
  • El Cheapo Modules 23: Galvanic Skin Response (March 2019)
  • El Cheapo Modules: Class D amplifier modules (May 2019)
  • El Cheapo Modules: Class D amplifier modules (May 2019)
  • El Cheapo Modules: Long Range (LoRa) Transceivers (June 2019)
  • El Cheapo Modules: Long Range (LoRa) Transceivers (June 2019)
  • El Cheapo Modules: AD584 Precision Voltage References (July 2019)
  • El Cheapo Modules: AD584 Precision Voltage References (July 2019)
  • Three I-O Expanders to give you more control! (November 2019)
  • Three I-O Expanders to give you more control! (November 2019)
  • El Cheapo modules: “Intelligent” 8x8 RGB LED Matrix (January 2020)
  • El Cheapo modules: “Intelligent” 8x8 RGB LED Matrix (January 2020)
  • El Cheapo modules: 8-channel USB Logic Analyser (February 2020)
  • El Cheapo modules: 8-channel USB Logic Analyser (February 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules (May 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules (May 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules, Part 2 (June 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules, Part 2 (June 2020)
  • El Cheapo Modules: Mini Digital Volt/Amp Panel Meters (December 2020)
  • El Cheapo Modules: Mini Digital Volt/Amp Panel Meters (December 2020)
  • El Cheapo Modules: Mini Digital AC Panel Meters (January 2021)
  • El Cheapo Modules: Mini Digital AC Panel Meters (January 2021)
  • El Cheapo Modules: LCR-T4 Digital Multi-Tester (February 2021)
  • El Cheapo Modules: LCR-T4 Digital Multi-Tester (February 2021)
  • El Cheapo Modules: USB-PD chargers (July 2021)
  • El Cheapo Modules: USB-PD chargers (July 2021)
  • El Cheapo Modules: USB-PD Triggers (August 2021)
  • El Cheapo Modules: USB-PD Triggers (August 2021)
  • El Cheapo Modules: 3.8GHz Digital Attenuator (October 2021)
  • El Cheapo Modules: 3.8GHz Digital Attenuator (October 2021)
  • El Cheapo Modules: 6GHz Digital Attenuator (November 2021)
  • El Cheapo Modules: 6GHz Digital Attenuator (November 2021)
  • El Cheapo Modules: 35MHz-4.4GHz Signal Generator (December 2021)
  • El Cheapo Modules: 35MHz-4.4GHz Signal Generator (December 2021)
  • El Cheapo Modules: LTDZ Spectrum Analyser (January 2022)
  • El Cheapo Modules: LTDZ Spectrum Analyser (January 2022)
  • Low-noise HF-UHF Amplifiers (February 2022)
  • Low-noise HF-UHF Amplifiers (February 2022)
  • A Gesture Recognition Module (March 2022)
  • A Gesture Recognition Module (March 2022)
  • Air Quality Sensors (May 2022)
  • Air Quality Sensors (May 2022)
  • MOS Air Quality Sensors (June 2022)
  • MOS Air Quality Sensors (June 2022)
  • PAS CO2 Air Quality Sensor (July 2022)
  • PAS CO2 Air Quality Sensor (July 2022)
  • Particulate Matter (PM) Sensors (November 2022)
  • Particulate Matter (PM) Sensors (November 2022)
  • Heart Rate Sensor Module (February 2023)
  • Heart Rate Sensor Module (February 2023)
  • UVM-30A UV Light Sensor (May 2023)
  • UVM-30A UV Light Sensor (May 2023)
  • VL6180X Rangefinding Module (July 2023)
  • VL6180X Rangefinding Module (July 2023)
  • pH Meter Module (September 2023)
  • pH Meter Module (September 2023)
  • 1.3in Monochrome OLED Display (October 2023)
  • 1.3in Monochrome OLED Display (October 2023)
  • 16-bit precision 4-input ADC (November 2023)
  • 16-bit precision 4-input ADC (November 2023)
  • 1-24V USB Power Supply (October 2024)
  • 1-24V USB Power Supply (October 2024)
  • 14-segment, 4-digit LED Display Modules (November 2024)
  • 0.91-inch OLED Screen (November 2024)
  • 0.91-inch OLED Screen (November 2024)
  • 14-segment, 4-digit LED Display Modules (November 2024)
  • The Quason VL6180X laser rangefinder module (January 2025)
  • TCS230 Colour Sensor (January 2025)
  • The Quason VL6180X laser rangefinder module (January 2025)
  • TCS230 Colour Sensor (January 2025)
  • Using Electronic Modules: 1-24V Adjustable USB Power Supply (February 2025)
  • Using Electronic Modules: 1-24V Adjustable USB Power Supply (February 2025)

Purchase a printed copy of this issue for $10.00.

Using Cheap Asian Electronic Modules Part 17: by Jim Rowe A 4GHz digital attenuator module This highly linear 4GHz digital attenuator is programmable over a range of 0-31.5dB in 0.5dB steps. This sort of attenuator is important in reducing signal levels in a circuit, to avoid overload in a mixer or amplifier. It could also be the basis of a precision full range attenuator in an RF signal generator. T his digitally programmed step attenuator module (available from Banggood, siliconchip.com.au/link/ aaiy) has six internal cascaded attenuators which can be switched in or out independently, to provide an overall attenuation range of 0dB to -31.5dB in 0.5dB steps. The operating frequency range of the module is from about 1MHz up to 4GHz. The module’s PCB is just 33 x 24.5mm in size and RF input and the output SMA connectors are edgemounted on each end of the PCB while there are power and programming inputs on the sides. It uses a PE4302 IC in a 20-lead QFN (SMD) package measuring 4 x 4mm, from the San Diego-based (California) company Peregrine Semiconductor. Their website (www.psemi.com) shows that they’re part of the Murata group and that they make a wide range of RF ICs based on their patented “UltraCMOS” process. This is an advanced form of silicon on insulator (SOI) technology. It now appears that the PE4302 is obsolete, having been replaced by the improved PE4312. It is still available though, is significantly lower in price than the PE4312 and gives acceptable performance for non-critical applications. Banggood sell the module for just $11.00, but you can also purchase it on eBay or AliExpress. Fig.1 is the block diagram of the PE4302. The six stages of the RF step attenuator are along the top, together Fig.1: block diagram of the PE4302 attenuator IC. It has six attenuation stages which can be switched in or out by matching DPDT analog switches. Serial and parallel control inputs are both provided by the IC but the serial inputs are disabled on the PE4302 module. 80 Silicon Chip Celebrating 30 Years with the DPDT analog switches which allow each stage to be switched in or out of the signal path between the RFin pin at upper left and the RFout pin at upper right. The switches for each stage are driven by the Control Logic Interface shown in the lower part of the diagram. The first attenuation stage reduces the signal amplitude by 16dB while later stages reduce it by 8dB, 4dB, 2dB, 1dB and 0.5dB respectively. Since these figures are all powers of 2, this allows the chip to be programmed in binary fashion to provide any desired nominal level of attenuation between 0dB and -31.5dB. In practice, the chip has an insertion loss even at the 0dB setting (with all stages switched out). Typically this insertion loss varies between -1dB and -1.5dB at frequencies below 2.5GHz, increasing to about -3.5dB at 4.0GHz. Oddly, this only seems to apply when there is no attenuation requested. As a result, the attenuation at a setting of -0.5dB is actually considerably lower than at 0dB for all the frequencies we tested! The control logic interface provides parallel control inputs (along the bottom) and serial control inputs (centre left). That actually gives the PE4302 three different ways of setting the attenuation level. Setting attenuation The first way of setting attenuation level is via direct parallel programming, where you apply logic-level siliconchip.com.au signals directly to the C16-C0.5 inputs with a microcontroller or a set of DIP switches. The second mode is latched parallel programming, where the control signals are still applied to the C16-C0.5 input pins but the LE (load enable) pin must be pulsed low when they are changed because the control signals are stored in a latch register when the LE pin is returned to logic high. The third mode is serial programming, where the six programming bits are fed into the chip via the CMOScompatible DATA and CLK serial interface pins, with the LE pin then pulsed high and low to store the bits in the latch. If the P/S pin is pulled high, the chip powers up in serial programming mode; otherwise, it powers up in parallel mode. When parallel mode is enabled, the PUP1 and PUP2 pins at lower left in Fig.1, together with the LE pin at centre left, are used to determine the chip’s control settings when it is powered up. By varying the logic levels on these pins you can ensure that the chip powers up at 0dB attenuation (insertion loss only), 8dB, 16dB or 31dB, or whatever attenuation is programmed by pins C16-C0.5. Fig.2 shows the complete circuit of the step attenuator module and it is set in direct parallel programming mode. This has the LE pin (5) tied to the positive supply rail while the P/S, PUP1 and PUP2 pins (13, 7 & 8) are all tied to ground, along with the DATA (3) and CLK (4) serial interface pins. The RF input connector is coupled to pin 2 of IC1 via a 100nF capacitor, while the output is taken from pin 14 to the RF output connector via another 100nF capacitor. The parallel programming pins C8 (15), C4 (16), C2 (17), C1 (19) and C0.5 Fig.2: the PE4302 module has the serial inputs pins 3, 4 & 5 tied high and the parallel inputs pulled low. It would not be easy to change this, if you wanted to use serial mode instead of parallel programming. (20) are each connected to pins V5-V1 on the 7-way SIL programming connector CON1 as well as being pulled to ground (logic low level) via 10kW resistors. The C16 (1) programming pin is connected in a similar fashion to pin V6 of CON1, although not directly but via a series 10kW resistor. This is in line with Peregrine’s recommendation, to prevent resonance effects within the chip due to the proximity of this pin to the RFin pin (2). Putting it to use The simplest way to control this module is to use a 6-pole DIP switch, as shown in Fig.3. One side of each switch is connected to the +3.3V supply line so that when each switch is closed, the respective pin of CON1 will be pulled high. The truth table to the right of Fig.3 shows some examples of the switch combinations and the resulting nominal attenuation settings. You could use a similar approach to control the module directly from a micro, like an Arduino or a Micromite. In this case, you’d power the module from the +3.3V and GND pins of the micro and connect programming pins V1-V6 to six spare digital I/O pins on the micro. Then it would be a matter of writing a program to control the attenuator module via these six pins. The difficulty with this approach is that you may not have six spare I/O pins available. Unfortunately, as noted, the module is hard-wired for parallel programming, with the serial interface effectively disabled. Fig.3: manual programming can be done with a 6-pole DIP switch attached to the PE4302 module. The table below shows some of the switch combinations and the resultant attenuation settings. siliconchip.com.au Celebrating 30 Years June 2018  81 Fig.4: wiring diagram for the PE4302 module connected to a serial I2C “piggyback” module (IC1) via a hex non-inverting buffer (IC2). At bottom right is the format of the byte to be sent from the micro to the PE4302 to activate each attenuator. Ergo, 01110110 (big-endian) activates C1, 2, 4, 8 & 16 (but not C0.5). 82 Silicon Chip Celebrating 30 Years Luckily, there is a way to work around this so you can control the module from your micro via a standard I2C serial interface. That’s by making use of one of the very low cost piggyback serial interface modules, based on either the PCF8574T chip or its sibling, the PCF8574AT. These modules are intended to adapt a parallel-interface LCD module for serial interfacing and they often come mated with an LCD. But they are also available separately for less than $2 each and this makes them very attractive for solving other I2C/parallel interfacing jobs like this one. Fig.4 shows how to use one of these PCF8574T/AT modules to connect up the PE4302 digital step attenuator module to your micro for serial control via the I2C bus. The upper part of the diagram shows the circuitry inside the piggyback module, while the PE4302 module is shown at lower right, with the interconnections all made via the 16-pin header which usually connects to the LCD module. The six programming lines pass through IC2, a 74HC367 hex non-inverting buffer. This is needed because the outputs from IC1 can only provide very low current in their high logic state but the V1-V6 inputs of the step attenuator module are all fitted with 10kW pulldown resistors. This means that they tend to draw more current than the outputs of IC1 can provide. Alternatively, you could leave out the 74HC367 and simply remove the six pull-down resistors from the underside of the module. Notice that we’ve also shown a table at lower left in Fig.4 with the various I2C addresses applying to the piggyback module, depending on (a) whether it’s using a PCF8574T chip or a PCF8574AT chip, and (b) whether any of the onboard links A0, A1 or A2 are shorted. If you’re in any doubt regarding which of the two chips is fitted to your module, this can usually be clarified quite easily by examining the top of the chip with a magnifying glass. Note that because the PE4302 chip must be connected to a 3.3V supply, this also means that pin 3 of CON1 on the piggyback module should be connected to +3.3V rather than the usually expected +5V. siliconchip.com.au This won’t be a problem for the piggyback module because both versions of the PCF8574T/AT are designed to work from any supply voltage between 2.5V and 6V. As shown in Fig.4, you connect pins V1-V3 of the attenuator module to pins 4-6 on the piggyback module (via IC2), while pins V4-V6 are connected to pins 11-13. As a result, to program the attenuator correctly you simply need to send it the six control bits embedded in a single byte as shown at bottom right. Note that bits B3 and B7 are not used and can be left at either zero or one. Performance testing I measured the performance of the digital step attenuator with my VHF/ UHF signal generator and power meter. Because of the larger number of possible attenuation factors, this inevitably took rather long, even though I elected to do measurements for only 12 of the 64 combinations of programming bits. But I did take measurements at eight different frequencies, at 100MHz, 1.0GHz, 1.5GHz, 2.0GHz, 2.5GHz, 3.0GHz, 3.5GHz and 4.0GHz. Note that the measurements were taken at nominal attenuation factors of 0dB (ie, insertion loss only), -0.5dB, -1.0dB, -2.0dB, -4.0dB, -8.0dB, -16.0dB, -20.0dB, -24.0dB, -28.0dB, -30.0dB and -31.5dB. These were chosen to give a good idea of the module’s overall performance. The results are quite close to the nominal values shown in the left-hand column of Table 1. For example, the measured value for a nominal attenuation factor of -16.0dB at 1.5GHz turns out to be -16.06dB; pretty darn close. Similarly, the measurement at 3.5GHz for a nominal attenuation of -8dB proved to be -7.95dB. Again, not far off. Overall, the performance is quite good, at least for frequencies up to about 1.5GHz but at higher frequencies, the relative accuracy does seem to deteriorate somewhat. I suspect that there are two reasons for this, one being that the open construction of the module probably allows some of the RF input signal to “jump over” the PE4302 chip package, especially at frequencies of 2.0GHz and above (ie, due to stray capacitance). The other likely reason is that the input and output impedances of the PE4302 almost certainly vary from 50W at these higher frequencies, causing standing waves in the cables. In fact, the Peregrine Semiconductor data sheet shows both the input and output return loss plots varying quite widely over the full frequency range. Both rise significantly at higher frequencies. There’s probably not much that can be done about the cable matching/ standing waves problem since it’s inherent in the chip itself. Not content with that, I decided to try improving the overall attenuation accuracy at the higher frequencies by fitting an earthed metal shield over the PE4302 chip and its input and output coupling capacitors. The shield measured 33 x 7 x 2.5mm and was soldered at each end to the earthed outer frame of the SMA connectors. Table 2 shows the modest improvements after the shield was fitted so it is probably a worthwhile exercise for very little effort. SC The PE4302 module, shown enlarged for clarity. Without and with the earthed metal shield. siliconchip.com.au Celebrating 30 Years June 2018  83