www.mathertel.deArduino ProjectsArduino Radio Library - The Wiring

Arduino Radio Library - The Wiring

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:

Hardware setup and Wiring

To build up a working radio some hardware setup is required to supply the voltage, control the radio chip, the audio output and probably some additional IO components like buttons or rotary encoder.

Supply voltage

Some of the radio chips are +5 volts tolerant, some need 3.3 volts and some breakout boards come with a regulator and level shifter. You have to read the manual of the chip and the study breakout to find the right connectors and don't put 5 V signals to chips that don't accept that because you destroy them by doing so.

When you need 3.3 volts you can use the supply from the Arduino board. The older boards like the Duemilanove that use the FT232PL USB to serial chip take the internal 3.3 volts regulator of this chip for supplying this voltage.

For the other boards like the Arduino UNO there is an on board regulator that produces this power output.

The 5.0 volts also can be used directly from the board coming directly from USB or from another on board regulator.

However there is not much power available on this outputs. It is possibly enough to drive the radio chip and a headphone amplifier but when you like to drive a power amplifier with some watts you should add a good power supply with low ripple - especially for the audio components.

Wiring the audio output

Some of my boards already have a headphone amplifier on board. Into this connector you can plug some headphones or an active speaker that allows headphone levels as input. I found it easy to use a mini speaker as you can see on several of my photos.

However headphone levels are not exactly what you normally use on a line-in interface to a power amplifier.

Line in levels are using voltage levels into high impedances (1000 Ohms and more). Headphone amps drive voltage levels into low impedances (32 Ohm and lower). So headphone outputs can be used to drive line level inputs and can provide good signals but are typically not as good as true line level outputs.

Newer equipment often allows using mp3 players as an input and can deal with that difference.

Wiring the Arduino and the radio chip

Common to all of the currently implemented chips is that have to be controlled using the I2C bus, sometimes named TWI (Two Wire Interface) also known as the "Wire" library. Beside the GND and the VCC connections as discussed in the Supply voltage this bus needs 2 connections, the data line (SDA) and the clock line (SCL).

The Arduino documentation on the wire library gives enough info to connect the radio board to the right connectors of the used Arduino: www.arduino.cc/en/Reference/Wire

The pins you have to use either depend on the processor of the Arduino or are brought to the SDA (pin 13+3) and SCL (pin 13+4) pins in the newer revisions of the boards. However you have to know that you cannot use the corresponding IO functions (A4&A5 on UNO or D2&D3 on the Leonardo).

If you need 3.3 volts levels from a 5 volts board you should include level shifters.

A port to the Arduino Due or Arduino Zero is planned for a future version. Here everything is already 3.3 volts.

For the SI4703 you also need to add a digital output port of the Arduino to the RST port of the chip. The SI4703 library uses the D2 output by default but you can change that in the source file when you need to.

The usage of the interrupt features (SI4705) is planned for a future version of the library.

Wiring the Arduino to the LCD

Some examples use an LCD for displaying some of the current station information. Using an LCD on the Arduino platform can be done by using the standard LiquidCrystal library that is shipped with the environment. However this library is designed to use a commonly available LCD display (HD44780 compatible) but with a very specific wiring. This is explained in the library documentations.

Because of that wiring that uses a mass of IO ports there are many other solutions available that support the same interface than the original Library (called API1.0). The page playground.arduino.cc/code/LCD tells you a lot about these solutions.

The Radio examples only uses a few of the functions the library offers and should run with the standard and the other API 1.0 compatible libraries without change other than the declaration.

I use a solution that drives the library by also using the I2C bus and a PCF8574 decoder chip.

So search for the library include line:

#include <LiquidCrystal_PCF8574.h>

and put your library here instead.

Wiring the Arduino to a rotary encoder and buttons

To operate a rotary encoder I use the RotaryEncoderLibrary that you can find described in details here: RotaryEncoderLibrary

On the Arduino Uno I usually use the A2 and A3 ports as input. On the Arduino Mega I prefer A8 and A9. Just search the setup of the encoder in the script files and initialize them appropriate.

RotaryEncoder encoder(A2, A3);

