FM Radio
with RDS
A top HAT project
for the Raspberry Pi
entry level
Æ intermediate level
expert level
4 hours approx.
Equipment for
SMD soldering;
reflow oven recommended
If you search the Internet for a HAT list doesn’t stop there. Another desir-
(Hardware Attached on Top) that can able bonus with our HAT is an infrared
turn the Raspberry Pi into an FM tuner, receiver, enabling you to control the radio
you will inevitably stumble across with a standard remote-control handset.
plenty of cheap breakout boards For the user interface (GUI) we have a
using the Si4703 chip from Silicon 3.5-inch touchscreen LCD.
Laboratories (SiLabs). This Then, to go with this hardware, we have
chip provides a complete a Linux software bundle that contains
FM radio with RDS the drivers for the ICs used, as well as a
(from antenna special radio app that offers some alter-
input all the native, deluxe or indulgent methods of
way to ana- operating the radio. What’s not to like
logue stereo now?
output) and is Incidentally, our FM Radio HAT works with
ideal for use in all ‘normal’ versions of the Raspberry Pi
mobile devices. from Type 2 onwards; the use of Type 1
But why stop is neither supported nor recommended.
there? What you The HAT has also been tested with the
might not realise Pi Zero and does run on it — but it’s at
is that you can do your own risk alone...
far better by using a
similar chip called Si4731 from Wide-ranging receiver
the same manufacturer, which not only In the schematic of Figure 1 you can see
offers better receive performance but the small number of components that
also includes digital outputs for I2S audio. comprise our FM Radio.
You can connect this to an audio ampli-
fier with an I2S digital input, which will Si4731
have far better analogue-to-digital con- For the radio receiver chip, we’re using
verters than the Si4703. And the feature the Silicon Laboratories Si4731-D60
GPIO10
GPIO11
GPIO4
GPIO3
GPIO2
ID_SD
GPIO6
GPIO5
GPIO9
+3V3
+3V3
39
37
35
33
31
29
27
25
23
21
19
17
15
13
11
9
7
5
3
1
J8
C4
+3V3
40
38
36
34
32
30
28
26
24
22
20
18
16
14
12
10
8
6
4
2
100n
GPIO21
GPIO20
GPIO16
GPIO12
GPIO25
GPIO24
GPIO23
GPIO18
GPIO15
GPIO14
ID_SC
GPIO7
GPIO8
R7
IC5 1
100R
VDD +5V
GPIO19 5 3
CLK_IN CLK_OUT
GPIO3 9
SCL/CCLK AUX_OUT
4 +3V3 +5V
C2 GPIO2 10 6
SDA/CDIN FILTP +3V3
8 7
AD0/CS FILTN C17
100n C7 C1 C8
IC1 3 GND
2 CS2300 100n R5 R6
1 GPIO26 100n 10u 100n
3k9
12 16 20
3k9
TSOP4138
DVDD
PVDD
PVDD
2 K2
6 L4
* C16 MCLK 1
GPIO18 7 OUTL+
+3V3 BCLK 470R
IC4
OUTL
10p GPIO19 9
LRCLK 2 L5
L1 GPIO21 10 OUTL–
SDATA
1mH GPIO3 5 470R
C5 SCL K3
GPIO2 4 SSM2518 L6
R4 SDA 15
C6 GPIO4 13 OUTR+
100n SD 470R
GND
OUTR
3k9
3 PAD
11 10
100n
ADDR 14 L7
11 OUTR–
VA VD SAMOD
9 6 470R
FM C10 RCLK SEN C12 C13 C14 C15
GND
GND
GND
GND
2 19
FMI GPO1
L2 8 8 17 18 19
1n SDIO 470p 470p 470p 470p
IC2 7
D1 3 SCLK
2 1 270nH Si4731 +3V3
17 R8 GPIO18
GPO3/DCLK 100R
16 R9 GPIO19 R1 R2 R3 C3
DFS 100R
15 R10 GPIO20
CM1213
3k9
DOUT 100R 8
3k9
3k9
GND 100n
PAD VCC
18 GPIO22 ID_SD 5 1
AM C11 GPO2/INT SDA IC3 A0
L1 = SLF7032T102MR13, 1mH@100kHz, 130mA, 4R78
4 5 GPIO23 ID_SC 6 2
AMI RST SCL A1 L2 = LQW18ANR27G00D, 270nH@100MHz, 110mA, 3R4
7 3 L4...L7 = BLM18PG471SN1D, 470R@100MHz, 1A, 0R2
470n RFGND GND WP 24C64SN A2
GND 3 12 GND
WP
4
160520 - 11
‘Broadcast AM/FM Radio Receiver’ [1] one for FM and the other for AM. With suitable antenna.
in its tiny 20-pin QFN package (firmware FM, L2 is used to achieve resonance. The C5 and C6 are decoupling capacitors; L1
version D60). The receiver handles not suppressor diode D1 looks after ESD pro- ensures a stable supply voltage. R8 to
only FM in the full worldwide frequency tection, whilst C10 filters the direct com- R10 are the protective resistors specified
range (from 64 to 108 MHz, meaning that ponent from the signal. Incidentally, for in the datasheet.
it also covers Japan and certain former the FM antenna we have achieved better
Soviet territories) but also AM medium results with 75 cm of thin wire than with SSM2518
wave (520 to 1710 kHz) (Figure 2). The a customary telescopic whip antenna. We For outputting the audio, we selected
Si4731’s digital audio interface operates have plenty of experience with FM recep- the SSM2518 from Analog Devices [2].
in slave mode and supports a variety tion but have not yet had time to exper- This Class D amplifier has a digital serial
of audio data formats (transmitted with iment with AM. The AM antenna needs audio interface that accepts data in I2S
MSB first), including I2S and left-aligned to be a ferrite rod or frame antenna of format and is also controlled via the I2C
modes. The chip can evaluate RDS and 180 to 450 µH, which the data sheet says bus. Both stereo output channels sup-
output the audio data in I2S format in must be connected to the AM input of the ply 2 W into 4 Ω. The circuitry of the IC
the popular sampling rates of 32 kHz, Si4731 via a 470 nF capacitor (C11). The corresponds to the specifications in the
44.1 kHz and 48 kHz. The Si4731 is con- number of turns used depends of course data sheet. C7 decouples the 3.3 V sup-
figured directly from the Raspberry Pi on the properties of the particular type of ply (Digital Supply Voltage, DVDD), C1
over the I2C interface. ferrite rod used. Checking out the Inter- and C8 the 5 V supply (Speaker Supply
The IC has two separate antenna inputs, net will supply possible solutions for a Voltage, PVDD).
Web Links
[1] HAT specifications: https://github.com/raspberrypi/hats
[2] Si4731 datasheet: www.silabs.com/documents/public/data-sheets/Si4730-31-34-35-D60.pdf
[3] SSM2518 datasheet: www.analog.com/media/en/technical-documentation/data-sheets/ssm2518.pdf
[4] Project page: www.elektormagazine.com/180119-02
[5] Elektor-Labs, FM-Radio: www.elektormagazine.com/labs/fm-radio-receiver-with-rds-for-raspberry-pi
[6] Elektor-Labs, PiRadio: www.elektormagazine.com/labs/piradio-for-fm-radio-receiver-with-rds-for-raspberry-pi-160520-1
[7] FM Radio using Volumio: https://github.com/rpi-Receiver/
[8] FM Radio atGithub: https://github.com/ElektorLabs/160520-FM-Radio-Receiver-with-RDS-for-Raspberry-Pi
HDMI
A/V
IN
ETHERNET
PWR
J1
FM
CAMERA
D1
AM
11
C10
J6
C
C6 L2
J4
R4
J10 C5 OUTL+
USB
J3
IC2
C13
Raspberry Pi 2 Model B V1.1 R10
DISPLAY
R8
R9
C4
J11 IC5
C17 OUTR-
C3 R1
L5
L4
L6
L7
USB
RUN
R5
IC3
7
C8
C1
WP
R2 R6
R3 C7
2
1
C
IC
GPIO
J8
J12
ate your own distribution (possibly with following conditions: ical blocks, wherever possible. Since the
a different user interface), you will find infrared receiver and the EEPROM have
hints, examples, drivers, instructions and • various fundamental add-on nothing to do with the main function,
much more among the numerous docu- requirements; they are clearly separated from the other
ments on the Elektor project page [4]. • valid data in the EEPROM (vendor component groups. The radio receiver is
info, GPIO map and device tree); located in the upper part of the board,
Three-cornered HAT • 40-way female header; the frequency multiplier in the middle and
A HAT is an add-on board for the • when the supply voltage is fed in via the Class D amplifier in the lower right
Raspberry Pi that meets the HAT speci- the HAT (backpowering, backfeed- corner. In the radio receiver section, the
fications [1]. This HAT is attached to the ing), at least 1.3 A must be made power supply peripherals, plus the FM,
40-way GPIO headers of the Raspberry available for the Raspberry Pi. AM and digital output peripherals, are all
Pi. Two of the 40 pins are reserved exclu- arranged separately (as effectively as is
sively for connecting an ‘ID-EEPROM’, However, nowhere is it stated that the possible on such a small board). In the
in which information is stored about the PCB of a HAT needs be rectangular amplifier section, the filters are placed
board. This data includes which func- (Figure 3)! Which is why our Hardware so that the ferrite beads are as close as
tions the board has, which GPIOs have Attached on Top is formed of a triangular possible to the IC, and the capacitors
to be configured how and whether power PCB (with a small rectangular notch cut as close as possible to the speaker out-
for the Raspberry Pi and HAT is supplied for the touchscreen connector). Besides put terminals. All auxiliary capacitors are
using the Micro-USB connector on the its unconventional looks, this shape also attached directly to their ICs. A jumper is
Raspberry Pi or via the HAT. saves production costs. Essentially, we provided for write-protecting the EEPROM
Essentially a HAT must conform to the laid out the components in separate, log- and the EEPROM can be written to only
when the jumper is inserted.
The board of the FM radio receiver
is attached to the Raspberry Pi with
17 mm-long combined male/female
standoff pillars (M2.5) (Figure 4).
For mounting the display, a fourth
17 mm-long combined male/female
standoff pillar (also M2.5) is required
next to the Ethernet jack as well as an
M2.5 nut that compensates for the miss-
ing thickness of the PCB at this location.
You then attach the radio board to the
Raspberry Pi and screw four 14 mm-long
M2.5 spacer pillars (again combined
male/female) into the lower spacers.
The four spacer bolts that support the
touchscreen are of the same length;
the inward thread points upwards. This
relieves the loading on the 26-pin dis-
Figure 4. Mounting the HAT on the Raspberry Pi. play connector.
Figure 7. Entering a frequency direct. Figure 8. Quit radio listening and return to Raspbian?
If the LCD is not fitted, but instead the popular Waveshare35a model). The select the frequency with the arrow keys
replaced by an external (touch) screen, control is totally intuitive. and press the desired key on the touch
the 14 mm spacers and nuts are of Figure 5 shows the piRadio display. screen for 5 seconds. A ‘Bookmarked’
course omitted, requiring the board to In the upper area (if the ‘RDS’ logo is star (Figure 6) appears in the upper
be fixed with M2.5×6 screws. shown at top right) the Program Service right corner of the display under the RDS
name (PS) is displayed to the left of the logo when the station is stored.
Software for the radio current tuning frequency. The current Since changing frequency using the arrow
If you are looking for radio apps, you RDS radio text (RT) appears on the sec- keys is usually awkward, we have imple-
will quickly discover KRadio, Gnomeradio ond line. If only the station name can mented an interface for direct input (Fig-
or RDS Surveyor. There are also some be decoded, the display will use lighter ure 7). When you tap the display, you
TV apps that you can use for radio lis- characters for better readability. If no are given an entry form for the frequency
tening. Each app has its own strengths RDS information is received, just the cur- (use the ‘Menu’ button on the remote
and weaknesses, but they’re not ideal for rent frequency is displayed. Received sig- control, the [E] key on the keyboard).
use with IR remote controls and touch nal strength is displayed in a small bar The frequency in current use will be dis-
screens, because they were designed graph on the far right below the antenna played and you can simply start entering
for a desktop system, mouse and key- symbol. The higher the value, the better a new frequency, as the first digit entered
board. With a small 3.5-inch low-res- the reception. deletes the old frequency. For 98.55 MHz
olution touch screen, they are barely In the lower area there are eight buttons you simply enter [9][8][.][5[5]. If you
usable at all. that are labelled ‘Not used’. This is the make a mistake, simply press the Back-
That’s why Mathias Claussen at Elektor station memory with eight buttons. There space key. If the frequency you entered
Labs developed a program called piRadio are four such pages, between which you is within a valid range, the ‘Okay’ but-
to control the FM receiver. The software can switch using the M[x] key, mean- ton appears. If you are not satisfied with
was developed specifically for this hard- ing that you can save a total of 32 sta- your choice, you can press ‘Abort’ and
ware and for operation using a 3.5-inch tions. To store a frequency, first go to the return to the main user interface. Key-
touch screen with 480×320 pixels (like page on which the station is to be stored, board entry is carried out using the same
Table 1. PiRadio software commands for touchscreen, keyboard and remote control handset.
Function Keyboard Remote control
Volume up + Vol+
Volume down – Vol–
Mute M MUTE
Quit Q POWER
Frequency up Up arrow CH+
Frequency down Down arrow CH–
Search frequency up Right arrow Videotext rot
Search frequency down Left arrow Videotext blau
Display/hide frequency E Menu
Erase frequency BACKSPACE ENTER
Decimal point Full stop or comma A/B
Confirm frequency entered ENTER OK
Discard and terminate ESCAPE or E Menu
ware and all drivers, the content of ing a WebSocket API) can be found • There is a guide on how to integrate
the EEPROM, the integration under on the Elektor Labs webpage [6]. the hardware with the Volumio open
Raspbian (and much more) in far source audiophile music player [7].
greater detail. • If you don’t wish to make any mod-
ifications to FM Radio with piRadio • There is also a guide on how to inte-
• The project download contains an and, as far as software is concerned, grate Qt into Raspbian [8].
overlay for Raspbian (rpi-receiver-li- want to get it going straight out of
nux-rpi-4.9.y), specifically the spe- the box, you will find a ready-to- So, whether you just want to build an
cial firmware required for FM Radio, use image for the SD card of the FM radio, modify some details in the
which must be integrated into the Raspberry Pi. hardware and software or else use the
Raspbian kernel. Detailed installation knowledge gathered in the course of this
instructions explain the procedure. • The radio can also be used with project for your own developments, the
other apps, such as RDS Surveyor. project page has something for every
• For the radio to work as desired, This Java program is available for user!
adjustments must be made to Rasp- download along with installation 180119-02
bian to install the LIRC IR remote instructions. The RDS Surveyor
control and redirect the HDMI user really reveals every fine detail that
interface to the touch screen LCD the Radio Data System broadcasts.
connected to the GPIOs. Both are
explained in the installation guide. • A video shows the operation of FM
Radio and its GUI.
• The piRadio application was devel-
oped at Elektor Labs. The source
code is available, enabling modifi-
cations (different layout, additional
functions, number of station memo- @ www.elektor.com
ries, use of the RC5 remote control) ªUnpopulated board # 160520-1 V2.0
to be made easily. www.elektor.com/rpi-receiver-160520-1
ªRaspberry Pi 3 B+
• The app was developed with the free www.elektor.com/rpi3b+
C++ toolkit Qt. More information
about software development (includ-