Silicon ChipAM/FM/SW Single-Chip Digital Radio - January 2021 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: More articles than space - a good problem to have!
  4. Feature: Automotive Electronics, Part 2 by Dr David Maddison
  5. Project: AM/FM/SW Single-Chip Digital Radio by Charles Kosina
  6. Review: Altium 365 and Altium Designer 21 by Tim Blythman
  7. Project: MiniHeart: A Miniature Heartbeat Simulator by John Clarke
  8. Feature: How to use the MPLAB X Development Environment by Tim Blythman
  9. Serviceman's Log: One good turn deserves another by Dave Thompson
  10. Project: The Bass Block Subwoofer by Nicholas Dunand
  11. Project: Busy Loo Indicator by John Chappell
  12. Feature: AVR128DA48 and Curiosity Nano Evaluation Board by Tim Blythman
  13. Product Showcase
  14. Vintage Radio: 1963 Philips Musicmaker MM1 mantel radio by Associate Professor Graham Parslow
  15. PartShop
  16. Feature: El Cheapo Modules: Mini Digital AC Panel Meters by Jim Rowe
  17. Market Centre
  18. Advertising Index
  19. Notes & Errata: Balanced Input Attenuator for the USB SuperCodec, November-December 2020; Two LED Christmas Stars, November 2020; D1 Mini LCD BackPack, October 2020
  20. Outer Back Cover

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

You can view 42 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.

Articles in this series:
  • Automotive Electronics, Part 1 (December 2020)
  • Automotive Electronics, Part 2 (January 2021)
Items relevant to "AM/FM/SW Single-Chip Digital Radio":
  • AM/FM/SW Single-Chip Digital Radio PCB [CSE200902A] (AUD $10.00)
  • Pulse-type rotary encoder with pushbutton and 18t spline shaft (Component, AUD $3.00)
  • PCB-mount right-angle SMA socket (Component, AUD $3.00)
  • 16x2 Alphanumeric serial (I²C) LCD module with blue backlight (Component, AUD $12.50)
  • Firmware for the AM/FM/SW Single-Chip Digital Radio (Software, Free)
  • AM/FM/SW Single-Chip Digital Radio PCB pattern (PDF download) [CSE200902A] (Free)
  • Cutting diagrams and front panel artwork for the AM/FM/SW Single-Chip Digital Radio (PDF download) (Free)
Items relevant to "MiniHeart: A Miniature Heartbeat Simulator":
  • MiniHeart PCB [01109201] (AUD $5.00)
  • PIC12F617-I/P programmed for the MiniHeart [0110920A.HEX] (Programmed Microcontroller, AUD $10.00)
  • MiniHeart SMD parts (Component, AUD $7.50)
  • Firmware for the MiniHeart [01109201A.hex] (Software, Free)
  • MiniHeart PCB pattern (PDF download) [01109201] (Free)
  • Cutting diagrams and front panel artwork for the MiniHeart (PDF download) (Free)
Items relevant to "The Bass Block Subwoofer":
  • Cutting diagrams for the Bass Block (PDF download) (Panel Artwork, Free)
Items relevant to "Busy Loo Indicator":
  • Busy Loo Indicator PCB [16112201] (AUD $2.50)
  • Busy Loo Indicator PCB pattern (PDF download) [16112201] (Free)
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)

Purchase a printed copy of this issue for $10.00.