To operate the buttons and especially the pushbutton inside the rotary encoder I use the OneButton library.

OneButtonLibrary

Just search the setup of the encoder in the script files and initialize them appropriate.

OneButton menuButton(A10, true);

The LCDRadio example is a good starting point to use these input controls.

The RDA5807M from RDA Microelectronics

This was the first FM radio chip I bought. It is available from time to time on eBay and cheap enough to give it a try. My version is placed on a small adapter board with 2 mm spaced connectors and cannot be used on a breadboard without an adapter. So the first action was to build the adapter you can see on the picture.

It works with 3.3 volts and can directly drive a 32 Ohm headphones. The FM receiver is implemented as in combination of analog and digital technologies. The datasheet does not give a lot of details to that. However it can be controlled using the I2C bus and can decode stereo signals and RDS.

There are also adapters available that add some external components. I found that using a capacitor for VCC stabilization had a positive effect so I soldered one directly on top of the module.

There are only a few external parts required. You definitely need the output capacitors. The 3.3 volts power can be supplied by the Arduino board and the I2C bus connections SDA and SCL can be used directly without level shifters. At least I had no problems using them this way. Because the data sheet specifies them to a maximum level of VCC you should consider using a level shifter in between.

To make it more robust I finally soldered it on a permanent board including a 3.3 volts power supply, the capacitors for the output and put it into an Altoids box.

Building the software part was not trivial but after I found the datasheet in Version 1.1 it was possible to enable one feature after the other including the first version of the RDS interpreter.

The SI4703 from Silicon Labs

This was the second chip I bought while searching for more powerful solutions. It's a chip very similar to the RDA5807M but it needs an amplifier to drive headphones. The sound quality and the antenna sensitivity is somehow better.

There is a FM Tuner Evaluation Board with the Si4703 chip available from Sparkfun and you can also find them on eBay. Sparkfun also provides a very simple example for using it with an Arduino board.

https://www.sparkfun.com/products/10663

On this site you can also find a good tutorial: https://www.sparkfun.com/tutorials/293.

This board works with 3.3 volts, has a headphone amplifier and the necessary components. It also can be controlled using the I2C bus and can decode stereo signals and RDS.

There are no further external parts required. The 3.3 volts power can be supplied by the Arduino board and the I2C bus connections SDA and SCL can be used directly without level shifters. You also have to wire the RST signal to a digital output, D2 in my setup.

The SI4705 from Silicon Labs

After a lengthy research on the internet about the design and age of diverse radio chips I found the SI4705 chips from Silicon Labs that offers fare more options than the SI4703.

I bought a module carrying the SI4705 chip as well as voltage regulation and a stereo amplifier for speakers and I2C bus converters from the German supplier ELV: http://www.elv.de/output/controller.aspx?cid=74&detail=10&detail2=49401.

The board comes pre-assembled and all I had to do is to solder the headers and jumpers. It's easy to solder, all difficult work is done before shipping.

The board doesn't fit good into a breadboard, because of it’s with. Even if you manage to put it into it would be hard to take it off again. It comes with a sample application for the Arduino that works from the scratch.

The noise on the output is acceptable low and when muting the amplifier can be completely removed from the radio chip. This also gives you the option to use another stereo input from another source but I have not used that feature.

Using the TEA5767

Among all the radio chips I adapted for the radio library the TEA5767 seems to the oldest design and the most simplest and it doesn't support RDS either. I found a cheap board including an TDA1308 headphone amplifier and separate antenna connector on eBay from a Chinese seller and could not resist in buying:

TEA5767 radio with headphone amplifier

I had heard of this chip already when implementing the RDA5807 radio chip implementation because this chip provides a TEA5767 compatibility mode and can be used as a replacement.

The TEA5767 supports the following functionalities:

By using the Radio info function you can read the receiver level, the stereo indicator and the current tuned frequency.

The chip doesn't support decoding RDS signals and the audio output is always set to the maximum level and with my board I could easily drive my audio speakers and the line in from an HiFi amplifier. In the library implementation you can find hints for changing the emphasis mode to Europe and us.

Continue reading in: Part 4: The Web Radio