Silicon ChipSilicon Labs-based FM/AM/SW Digital Radio - July 2021 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Software: too many bugs, too many updates
  4. Feature: The 2020 mission to Mars by Dr David Maddison
  5. Project: 20A DC Motor Speed Controller by John Clarke
  6. Feature: How USB Power Delivery (USB-PD) works by Andrew Levido
  7. Feature: El Cheapo Modules: USB-PD chargers by Jim Rowe
  8. Project: Model Railway Level Crossing by Les Kerr
  9. Project: Silicon Labs-based FM/AM/SW Digital Radio by Charles Kosina
  10. Review: Tecsun PL-990 radio receiver by Ross Tester
  11. Project: Advanced GPS Computer – Part 2 by Tim Blythman
  12. Serviceman's Log: I’ve repaired planes before, but never tanks by Dave Thompson
  13. Vintage Radio: The Rowe AMI JAL-200 jukebox by Jim Greig
  14. PartShop
  15. Product Showcase
  16. Market Centre
  17. Advertising Index
  18. Notes & Errata: Advanced GPS Computer, June 2021; Mini Arcade Pong, June 2021; Refined Full-Wave Motor Speed Controller, April 2021; USB Flexitimer, June 2018
  19. Outer Back Cover

This is only a preview of the July 2021 issue of Silicon Chip.

You can view 41 of the 112 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.

Items relevant to "20A DC Motor Speed Controller":
  • 20A DC Motor Speed Controller PCB [11006211] (AUD $7.50)
  • PIC16F1459-I/P programmed for the 20A DC Motor Speed Controller [1100621A.HEX] (Programmed Microcontroller, AUD $10.00)
  • Firmware and source code for the 20A DC Motor Speed Controller [1100621A] (Software, Free)
  • 20A DC Motor Speed Controller PCB pattern (PDF download) [11006211] (Free)
Articles in this series:
  • The History of USB (June 2021)
  • How USB Power Delivery (USB-PD) works (July 2021)