All the hard parts are already done for you! E-Z-2-Build Digital AM/FM/SW Receiver Our DAB+/FM/AM Radio from 2019 is very capable and has been extremely popular. But it is somewhat complicated and costly to build. Not this one, though! It uses the BK1198 digital radio chip which is cheap and readily available, and requires only a handful of discrete components to work. The resulting radio covers the AM and FM broadcast bands plus shortwave from 2.7 to 22MHz. by Charles Kosina 20 Silicon Chip Australia’s electronics magazine siliconchip.com.au T he design of radio receivers has changed dramatically in recent years. For many years, the standard AM receiver was a superheterodyne circuit with a mixer stage that combined the incoming signal with a local oscillator. The resulting intermediate frequency signal was then further amplified and fed into an envelope detector that extracted the audio component. Finally, audio amplification was provided to drive a loudspeaker. When transistors replaced valves, initially, the design philosophy remained much the same. Such receivers (and those which preceded them, such as super-regenerative and tuned radio frequency [TRF] receivers) required multiple tuned circuits, many of them adjustable. But with the advancement of technology, analog circuits have largely been replaced by digital techniques. The BK1198 is a good example of this. Its functions are described in the following PDF document from Jaycar: siliconchip.com.au/link/ab5n Jaycar sells the mono version of the BK1198 separately (Cat ZK8829), as part of a prebuilt AM/FM portable radio (AR1458) or in their “Cardboard Radio” kit (Cat KJ9021). We reckoned that we could do more with the chip, and build a more capable radio, hence this design. If you don’t mind using an external speaker, it fits into a low-cost Jiffy box. Alternatively, you can use a larger box and include an internal speaker. Either way, it delivers 0.9W to the 8Ω speaker. The current band, tuning range and frequency are displayed clearly on a backlit character LCD screen. It also has a tone control, volume control, on/off switch and headphone socket. So basically, it has everything you need for listening to AM, FM and SW broadcasts and not much else, and it’s easy to drive. It runs off a 9-12V AC plugpack or 12V DC external battery. The PCB has been designed with a mixture of SMD and through-hole components; we can’t avoid having SMDs since the BK1198 is not available in any through-hole packages (a common situation these days). That being the case, we decided to use some larger passive SMDs to keep the overall device compact, without making it too hard to put together. Performance Performance is reasonable for such a simple design. On the FM band, I found an internal wire length to be quite adequate to pick up many stations in the Melbourne area with good quality. I do have line-of-sight to the Mt Dandenong towers, however. The AM band suffers from interference from various sources, and switchmode power supplies in the vicinity will create background noise. Moving away from such sources gives reasonable quality. I got the best results by taking it into my car and running it off the car battery. On the short wave bands, a 1µV sig- Fig.1: block diagram of the BK1198 radio receiver chip, on which this project is based. All you have to do is tell it which band(s) you want to listen to, display its details and amplify the audio output. siliconchip.com.au Australia’s electronics magazine Coverage: AM: 513-1629kHz FM: 87-108MHz SW1: 6.4-10.25MHz SW2: 2.7-10.25MHz SW3: 9.8-15MHz SW4: 14.0-22MHz (1kHz steps) (100kHz steps) (5kHz steps) (5kHz steps) (5kHz steps) (5kHz steps) nal is detectable, and a 10µV gives a reasonable signal-to-noise ratio. Circuit description While the simplest radio designs using the BK1198 require only a few discrete components plus an audio amplifier, my design is rather more ambitious, but thanks to the use of an Arduino Nano, still manageable. The circuit I came up with is shown in Fig.1. There are two ways of controlling the BK1198 radio chip (IC4), selected by the MODE pin (pin 5). If this pin is tied low, it’s controlled by serial data on the SCLK and SDIO pins. While this would appear to be the sensible approach, documentation on how to do this is rather sparse, and the translation from Chinese leaves a lot to be desired. My design leaves this as a future option, but for now, an analog tuning approach is used. This means that we have the jumper on LK1 pulling MODE up to 3.3V. A voltage on the BAND pin (pin 15) selects the band that the BK1198 operates on. There are a total of 18 preprogrammed frequency ranges available, and the simplest way is to have a voltage divider connected to TUNE1 (pin 1), which is the tuning supply voltage and very close to 1.2 V. But I have used a different approach. The required voltages are: • AM 2 (513–1629kHz, 9kHz steps); 300mV • FM 1 (87–108 MHz, 100kHz steps): 33mV • SW10 (2.7–10.25MHz, 5kHz steps): 1033mV • SW11 (9.8-22MHz, 5kHz steps): 1100mV The appropriate voltage is generated by IC2, an MCP4822 12-bit digital-toanalog converter (DAC). The user controls the band using 6-position rotary switch S2. Why six position? I decided to split up each of the shortwave bands into two (more on why I did this later). January 2021  21 SC Ó BK1198 BASED DIGITAL AM/FM/SW RADIO RECEIVER Fig.2: despite receiving FM and AM in three different bands, the radio circuit is relatively simple thanks to the all-in-one BK1198 digital radio receiver chip (IC4). JFETs Q3 and Q4 provide extra RF gain for shortwave and FM signals respectively, while inductors L1-L4 provide preselection for different shortwave frequency ranges. Tuning and band switching is controlled by the Arduino Nano using DACs IC3 (12-bit, for band selection) and IC6 (16-bit, for tuning). IC1 is the audio amplifier. 22 Silicon Chip Australia’s electronics magazine siliconchip.com.au 16 x 2 LCD MODULE IC1, IC3, IC6 D2-D5 K A siliconchip.com.au Australia’s electronics magazine 8 I C4 4 1 16 8 1 January 2021  23 The frequency tuning voltage is generated by another DAC, the DAC8551 (IC6), which has 16-bit resolution. It needs to be more accurate than the band selection voltage, hence the higher resolution. The reference voltage for this DAC is the 1.2V on pin 1 of IC4 (TUNE1). This ratiometric approach ensures that an accurate voltage will be generated regardless of the BK1198 chip variations. If we take the FM band as an example, there are 210 channels spaced at 100kHz intervals. The change in channel voltage is thus 1200mV ÷ 210 = 5.7mV. One bit of the 16-bit DAC represents about 18.3µV (1.2V ÷ 216), so the digital value steps by about 311 to switch from one channel to the next. This is more than an adequate safety margin in resolution It gets a bit tighter on the shortwave bands. There are 2440 channels spaced at 5kHz on the 9.8–22MHz band. This is only 490µV between channels, or a step-change of 27 in the digital data. Again, we have a sufficient safety margin. But a 12-bit DAC would have less than two steps between channels, which would be quite inadequate. There are two RF inputs on the BK1198 chip. It receives the FM signal at pin 2. Reference designs include a preamplifier using an NPN transistor, but I opted to use a grounded-gate JFET as this gives good gain and a high stability margin. The second RF input is on pin 4, and is for the AM and SW bands. This presented something of a design challenge. For the AM band, a ferrite rod of about 400µH is required. An internal varicap tunes the ferrite rod to the correct frequency. But there are not many pre-wired ferrite rods available – the only one Jaycar sells is their Cat LF1020. I found the performance of this one not very satisfactory. A better option is to use their LF1012 ferrite rod, which is 180mm long and 9mm diameter. With 65 turns of 24AWG (0.5mm diameter) enamelled copper wire, this gives considerably improved performance. The Q of such a coil is not particularly high, and it is preferable to use Litz wire, but it is challenging to strip and tin each strand. Litz wire is used on the LF1020, and it’s possible to very carefully remove this winding and slip 24 Silicon Chip it on the longer rod, giving an almostideal solution. Shortwave tuning I felt that a low-noise preamplifier was desirable for the SW bands, so I chose the J310 JFET for this as well. Because I wanted some degree of tuning on this preamplifier, I used different inductors for the various bands, which brings me back to why I divided up the shortwave bands into two. My original intention was to use a readily available varicap diode, type BB201, which has a range of about 20–110pF with a tuning voltage of 10–0.5V. This tuning voltage was to be generated by the second DAC in IC3, and amplified by a rail to rail op-amp running off 12V. The varicap range is such that it would cover the appropriate band with the chosen inductor. By using an appropriate formula, the tuning voltage could be calculated by the micro. However, this just did not seem to work at all; the best result obtained was with the varicap set to minimum capacitance regardless of the band or frequency. Based on the BK1198 documentation, I gathered that its internal varicap only operated on the AM band. But I suspect that it also works on the SW bands, although the documentation does not describe this. The op amp and varicap of the original prototype were therefore unnecessary, so I removed them in the final design. You will see that there is a 2.2kΩ resistor from the drain of Q3 to +8V. Originally, this was a 1000µH RF choke, which was fine for the shortwave bands, but it completely killed the AM band because the 100pF capacitor in series resonated within the Quirks with the BK1198’s shortwave tuning My original prototype had a problem with its SW10 shortwave range; I found it to actually cover 3.1–10.1MHz rather than the expected 2.7-10.25MHz range. As the ranges are set at the factory by internal programming, this could have been an anomalous chip. Replacing the chip gave me the correct range. Fortunately, if this happens to you, it is easy to correct by altering just a few numbers in the program code. Australia’s electronics magazine AM band and formed a very effective series-resonant trap. By replacing it with a resistor, the HF performance is not significantly affected, and it has a minimal effect on the AM band. Small signal diodes D4 & D5 provide some measure of protection against voltage spikes being picked up on the SW antenna, for example, during a thunderstorm. Obviously, they cannot protect against a direct or even nearby strike, but will prevent damage to Q3 from general lightning activity. The 100pF coupling capacitor, in combination with the inductor L1-L4 selected by rotary switch S2a peaks the shortwave preamp response around the selected frequency band. Band selection details Getting back to band selection, S2b selects from equally-spaced voltages between 0 and 5V, generated by a chain of 2.2kΩ resistors between 5V and 0V. The selected tap is fed to the internal analog-to-digital converter (ADC) of the AVR ATmega328 chip on the Arduino Nano module. This ADC has a 10-bit resolution, so that the values read are approximately 0, 204, 409, 613, 818 and 1023. By truncating the last two digits we get 0, 2, 4, 6, 8, and 10. Then dividing by two and adding one gives the selected band number, from one to six. The Arduino code then uses a lookup table to find the value needed to generate the appropriate band select voltage for the BK1198 chip. This is a more versatile arrangement than using a resistor network to generate the voltage directly, as it can easily be programmed to select any of the different bands available. Switch positions 3 and 4 both select the 2.7-10.25MHz band, and switch positions 5 and 6 both select the 9.822MHz band. However, different inductor values are chosen as part of the SW filter by S2a for each shortwave position. The Arduino Nano module is available at very low cost and has the advantage of providing regulated 5V and 3.3V outputs, which are needed by other devices in the circuit. Most of its I/O pins are used. The LCD module is the popular 16x2 type that is widely available. The SCL and SDA lines of the Nano are routed to the BK1198 chip in case someone can work out how the siliconchip.com.au BK1198 serial interface works. The Nano is a 5V device, while the BK1198 runs from 3.3V. So schottky diodes D2 and D3 are used (along with pull-up resistors to 3.3V) to prevent damage to the BK1198 IC. Tuning is controlled via incremental rotary encoder RE1. The falling edges of its output pulses generate an interrupt on the INT0 pin (Arduino digital input D2), at which point the state of analog/digital input A3 is read. If it is high, the frequency is increased by the appropriate step, and if low, it is decreased. This scheme works with either momentary or level type encoders. The pushbutton switch integrated with the rotary encoder is connected to INT1 (digital input D3). This is used to toggle between the step sizes on different bands. On the AM band, the spacing in Australia is 9kHz, but the toggle allows for 1kHz step size as well. On the FM band, only a 100kHz step size is used, as it does not take too long to sweep across the band. All four shortwave bands have step sizes that can be set to 5kHz, 50kHz and 500kHz. Audio amplification The audio output section is fairly straightforward. The OUT pin of the BK1198 chip (pin 13) is capacitively coupled to volume control potentiometer VR2. The tone control potentiometer (VR3) at minimum resistance gives a -3dB point of about 700Hz. This works by forming a variable low-pass filter in combination with the 2.2kΩ resistor and 100nF capacitor. The audio amplifier is an SSM2211 chip which will deliver about 0.9W into 8Ω. The phono jack is configured to cut off the signal to the loudspeaker when phones are inserted. To prevent hearing damage, a 560Ω resistor reduces the output level to the headphones. Power supply The original idea was to run the radio from a 12V DC plugpack. There are plenty of switchmode ones available, but they generate so much hash as to make the AM band all but useless. You could use one which has an iron-cored transformer, but they are almost impossible to buy new now. Fortunately, Jaycar still sells a 9V AC plugpack, the MP3027. We use this and rectify its output using bridge recsiliconchip.com.au Case holes required for the receiver. No diagram is shown for these as none of them are super-critical. tifier BR1. The resulting pulsating DC is filtered by a 2200µF capacitor and applied to the input of 7805 regulator REG1. Don’t be fooled though – this regulator is not producing a 5V output. A resistive divider between its output, GND pins and the actual circuit ground (0V) lifts its output to 8V while retaining decent regulation. The Nano module has a 5V regulator, which powers the ATmega328 micro and also the audio amplifier. We don’t want this regulator to drop too much voltage or else it could overheat. Tests showed that with sustained maximum audio output, this regulator does not overheat as long as its input voltage is no higher than about 8V. So REG1 is essentially a pre-regulator for the Arduino’s own 5V regulator. Note that you could use a 7808 for REG1, leave out the 330Ω resistor and replace the 180Ω resistor with a wire link or 0Ω resistor. However, 7808s are not as common to find as 7805s are. By the way, the 100nF capacitor across the input to bridge rectifier BR1 may seem redundant, but it helps to filter out any unwanted RF picked up by the supply leads. Debugging interface A simplified RS232 serial interface is provided by transistors Q1 and Q2, which operate as level shifters. This was included purely for debugging purposes in development, operating at 38,400 baud with the usual 8,N,1 enAustralia’s electronics magazine coding. These components (and their 15kΩ drain pull-up resistors) may be omitted if you don’t plan to fiddle with the software. Software The firmware is written in BASCOM, a versatile BASIC-like language that compiles into native AVR code. On power-up, the receiver retrieves the last frequency and step size for the set band from EEPROM. The LCD module shows the selected band on the top line and the set frequency on the bottom line. When another frequency is selected by the tuning knob, the new set frequency and current step size is written into the EEPROM after about half a second. Sourcing the components We know that sourcing components can be a challenge, so the ones used in this design were carefully chosen so that they are available from local suppliers such as Jaycar, Altronics and element14. In some cases, you might have to buy multiples of the one item. Some of these items might be available more cheaply on eBay, AliExpress or Banggood, if you don’t mind the longer lead time. For the full details, see the parts list below. Construction Refer now to the PCB overlay diagram, Fig.3. The BK1198 radio is built on a PCB coded CSE200902A which January 2021  25 measures 127 x 88mm. If you have some experience soldering surfacemount components, the assembly should not present any problems for you. If you don’t, you might want to practice with something simpler first. Start by fitting IC6, the 16-bit DAC. It’s in an eight-pin fine-pitch (0.65mm) package and does require special care. First, locate its pin 1 dot in the top corner and line it up with the pin 1 indicator on the PCB. Spread some flux paste over the pads, place the chip and carefully tack down one corner pin. Use a magnifier to verify that the other seven pins are correctly located over their pads. If not, re-melt the solder on that tacked pin and gently nudge it into position. Repeat until it is precisely located, then solder all the pins and again use a magnifier to check for bridges between pins. If you find any, add extra flux paste and clean up the bridge(s) using solder wick. The remaining ICs have twice the pin pitch (1.27mm), so they should be fairly easy in comparison. Use a similar technique to fit those, making sure in each case to check the pin 1 orientation before soldering. Follow with the four small transistors and the four diodes. Don’t get the different types of transistors or diodes mixed up. The orientation of each transistor will be obvious, but you will have to check (probably under magnification) for the cathode stripe on 26 Silicon Chip the diodes to determine their correct orientations. The SMD resistors and capacitors are all either 2.0 x 1.2mm or 3.2 x 1.6mm, so again should be fairly easy and they are not polarised. The SMD resistors will be printed with a tiny code on top that identifies their value (eg, 183 [18 x 103] or 1802 [180 x 102] indicates 1.8kΩ) while the capacitors will be unmarked. Make sure each component goes in the correct location as per Fig.3. Through-hole parts Next, fit the low-profile through-hole parts: the 1W resistor, axial inductors and the bridge rectifier (watch the orientation – the positive terminal should be marked). The watch crystal, X1, is laid over on its side and held down with a loop of wire soldered to the board (use a component lead offcut). Be careful bending and soldering its leads because they will be very thin, and you don’t want them shorting against each other or the crystal case. Continue by fitting taller parts like trimpot VR1 (with its adjustment screw towards BR1), polarised headers CON1-CON3, CON7 & CON9 and SMA sockets CON5 & CON6. Also fit the 3-pin header for LK1, and place the shorting block between pins 1 & 2 and the socket strips for the Arduino Nano. Note that you don’t need CON3 unless you plan to use the serial debugAustralia’s electronics magazine ging feature, and most of the other headers could be left off if you prefer to solder flying leads straight to the board. That will make the final construction steps a bit more tricky, though. Also, if you live in a strong signal area, you could use FM antenna connector CON6 off the board and just solder a length of wire to its central pad. Now mount the Arduino Nano module, which can be soldered straight to the board (it’s usually supplied with pin header strips) or optionally, plugged in via female sockets soldered to the board. Either way, make sure that its pinout matches the PCB silkscreen. With that in place, fit the sole electrolytic capacitor, ensuring its longer lead goes to the pad marked with a + symbol. The last part to fit on this side of the board is inductor L8, which is wound using six turns of 0.5mm diameter enamelled copper wire on a 5mm diameter former (such as the shaft of a 5mm drill bit). Space out the windings so that the coil is 7mm long, then cut it to length, strip the enamel off the ends of the wires (using emery paper or a sharp knife), tin the wires and solder the coil to the board where shown. Underside components We have seen LCDs with pins 1 (GND) and 2 (+5V) swapped, so check your screen. If pin 2 is GND, you will need to cut the header pins off and add siliconchip.com.au Fig.3 (left): the PCB uses a mix of SMD and through-hole components. Start by fitting the only fine-pitch SMD, IC6, then the remaining SMDs (don’t forget the two caps under the Nano!), followed by the topside through-hole parts and finally, those which mount on the underside (mainly the display and controls). There are a few optional components, such as the debugging header CON3. This diagram also shows most of the external wiring. At right, the photo shows the assembled PCB mounted in the case. Note that this is an early prototype board so there could be some minor differences between this and the PCB overlay opposite. wires to cross these connections over. The LCD screen mounts on the underside of the board. Solder its header strip in place, then check that it has a pin header attached; if not, solder it now. Plug it into the socket and attach it to the board using the tapped spacers and machine screws. With the LCD in place, the remaining underside components can be fitted: rotary encoder RE1, rotary switch S1, volume control potentiometer VR2 and tone control potentiometer VR3. Preparing the ferrite rod antenna As explained earlier, you probably won’t find a 400µH ferrite rod that comes pre-fitted with a coil. The easiest and best solution is to also buy a smaller ferrite rod antenna, such as the Jaycar LF1020, carefully remove the windings from that rod and then gently slip them over the longer rod. If you can’t (or don’t want to) do that, instead wind 65 turns of 0.5mm enamelled copper wire onto the rod, and strip and tin the ends, ready for attachment to the PCB via flying leads. Programming You can program the Arduino Nano module separately, or plugged into the main board, but it’s easier before you plug it in. As the code is written in BASCOM, you can’t use the Arduino IDE to program the chip. We suggest a free prosiliconchip.com.au gram called AVRDUDE or (preferably) its Windows graphical version, AVRDUDESS. Download and install it from: https://blog.zakkemble.net/avrdudessa-gui-for-avrdude/ Launch it and find the dropdown under the label “Presets” in the upper right-hand corner of the window, click the drop-down and select the “Arduino Nano (ATmega328P)” option. In the upper left-hand corner, modify the COM port number to match your Nano. Once you have plugged it in, you can find its port number in Windows’ “Bluetooth and other devices” Settings page. Under the “Flash” heading, click the “...” button and find the radio HEX file (available as a download from the SILICON CHIP website). Then ensure “Write” is selected just below this and Radio Source Code As usual, we will be making the source code available for this project, along with the HEX file. The firmware was written in BASCOMAVR, a version of the BASIC language that compiles to native Atmel AVR code. So it is quite easy to modify. BASCOM is commercial software; there is a free demo version available which can produce binaries up to 4KB in size, but the radio software is larger than that. A full license for the software costs around $150 (it’s available from a few different online shops) Australia’s electronics magazine press “Go”. Messages will appear at the bottom of the window, hopefully indicating that the programming was successful. The most likely cause of any problem an incorrect port selection. Finally, unplug the USB cable from the Arduino Nano module and plug it into your radio board. The board assembly is now complete. Testing It’s a good idea to do a little bit of testing before you put the board in the case, as it is easier to debug and fix in its current state. You will need some sort of antenna connected to verify that the radio is working – at this stage, the FM antenna is probably the easiest to organise. A length of wire might be good enough for initial testing. You will also probably want to temporarily connect an 8Ω speaker between pins 1 and 3 of CON7. Position the board so that you can see the LCD and access the controls, and connect a 9V AC or 12V DC power supply to CON1. Verify that the LCD backlight switches on and you get a sensible display on the LCD screen. If you can’t see the characters, try adjusting trimpot VR1. If the backlight doesn’t come on, then that points to a power supply problem – check the output of REG1 and verify that it is a steady 8V or so. If you still don’t get any display, then there may be a problem with the programming of the Arduino Nano January 2021  27 module, or perhaps the Nano or LCD are not making good contact with their sockets. Assuming the display looks OK, rotate S2 to get the unit into FM mode and then try turning RE1 to find a station. 28 Silicon Chip Adjust VR2 to get a sensible volume from the speaker. If you can pick up stations then it’s all looking good. If not, you might need a better antenna, or you could have a problem in or around transistor Q4, IC4, crystal X1 or audio amplifier IC1. Australia’s electronics magazine If you want to test the other bands, then you will need to connect up a shortwave antenna to CON5 and/or the ferrite rod to CON2. Assuming it all checks out, proceed to finish the build. If you run into problems, it’s always a good idea siliconchip.com.au Parts list – AM/FM/SW Digital Receiver 1 double-sided PCB coded CSE200902A, 127 x 88mm 1 5V Arduino Nano module 1 16x2 blue backlit alphanumeric LCD module 1 220 x 160 x 80mm IP65 sealed ABS enclosure or similar with black 3mm acrylic laser-cut lid/panel, 193 x 109mm(?) (fits internal speaker), OR 1 UB2 Jiffy box, 197 x 113 x 63mm (no internal speaker) 1 10kW single-turn mini vertical (SIL) trimpot (VR1) [eg, element14 9317236] 2 9mm vertical 10kW potentiometer (VR2, VR3) [eg, element14 1191725] 1 2.2µH axial RF inductor (L1) [eg, element14 1167666] 1 4.7µH axial RF inductor (L2) [eg, element14 1180375] 1 10µH axial RF inductor (L3) [eg, element14 1180270] 1 33µH axial RF inductor (L4) [eg, element14 1857853] 1 100µH axial RF inductors (L9) [eg, element14 2858897] 1 1m length of 0.5mm diameter enamelled copper wire (L8 and possibly L10) 1 400µH ferrite rod (L10) 1 coil taken from ferrite rod antenna (L10) 1 32768Hz watch crystal (X1) [Jaycar RQ5297] 1 rotary encoder with inbuilt pushbutton (RE1) [eg, element14 2663519] 1 SPST chassis-mount toggle switch (S1) 1 2-pole, 6-position rotary switch (S2) [Jaycar SR1212] 3-4 knobs (to suit VR2, VR3 [if fitted], RE1 & S2) 3 2-pin polarised headers (CON1,CON2,CON9) [Jaycar HM3412] 3 2-pin polarised plugs (for CON1,CON2,CON9) [Jaycar HM3402] 2 3-pin polarised headers (CON3,CON7) [Jaycar HM3413] 2 3-pin polarised plugs (for CON3,CON7) [Jaycar HM3403] 2 right-angle or vertical PCB-mount SMA sockets (CON5,CON6) [eg, element14 2612349] 1 6.35mm switched stereo chassis-mount jack socket (CON8) [Jaycar PS0184 or similar] 2 15-pin female header sockets (for the Nano; can be cut down from longer strips) 1 16-pin female header socket (for the LCD) 1 3-pin header with jumper/shorting block (LK1) 1 2.1mm inner diameter bulkhead barrel socket [Jaycar PS0522 or similar] 1 8W 1W full-range speaker driver (eg, 76mm if mounting in a larger box) or an external 8W speaker) 4 knobs (size as required) 4 8mm-long M3 tapped spacer (for mounting LCD) 4 15mm-long M3 tapped spacers (for mounting PCB to box) 12 M3 x 5mm panhead machine screws 4 M3 x 10mm countersunk head screws various lengths of shielded and hookup wire to carefully inspect all of your solder joints, while also verifying that the right parts are in the right locations, and any polarised components have not been soldered in the wrong way around. Final construction If you’re building the radio into the smaller and cheaper UB2 Jiffy box, siliconchip.com.au Semiconductors 1 SSM2211SZ or NCS2211DR2G 1.5W audio power amplifier, SOIC-8 (IC1) [element14 2464727] 1 MCP4822-E/SN dual 12-bit DAC, SOIC-8 (IC3) [element14 1439414] 1 BK1198VB digital radio receiver, SOIC-16 (IC4) [Jaycar ZK8829] 1 DAC8551IDGKT 16-bit DAC, VSSOP-8 (IC6) [element14 1693841] 1 7805 5V 1A linear regulator (REG1) 2 2N7002 N-channel Mosfets, SOT-23 (Q1,Q2) [element14 1764537] 2 MMBFJ310LT1G N-channel VHF/UHF JFETs, SOT-23 (Q3,Q4) [element14 1431340] 1 DB104 bridge rectifier, DIP-4 (BR1) 2 BAT54T1G schottky diodes, SOD-123 (D2,D3) 2 1N4148WS signal diodes, SOD-323F (D4,D5) Capacitors (through-hole) 1 2200µF 16V electrolytic Capacitors (SMD M3216/1206-size) 4 10µF 25V X7R ceramic 3 1µF 25V X7R ceramic Capacitors (SMD M2012/0805-size) 1 10µF 25V X7R ceramic 9 100nF 50V X7R ceramic 2 10nF 50V X7R ceramic 1 1nF 50V X7R ceramic 1 100pF 50V C0G/NP0 ceramic 1 33pF 50V C0G/NP0 ceramic 3 18pF 50V C0G/NP0 ceramic Resistors (all SMD M3216/1206-size 1% thick film unless otherwise specified) 1 10MW M2012/0805-size 1 270kW M2012/0805-size 1 220kW 1 56kW 1 18kW 5 15kW 1 10kW 2 4.7kW 7 2.2kW 1 560W 1 330W 1 180W 2 100W 1 100W 1W 5% axial you can either use our laser-cut lid, or drill and cut holes in the lid that came with your box. Fig.4 shows the details of the cutouts in our custom lid. You could cut a piece of ~3mm thick plastic to this size and make the cut-outs, but it’s probably easier to just print this (it’s available as a PDF download from our website) and use it as a template on Australia’s electronics magazine (code 106) (code 274) (code 224) (code 563) (code 183) (code 153) (code 103) (code 472) (code 222) (code 561) (code 331) (code 181) (code 101) (code brown black brown gold) the existing Jiffy box lid. The laser cutter can’t make countersunk holes for the PCB mounting screws, so whether you’re using a premade lid or cutting your own, you will need to use a countersinking tool to profile those four holes on the outside face of the panel. It’s also a good idea to attach a panel label. The artwork we’ve prepared January 2021  29 The see-through case shows how the electronics mounts to the lid/front panel – and because you can see the “works”, also adds to the intrigue of this radio! is available as a PDF download from siliconchip.com.au Print it onto adhesive paper (see siliconchip.com.au/Help/FrontPanels for details) or print it onto regular paper and laminate it. You can then cut the panel to size and cut out the holes with a sharp hobby knife. But before you glue it to the lid, attach the PCB to the rear so that you can hide the mounting screws. The radio board attaches to the back of the lid using the 15mm spacers, with countersunk screws through the lid and regular machine screws holding the PCB to the spacers. Once the panel has been glued in place, you can attach the nuts to hold the potentiometer(s), rotary encoder and rotary switch to the panel, then attach the knobs (after cutting down any shafts which are too long). The power on/off switch (S1) and headphone socket (CON8) mount in the hole provided on the front panel. You will also need to drill a hole somewhere in the side of the box for the barrel power socket. While you’re at it, decide where in the case you are going to mount the ferrite rod, and if fitting an internal speaker, that too (you will need to drill sound and mounting holes). Once you drop the lid into the box, the FM and SW sockets will be accessible via holes in the left-hand side. Alternative, smaller . . . and slightly cheaper . . . version As mentioned earlier in the text and shown in the parts list, we have made a second version of the AM/FM/SW receiver which is not only more compact, it is also a little cheaper to build. It uses the same BK1198 receiver module; in fact, the electron­ ics is virtually identical. The main difference is that it doesn’t have an internal speaker, relying instead on headphones or earpieces. (The photo above shows a 3.5mm adapator plugged into a standard 6.35mm socket, so it will take the vast majority of headphone types.) The other difference is that it uses a standard UB2 jiffy box instead of the more expensive (and larger) ABS case. The photos show how the assembled BK1198 receiver board is an easy fit in the smaller case. Construction is basically the same as the larger version. Like the 30 Silicon Chip Australia’s electronics magazine siliconchip.com.au Temporarily insert the lid into the box and mark out the locations, then drill these holes large enough to get cables onto those connectors. One of the last steps is to make up the wires and plugs for the ferrite rod, power supply and switch and speaker/ headphone socket. For the ferrite rod, this is simple; you just need to attach a two-way plug to the end of a short piece of shielded cable or twin-lead. The polarity doesn’t matter, but it must be long enough to reach CON2 before the lid is attached to the case. Solder this to the primary winding on the ferrite rod. If you’re using a pre-made coil, it might have two pairs of wires, so use the pair with the highest (but noninfinite) resistance reading between them. The power wiring is slightly more complicated (see Fig.3); one pin of CON1 (it doesn’t matter which) goes straight to the outer barrel contact of the socket, while the other pin goes to the central pin contact via switch S1. If your switch has more than two contacts, pick two which are connected when the switch toggle is down but open when up. One possible pitfall is that barrel sockets often have three solder tabs, one of which is disconnected when a plug is inserted. So make sure the outer barrel contact you solder to is not that one. It’s easiest to check by inserting a plug, then soldering to the tab which has continuity to the outer barrel. Finally, wire up the headphone socket and speaker as per Figs. 1 &3. Start by identifying the switched and unswitched tip and ring contacts on the socket and joining them together, turning it into a mono socket. Connect the sleeve tab back to the middle pin of the plug for CON7. The contacts which connect to the ring and sleeve when a plug is inserted then go to pin 1 of CON7. Then wire the unused pair of head- larger version, the PCB assembly “hangs” from the case lid, with suitable cutouts for the display, controls and ’phones socket. phone socket contacts to one end of the speaker, and the other end of the speaker back to pin 3 of CON7. Note that if you’re building it into the UB2 Jiffy box and using an external speaker, you will have to run a pair of wires out of an extra hole in the case to your external speaker. Alternatively, fit a two pin (or more) connector somewhere on the box, with a matching plug for the external speaker. One good option for this external speaker is to use an unpowered computer speaker, which usually has a 3.5mm jack plug fitted, then use a 3.5mm jack socket to connect it back to the radio board. Once all this wiring is complete, you can plug all the wires into the appropriate headers on the board, then give it all a final test before buttoning it up (ie, attaching the lid to the box). You should be able to do this using the selftapping screws supplied with the box. You can now enjoy listening to your radio! Front panel artwork, as shown in the photo opposite, can also be downloaded from siliconchip.com.au – this can also SC be used as a drilling template. Lid drilling detail for the Jiffy Box version. This, along with front panel artwork to suit is available from siliconchip.com.au siliconchip.com.au Australia’s electronics magazine January 2021  31