www.mathertel.deArduino ProjectsArduino Radio Library - The Library

Arduino Radio Library - The Library

This project is about controlling an FM radio chips by using an Arduino and some optional components like an LCD display, rotary encoder, a LCD+Keyboard shield and Ethernet Shield to build a standalone radio. It comes with several examples for different configurations.

Content of this article:

The Radio library

The core software part of this project is the Arduino radio library that enables controlling radio chips for receiving FM broadcast audio signals.

Currently the following chips are supported:

Download the project files:

The source files for this library is maintained on github in the repository https://github.com/mathertel/Radio.

Here you can browse the source code and a DOXYGEN documentation is available at http://mathertel.github.io/Radio.

The direct download link is RadioLibrary.zip

Introduction

This Arduino library implements the software to control some FM radio chips to build the core part of an Open Source FM radio by using an Arduino board.

In fact it is a collection of multiple libraries and samples because there are several chips and breakout boards available these days that can be used to receive FM signals and output an audio signal. I provide a very simple sample for every adapted chip that may help you to start with your setup and some more feature complete sketches that introduce other hardware components like LCD panels and other IO.

Because most of the chips are made for integration into mobile phones or car radios the chips themselves are really small. If you don't have the soldering equipment for these chips you should look out for breakout boards, sometimes together with audio amplifiers for headphones os speakers. The ones I found and listed above

They all are capable for receiving FM radio stations in stereo with European and US settings and can be controlled by using the I2C bus. However there are differences in the sensitivity and quality and well on receiving RDS information from the stations.

For each of these chips a specific library is implemented that knows how to communicate with the chip using the I2C bus and the wire library. These libraries all share a common base, the radio library so that all the common code is only implemented once in there.

All the libraries (for example SI4705.h+SI4705.cpp) share the same interface (defined by the radio.h+radio.cpp library) so it is possible to exchange them when not using one of the chip specific functions.

While implementing the first libraries I found several functionalities being useful for all the chips so these are implemented in the base class too.

However not all chips support the same functionality. For example setting the volume on the TDA chip will not work because this chip doesn't support it. If you query for the result of setting the columns you will always get the default volume level 15 back.

Other functions are implemented different in different chips. For example the SI4705 chip supports 64 levels of volume while the RDA only supports 16. To make the libraries compatible the specific implementation normalizes this to the 0 to 15 range. If you like to use the fine tuning for the specific chip you can use the setVolumeX function instead.

API documentation

The source code of the library is filled with the low level documentation explaining briefly every function. By using the DOXYGEN tool this information ex extracted into a separate documentation that you can find on github too: http://mathertel.github.io/Radio/html

Choose the chip you have in your setup and see what functions the library supports.

Feature   TEA5767 RDA5807M SI4703 SI4705
RADIO band = FM X X X X
band = FMWORLD
freq X X X
mono X X X X
stereo Decode stereo signal X X X X
RSSI signal strength indicator 0 - 64 0 - 64
SNR signal noise ratio 0 – 127
softmute X X X
mute X X X X
Seek
FM Grid 50 kHz
Audio volume Supported number of volume levels 0 - 15 0 - 15 0 - 63
bassboost Boost bass frequencies X - -
RDS Data Decode RDS signal - X X X
Errors Provide information on RDS signal errors - - X X

ChangeLog

Continue reading in: Part 2: The Examples