Articles in this series:
  • El Cheapo Modules From Asia - Part 1 (October 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 4 (February 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 7: LED Matrix displays (June 2017)
  • El Cheapo Modules: Li-ion & LiPo Chargers (August 2017)
  • El Cheapo modules Part 9: AD9850 DDS module (September 2017)
  • El Cheapo Modules Part 10: GPS receivers (October 2017)
  • El Cheapo Modules 11: Pressure/Temperature Sensors (December 2017)
  • El Cheapo Modules 12: 2.4GHz Wireless Data Modules (January 2018)
  • El Cheapo Modules 13: sensing motion and moisture (February 2018)
  • El Cheapo Modules 14: Logarithmic RF Detector (March 2018)
  • El Cheapo Modules 16: 35-4400MHz frequency generator (May 2018)
  • El Cheapo Modules 17: 4GHz digital attenuator (June 2018)
  • El Cheapo: 500MHz frequency counter and preamp (July 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 21: stamp-sized audio player (December 2018)
  • El Cheapo Modules 22: Stepper Motor Drivers (February 2019)
  • El Cheapo Modules 23: Galvanic Skin Response (March 2019)
  • El Cheapo Modules: Class D amplifier modules (May 2019)
  • El Cheapo Modules: Long Range (LoRa) Transceivers (June 2019)
  • El Cheapo Modules: AD584 Precision Voltage References (July 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: 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, Part 2 (June 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: LCR-T4 Digital Multi-Tester (February 2021)
  • El Cheapo Modules: USB-PD chargers (July 2021)
  • El Cheapo Modules: USB-PD Triggers (August 2021)
  • El Cheapo Modules: 3.8GHz Digital Attenuator (October 2021)
  • El Cheapo Modules: 6GHz Digital Attenuator (November 2021)
  • El Cheapo Modules: 35MHz-4.4GHz Signal Generator (December 2021)
  • El Cheapo Modules: LTDZ Spectrum Analyser (January 2022)
  • Low-noise HF-UHF Amplifiers (February 2022)
  • A Gesture Recognition Module (March 2022)
  • Air Quality Sensors (May 2022)
  • MOS Air Quality Sensors (June 2022)
  • PAS CO2 Air Quality Sensor (July 2022)
  • Particulate Matter (PM) Sensors (November 2022)
  • Heart Rate Sensor Module (February 2023)
  • UVM-30A UV Light Sensor (May 2023)
  • VL6180X Rangefinding Module (July 2023)
  • pH Meter Module (September 2023)
  • 1.3in Monochrome OLED Display (October 2023)
  • 16-bit precision 4-input ADC (November 2023)
  • 1-24V USB Power Supply (October 2024)
  • 14-segment, 4-digit LED Display Modules (November 2024)
  • 0.91-inch OLED Screen (November 2024)
  • The Quason VL6180X laser rangefinder module (January 2025)
  • TCS230 Colour Sensor (January 2025)
  • Using Electronic Modules: 1-24V Adjustable USB Power Supply (February 2025)
Items relevant to "Model Railway Level Crossing":
  • Model Railway Level Crossing PCB [09108211] (AUD $5.00)
  • Pair of PIC12F617-I/P chips for the Model Railway Level Crossing [0910821A/B/C.HEX] (Programmed Microcontroller, AUD $15.00)
  • ISD1820-based voice recording and playback module (Component, AUD $7.50)
  • Firmware, source code and sound recording for the Model Railway Level Crossing [0910211A-C] (Software, Free)
  • Model Railway Level Crossing PCB pattern (PDF download) [09108211] (Free)
  • Mechanical diagrams and label artwork for the Railway Level Crossing (PDF Download) (Panel Artwork, Free)
Items relevant to "Silicon Labs-based FM/AM/SW Digital Radio":
  • SiLabs FM/AM/SW Digital Radio PCB [CSE210301C] (AUD $7.50)
  • ATmega328P programmed with the firmware for the SiLabs FM/AM/SW Digital Radio [CSE210301.HEX] (Programmed Microcontroller, AUD $10.00)
  • Pulse-type rotary encoder with pushbutton and 18t spline shaft (Component, AUD $3.00)
  • Si4732-A10 AM/FM/SW/LW/RDS Radio Receiver IC (Component, AUD $20.00)
  • Firmware and source code for the SiLabe FM-AM-SW Digital Radio [CSE210301.HEX] (Software, Free)
  • SiLabs FM/AM/SW Digital Radio PCB pattern (PDF download) [CSE210301C] (Free)
  • Drilling/cutting diagrams and front panel artwork for the SiLabs-based FM-AM-SW Digital Radio (Free)
Items relevant to "Advanced GPS Computer – Part 2":
  • Advanced GPS Computer PCB [05102211] (AUD $7.50)
  • PIC32MX170F256B-50I/SP programmed for the Advanced GPS Computer [0510221A.hex] (Programmed Microcontroller, AUD $15.00)
  • DS3231 real-time clock IC (SOIC-16) (Component, AUD $7.50)
  • VK2828U7G5LF TTL GPS/GLONASS/GALILEO module with antenna and cable (Component, AUD $25.00)
  • MCP4251-502E/P dual 5kΩ digital potentiometer (Component, AUD $3.00)
  • Micromite LCD BackPack V3 complete kit (Component, AUD $75.00)
  • Matte/Gloss Black UB3 Lid for Advanced GPS Computer (BackPack V3) or Pico BackPack (PCB, AUD $5.00)
  • Firmware for the Advanced GPS Computer [0510221A.HEX] (Software, Free)
  • Advanced GPS Computer PCB pattern (PDF download) [05102211] (Free)
  • Advanced GPS Computer box cutting diagram and lid dimensions (Panel Artwork, Free)
Articles in this series:
  • Advanced GPS Computer - Part 1 (June 2021)
  • Advanced GPS Computer – Part 2 (July 2021)

Purchase a printed copy of this issue for $10.00.

Single-Chip Silicon Labs FM/AM/SW Digital Radio Receiver By Charles Kosina The ultimate in FM/AM radio reception technology is the single-chip solution. All you have to do is connect some antennas to pins on an IC, send it some serial commands, and stereo audio comes out the other end. As a result, these Silicon Labs chips make building a capable radio receiver a doddle. It’s straightforward to set up and use, fits in a compact case and runs from a simple AC plugpack. I was fairly pleased with my AM/ FM/SW Receiver design from the January 2021 issue (siliconchip.com. au/Article/14704), at least in terms of how easy it is to build, ease of use, and coverage of multiple radio bands. But I still felt that its overall performance left a little to be desired. I was also not happy that I didn’t have enough information for full digital control of the BK1198 radio chip. While that radio design was relatively straightforward as radios go, it would have been a lot simpler if I could have gotten the digital control working. In the last few years, several new chips have appeared that greatly ease radio receiver design. Many of these are from Silicon Labs; there are about 34 varieties of chips in the Si473x family, and you can download the main data sheet from siliconchip.com.au/ link/ab7y They have a similar architecture to the BK1198 chip I used for the January 2021 design. One major advantage of the Silicon Labs chips is the documentation; whereas information on the BK1198 is sparse, to say the least, the application note for the SiLabs chips 64 Silicon Chip runs to 321 pages! (See siliconchip. com.au/link/ab7z). The board that I have laid out is suitable for a prebuilt module with the Si4730 chip, or a standalone Si4732 chip. Both are available on AliExpress at quite low prices. The Si4730 only handles the standard AM and FM bands, whereas the Si4732 can be programmed to cover longwave and shortwave. Both can decode FM stereo. The specifications give the following bands: Worldwide FM band support: 64– 108MHz Worldwide AM band support: 520– 1710kHz SW band support (Si4734/32/35): 2.3–26.1MHz LW band support (Si4734/32/35): 153–279kHz But what about the gaps between the Fig.1: the radio’s sensitivity across a widened AM band, from 153kHz to 1.7MHz. Except for a dip around 445-455kHz (typical intermediate frequencies), the result is pretty flat. Across the standard AM broadcast band of 550-1720kHz, there is only about 4dB variation. Australia’s electronics magazine siliconchip.com.au These two photos show that the topside of the PCB for the Si4730-based version (top) of this project is barely different from the Si4732 version (bottom). Ignore the additional screws/nuts as those are just for mounting the screen. bands? I decided to experiment and set frequencies in these gaps. And what a surprise; with the Si4732 chip, I could select any frequency from 153kHz up to 30MHz by sending the appropriate code to the chip. No gaps! Whether there is anything of interest in the gaps is another matter. As a result, I have the AM band programmed from 153kHz to 1730kHz, and the SW band from 2MHz to 30MHz. Performance On the FM band, a short piece of wire inside the box will bring in most of the Melbourne stations with a good SNR. With an outdoor long wire antenna connected directly to the AM antenna input, I could get many stations with an SNR of 25dB or better without any ferrite rod. This way, there is not a single inductor required in the circuit! Using a ferrite rod, the weaker Fig.2: a similar ‘frequency response’ plot for the SW range from 2MHz to 22.3MHz. siliconchip.com.au Australia’s electronics magazine stations came through, but there was a lot of hash caused by all the electronics in my lab. I made a plot of sensitivity on the AM band from 153kHz to 1700kHz, shown in Fig.1. Note the sharp dip at 450kHz. I have no idea why this is, but it is near the intermediate frequency of most superhet receivers, so it is of no consequence. On shortwave, the sensitivity is comparable to the AM band (see Fig.2). This is not brilliant, but adequate. There were a few ‘birdies’ on some frequencies, eg, 8MHz, 14MHz and 16MHz, which made SNR measurement difficult. Above 22MHz, the SNR display did not seem to give sensible readings, although performance up to 30MHz seemed the same as at 20MHz. The audio drive capability of the SiLabs chips is not stated in the data sheets. I determined experimentally that the minimum load resistance on the headphone output is 1.6kW. Any less and clipping will occur. The maximum output with this load is 250mV peak-to-peak or about 88mV RMS for a sinewave, giving less than 1mW. It still works with low impedance headphones, although at maximum volume, there will be some distortion. Sennheiser 60W headphones gave an acceptable listening level in a quiet environment. Panasonic noise-reducing headphones with a 330W input resistance (with the noise reduction turned on) gave a considerably higher sound level. Feeding the signal into external amplified speakers gave good-quality sound. Because of this weak output, I have added an op amp buffer that provides drive capability for low impedance headphones, while also providing enough voltage swing for insensitive high-impedance ‘phones. This is also useful if you’re feeding the audio to a preamp or amplifier, as the signal is closer to ‘line level’. When the tuning knob is rotated, each pulse from the shaft encoder sends out six bytes via I2C and then receives seven bytes of status. This takes a significant time, so if you spin the tuning knob too rapidly, the encoder pulses are missed, and you only get a small frequency change. Just slow down the rotation. Circuit description The full schematic is shown in Fig.3. The Si4730 module includes July 2021  65 The Si4732 version differs due to the installation of two 22pF capacitors, a crystal (X2) and the chip itself on the underside of the PCB. the 32.768kHz crystal and associated capacitors. The FM antenna is connected to the module’s FM input via a 1nF capacitor, while the AM band requires a ferrite rod, typically 400μH. An optional 10nF capacitor joins the two antenna inputs, allowing a single length of wire to provide both FM and AM reception in metropolitan areas. The SEN line is tied high internally on the Si4730 module. The audio output is coupled to header CON4. The drive strength from the radio chip itself is just adequate to drive 60W headphones; as hinted above, depending on the ‘phones, the volume level can be a bit low, and distortion can be higher than we’d like. The dual op amp (IC3) in the final version is not present in the prototypes shown. This gives a voltage gain of 4 and low-impedance output, enough to drive just about any headphones or earphones to a decent volume level (even insensitive types), and possibly even very efficient unpowered speakers. Alternatively, an external audio amplifier such as computer speakers can be used, with or without the op amp. If you don’t need the op amp, you can simply bridge pin pairs 1/3 and 5/7, to feed the radio chip’s output to CON4. CON4 also has +5V and GND pins. This supply might be used for a small amplifier module mounted in the same case, to drive 8W speakers. I don’t recommend Class-D amplifiers as they could generate hash which will interfere with radio reception, much the same as a switching regulator. Control is via a standard I2C serial bus and a reset line. I have specified a 32KB ATmega328P chip in a DIL package, although I used the 16KB 66 Silicon Chip ATMega168 in my prototype; the program only occupies 68% of its 16KB of flash, and I have heaps of these chips left over from a previous project. Besides the flash size, they are essentially identical. The display is a standard 16x2 alphanumeric LCD module. There is provision for an external crystal for the ATmega chip, but I found the internal 8MHz RC oscillator quite adequate. The processor runs from 5V, whereas the SiLabs chip requires 3.3V. This is not a problem for the I2C interface, as the output is open-drain, and the 15kW pull-up resistors go to 3.3V. There are also two 1kW series current-limiting resistors between the I2C outputs of the micro and the radio module’s inputs as a precaution against incorrect programming of the I2C pins. The typical value of an I2C pull-up resistor is 4.7kW, but the SCL and SDA pins on the SiLabs chip have limited drive capabilities. Operation with 4.7kW pull-ups could be marginal, especially given the 1kW series protection resistors. Hence the use of 15kW pull-ups; lower values would give a marginal low voltage with either pin when pulled externally low, via those 1kW resistors. I have not found any problems with these higher-value pull-up resistors (eg, sensitivity to EMI). Tuning is by a standard shaft encoder with a pushbutton switch (RE1). The switch cycles through different step sizes on the bands. The external band switch, S3, toggles between AM and FM modes. I used an ON-OFF-ON type switch to provide for three bands. This gives three different voltages which can be read by the analog-to-digital converter Australia’s electronics magazine (ADC) input on the ATmega, PC3 (pin 26). If the Si4730 module is used, there is no SW band, so you should use a two-position switch instead. Another ADC input, PC0 (pin 23), monitors the voltage at the wiper of potentiometer VR2 which sets the volume. The reading is scaled and sent via the I2C lines to control the volume of the SiLabs chip. A third ADC input at PC1 (pin 24) reads the position of potentiometer VR3; the reading is scaled and sent to the SiLabs chip to adjust the bandwidth on the AM band. I could have used a multiple position switch, but this is a simpler and cheaper option. The bandwidths that can be selected are 1.0, 1.8, 2.0, 2.5, 3.0, 4.0 and 6.0kHz. The potentiometer that I have used has a centre detent which gives a 2.5kHz bandwidth, but this is optional. There is no bandwidth option for FM. Using the Si4732 chip For those who wish to include SW or LW bands, you can use the Si4732 chip instead of the Si4730 module. This comes in the SOIC SMD package, which is not difficult to solder. There are only slight changes to the circuit, as shown in Fig.4. The SENB pin goes to ground on the Si4732, which gives it a different I2C address to the Si4730. It requires an additional crystal and three capacitors. The Si4730 module I2C addresses are C6 hex for writing, and C7 for reading. With the Si4732 chip, the corresponding addresses are 22 and 23 hex. Don’t load both the Si4730 module and Si4732 chip. Although they have different I2C addresses, the loading on the RF inputs is such that it severely degrades sensitivity. You will note that the I2C bus is made externally accessible via CON8, together with the +5V supply. This could be useful in future for expansion, or as a debugging aid. The power supply may be 9V AC or 9-12V DC via CON1. If a DC supply is used, it must not be a switching type, as they can create a lot of hash which can wipe out the AM band. A 7805 regulator supplies the ATmega chip and the LCD module, while a small TO-92 linear regulator provides 3.3V for the SiLabs chip. Debugging interface Mosfets Q1 and Q2 provide a serial debugging interface. This was siliconchip.com.au Fig.3: there isn’t a lot to the radio circuit thanks to the Si4730 radio module. The antennas at left are simply coupled to the module using capacitors, while the audio outputs on the right-hand side feed into a pair of op amp buffer/gain stages, which are better at driving headphones than the module by itself. IC2 controls the radio over an I2C serial bus while monitoring user input via rotary encoder RE1, and displaying tuning and signal strength information on a two-line LCD. siliconchip.com.au Australia’s electronics magazine July 2021  67 ► Fig.4(a): if you want SW ► reception, all you have to do is leave off the Si4730 module (MOD1) and instead fit IC1, its 100nF supply bypass capacitor, crystal X2 and its two 22pF load capacitors. All the other components shown here were in the original circuit (Fig.3) and are only duplicated to clarify how IC1 is connected to the rest of the circuit. Fig.4(b): how the panel-mount jack socket is wired to CON4. Check your socket’s pinout to determine the tip (T), ring (R) & sleeve (S) connections. invaluable for debugging purposes, but not required if you just want to use the radio. It is set up for 38,400bps, eight data bits, one stop bit and no parity. Microcontroller IC2 is programmed via the standard 6-pin header, CON9. A pushbutton switch is provided to reset IC2. Component Selection While I try to make sure that components can be sourced locally, it is not always possible. In this case, several major components have to be sourced from overseas suppliers. There are a few suppliers of the Si4730-V2.0 module on AliExpress that sell it for about $5. Make sure it’s the version with six connections on each side. There are some with only five connections on each side that will not fit. As with most orders from China, be prepared for a fairly long delivery time. The Si4732 chip is manufactured in the SOIC-16 package. It is available in lots of five on AliExpress, for a total of about $14, so you will have spares. It’s also available from Digi-Key and Mouser with a somewhat higher price, but the good news is that you can order it along with other parts (about $60 worth) for free express delivery. Apart from the 1000μF electrolytic and the 2W resistor, all other resistors and capacitors are either 1206 or 0805 (imperial) size SMDs, and there are no fine-lead-pitch devices to worry about. Figs.5 & 6: most of the components mount on the top side of the PCB; apart from a few SMDs, the only parts on the bottom are the two pots, the rotary encoder and crystal X2 (if IC1 is fitted). It’s best to fit all the SMDs on the underside, then the SMDs on the top, then the through-hole parts on the top, then the underside. Ensure the polarised parts like the radio module, all the ICs, the aluminium and tantalum electrolytic capacitors, bridge rectifier BR1, diode D1 and trimpot VR1 are orientated as shown. Errata: if using the specified part, REG2 should be mounted upside down relative to the overlay. Otherwise you can mount it on the underside of the PCB, making sure not to have it foul the front panel. This is due to the input and output pins being swapped on the PCB footprint. 68 Silicon Chip Australia’s electronics magazine siliconchip.com.au There are various colours of backlighting for the LCD module. We much prefer the white-on-blue version to the old-fashioned yellow/green version. This type is available from several Australian suppliers on eBay. But if you don’t mind waiting, the LCD module can cost as little as about $2.50 from Chinese suppliers. As we’re using the parallel interface, you won’t need the I2C serial interface board supplied with some of them. The LCD is mounted off the main PCB by standoffs, and connected using the supplied standard header plugging into a low-profile PCB-mounting socket strip. The LCD height above the board means that the two potentiometers and rotary encoder need 25-30mm long shafts. The parts list shows suggested components. Construction A word of caution. The crystal on the tiny ‘4730 module is not firmly attached and can be easily bent to one side and damage the board. I can vouch for that from experience! I recommend a spot of superglue to attach it firmly to the board. In any case, order two of these modules to be on the safe side. The circuit board (coded CSE210301C) is double-sided with components on both sides. It measures 123 x 49.5mm. Both versions use the same PCB; either you mount the Si4730 module on one side, or the Si4732 chip on the other. Refer to overlay diagrams Figs.5 & 6, and ensure that you either fit the module as shown in Fig.5, or the components in the red oval in Fig.6; not both. Start by mounting the 16-pin chip. This is the SOIC-16 type with pins spaced widely enough that they can be soldered individually using a finetip iron. First, apply some flux paste to the pads to reduce the risk of bridging between pins. If bridges do form during soldering, use more flux paste and some solder wick to remove it. Next, fit the SMD capacitors on the underside of the board. Note the two 22pF capacitors (values in parentheses) are only needed if you wish to use a crystal oscillator for the ATmega168/ ATmega328 chip. It is not necessary, so we suggest you leave them off. The other side of the board has the majority of components. Install the remaining surface-mount components next. If you are using the Si4730 module, make sure that it is positioned accurately. It needs a fair amount of solder to flow into the ‘half holes’ on either side (see the photo on page 65). Ensure that the 10μF & 100μF tantalum capacitors are placed with the This is how I wired up the prototype Si4730-based radio. siliconchip.com.au Australia’s electronics magazine correct polarity. The striped end is positive, so face the striped ends towards the “+” symbols on the PCB. Then add the through-hole components, possibly including the optional 8MHz crystal. There is also provision for an SMA socket, CON6, that I did not bother using. This is an alternative input for the AM, LW and SW bands. I prefer the LCD module to be removable; hence, I plugged it into a socket strip. The matching headers are not that easy to find, but the parts list mentions suppliers. The LCD is then attached using 9mm untapped spacers (Jaycar HP0862 or Altronics H21362) and M2.5 x 15mm screws and nuts. The last components to attach are the two potentiometers (VR2 & VR3) and rotary encoder RE1 on the LCD side. Finally, give the board a good wash on both sides with circuit board cleaner. Preparing the enclosure I encased the radio prototypes in the Hammond RP1175C box, which has a clear lid. This avoids having to make a rectangular cutout for the LCD, so you can drill all the holes. The only places I found selling it were Mouser and DigiKey. You could use a larger case that’s locally available, but that would make the radio a bit less convenient to use. You can place the power input connector, headphone jack and BNC antenna connector on any convenient surface. I chose the righthand side of the box. The headphone jack presents something of a problem. The case thickness is too much for easily obtainable 3.5mm stereo jacks. The simplest solution is to use a 6.35mm jack, and if necessary, a 3.5mm adaptor like the Jaycar PA3590. The drilling details are shown in Fig.7; use this as an initial template to locate the circuit board mounting holes (D) and the toggle switch holes (B). As accuracy is required, the blank circuit board can then be used as a template for drilling the mounting holes. Use a countersinking tool so that the screw heads will be flush with the front panel. You will note that there is a small hole in the centre of the encoder and two potentiometers. Once the four mounting holes (D) are drilled, attach the board to the panel with 3mm screws and drill 1mm holes through the centre of the two July 2021  69 Fig.7: if you use a box with a clear lid, then you only have to drill round holes, as shown here. You can stick masking tape on your panel, measure and mark the hole dimensions, or simply copy/print this diagram, cut it out and use it as a template. For the neatest result, countersink the holes marked D on the outside of the panel. potentiometers and encoder positions, to accurately mark the centres of the 8mm holes (A). I printed the 139 x 76mm front panel label on heavy photographic paper, and it fits neatly in the slot on the transparent panel. Fig.8 is the panel label for the Si4730 module-based version, while Fig.9 shows the label for the Si4732-based version. The only difference is in the labelling for the band change switch, adding the SW option for the Si4732 chip. You can also download these labels from the Silicon Chip website and print them out. Use a sharp blade to cut out the slot for the LCD and the five holes for potentiometers, encoder and switches, then cut out the panel and slot it into the inside of the clear lid. It should be a neat fit. Attach the circuit board to the back of the front panel using 12mm-long M3 countersunk head screws at the front and M3 x 6mm screws at the back. 18mm-long spacers are needed, which can be made from a 12mm threaded spacer plus an untapped 6mm spacer stacked. There might be other combinations of spacers to give the required 18mm. The potentiometer and encoder shafts are 6mm in diameter. Be careful if you are using metric knobs, as some might not be suitable for the shafts. Choose the types with a grub screw as these will fit a wide variety of shaft types. There remains the internal wiring to the various switches and connectors on the enclosure. This is relatively straightforward, and shown in the photographs (refer to Figs.3-6). Programming the micro Similarly, an example of the wiring for the Si4732 version of this project. 70 Silicon Chip Australia’s electronics magazine I wrote the control software using BASCOM, a BASIC compiler for AVR micros. Having the application and programming notes provided by SiLabs made the code fairly straightforward. Both the .BAS source code and .HEX firmware file are available for download from the Silicon Chip website. Note that you might need a paid version of BASCOM to compile the .BAS file. The program header on the board is designed for an AVRISP Mk2 programmer. This can be used in conjunction with the free Atmel (now Microchip) Studio program available for download from www.microchip.com Control of the SiLabs chip is via I2C serial commands, and believe me there are heaps of them. There are all sorts of features, such as scanning, that could be incorporated into the design, but siliconchip.com.au Parts List – Silicon Labs AM/FM/SW Radio 1 double-sided PCB coded CSE210301C, 123 x 49.5mm 1 9V AC plugpack with 2.1/2.5mm ID barrel plug 1 plastic box with clear lid [eg, Altronics H0326, Hammond RP1175C: Digi-Key; Mouser] 1 panel label, to suit version being built 1 16x2 alphanumeric LCD module with blue backlight (LCD1) 1 28-pin narrow DIL IC socket 3 2-pin polarised headers with matching plugs and pins (CON1-3) [Jaycar HM3412/02, Altronics P5492/72 + 2x P5470A] 1 5-pin polarised header with matching plugs and pins (CON4) [Jaycar HM3415/05, Altronics P5495/75 + 5x P5470A] 2 3-pin polarised headers with matching plugs and pins (CON5,CON7) [Jaycar HM3413/03, Altronics P5493/73 + 3x P5470A] 1 4-pin polarised headers with matching plugs and pins (CON8; optional) [Jaycar HM3414/04, Altronics P5494/74] 1 panel-mount BNC socket [Jaycar PS0658, Altronics P0516A] 1 PCB-mount DC barrel socket, 2.1/2.5mm ID, to suit plugpack [eg, Jaycar PS0522/4, Altronics P0620/1A] 1 panel-mount stereo 6.35mm jack socket [eg, Jaycar PS0182, Altronics P0065] 1 16-pin low-profile machine pin header strip with matching socket strip (for LCD) * 1 10kW multi-turn trimpot (VR1) 2 10kW 9mm vertical potentiometers with D-shafts (VR2,VR3) [eg, Bourns PTV09A-4030F-B103-ND; or use Altronics R1946 with a fluted shaft] 1 vertical rotary encoder with D-shaft and integrated pushbutton switch (RE1) [eg, Bourns PEC11R-4225F-S0024] 3 small or medium-size knobs to suit VR2, VR3 & RE1 1 PCB-mounting small tactile pushbutton switch (S1) [eg, Jaycar SP0601 or Altronics S1120] 1 SPDT miniature toggle switch with solder tags (S2) [eg, Jaycar ST0335] 1 400μH ferrite rod antenna (L1) [eg, Jaycar LF1020] 4 9mm untapped spacers (for LCD mounting) [Jaycar HP0862, Altronics H1362] 4 9-10mm-long M3 panhead machine screws and nuts (for REG1) 4 12mm-long M3 countersunk head machine screws 4 6mm-long M3 panhead machine screws 4 12mm-long M3 tapped spacers 4 6mm-long untapped spacers, 3.25mm inner diameter 4 15mm-long M2.5 panhead machine screws and nuts (for LCD mounting) various lengths of medium-duty hookup wire various short lengths of heatshrink tubing to suit wire size * some options include Semtronics SBU400Z (header) + MH1S19-140 (socket), Mouser 200-BBL116GF (header) + Mouser 200-SL116T10 (socket), element14 1667454 (header) + Jaycar PI6470 (socket) or Altronics P5400 (socket) Semiconductors 1 ATmega168 or ATmega328 8-bit microcontroller programmed with CSE210301.HEX (IC2) 1 5V rail-to-rail op amp, SOIC-8 (IC3) [eg, LME49721, available from Digi-Key, Mouser, eBay, AliExpress] 1 7805 5V 1A linear regulator, TO-220 (REG1) 1 LM2936-3.3 3.3V low-dropout linear regulator, TO-92 (REG2) 2 2N7002 small-signal N-channel Mosfets, SMD SOT-23 package (Q1,Q2) 1 DB104 bridge rectifier (BR1) [Jaycar ZR1308] 1 LL4148 small signal diode, SMD DO-80 MELF (D1) [Jaycar ZR1103] Capacitors (all SMD M2012/0805 size unless otherwise stated) 1 1000μF 16V through-hole radial electrolytic 2 100μF 6V SMD tantalum, SMA size 3 10μF 6V SMD tantalum, SMA size 2 470nF 50V X7R ceramic 3 220nF 50V X7R ceramic 5 100nF 50V X7R ceramic 5 10nF 50V X7R ceramic 1 1nF 50V X7R ceramic 2 100pF 50V C0G/NP0 ceramic 1 47pF 50V C0G/NP0 ceramic Resistors (all 1% SMD M3216/1206 size unless otherwise stated) 4 100kW 2 33kW 2 22kW 7 15kW 3 1kW 1 100W 5% 2W axial Additional parts for the Si4732-based version 1 Si4732 IC, SOIC-16 (IC1) [AliExpress, eBay] 1 on-off-on (centre off) miniature toggle switch with solder tags (S3) [eg, Jaycar ST0336] 1 32,768Hz watch crystal (X2) 1 100nF 50V X7R ceramic capacitor, SMD M2012/0805 size 2 22pF 50V C0G/NP0 ceramic capacitors, SMD M2012/0805 size Additional parts for Si4730 module-based version 1 Si4730 module, surface-mounting, with six pads on either side (MOD1) [AliExpress, eBay] 1 SPDT miniature toggle switch with solder tags (S3) [eg, Jaycar ST0335] Optional parts 1 vertical SMA socket (CON6) (external AM antenna input) 1 2x3 pin header (CON9) (for in-circuit programming of IC2) 1 8MHz crystal (X1) (see text) 2 22pF 50V C0G/NP0 ceramic capacitors, SMD M2012/0805 size siliconchip.com.au Australia’s electronics magazine July 2021  71 Figs.8 & 9: these panel labels are also available to download from the Silicon Chip website, so you can print them, cut them out and attach them to the inside (or outside) of the box lid. I decided to “keep it simple, stupid” (KISS). Others might wish to expand on what I have done. As mentioned above, the pushbutton switch integrated into the tuning encoder toggles through steps to allow fine selection or quick tuning across the band. On the AM band, the step is 1kHz, 9kHz or 100kHz. The FM band is 87MHz to 108MHz and has a step of 100kHz or 1MHz. On the SW band (if used), the step is 1kHz, 10kHz, 100kHz or 1MHz. About half a second after a frequency is selected, it and the step size are stored in EEPROM. This means that on the next power-up, the EEPROM values are read and that frequency selected. The top line of the 16 x 2 LCD shows the frequency, and on the AM and SW 72 Silicon Chip bands, it also shows the bandwidth. The second line shows the step size and the signal-to-noise ratio (SNR). The Si chip is sampled once a second to update the SNR figure. However, the Si4730 module does not give SNR readings on the FM band. Weaker signals give mono rather than stereo output as expected. Initial setup I did not want to have a separate control program for the Si4730 and Si4732 chips, so the chip type is automatically identified on power up. You don’t need to do anything. When I built a second unit, I discovered that the tuning was backwards. Clockwise decreased the frequency! It appears that shaft encoders differ. So I came up with a method to select Australia’s electronics magazine the correct tuning direction using the existing radio interface. If you find that your encoder action is reversed, use the following steps: 1. Turn the Bandwidth knob fully clockwise. 2. Tune the AM band to 500kHz. The display will show “Toggle Direction” on the top line, and “Direction 1” or “Direction 2” on the lower line. You don’t need to press the button, as it automatically selects the alternative direction when you access this display. 3. Tune to another frequency and make sure the tuning direction is correct. This setup only needs to be done once, as the parameters are stored in EEPROM & restored on power-up. SC siliconchip.com.au