FM Radio using RDA5807M module with Digilent chipKIT uC32 and Basic I/O


The Digilent chipKIT  uC32 board is based on the popular Arduino™ open-source hardware prototyping platform and adds the performance of the Microchip PIC32 microcontroller. This board is the same form factor as the Arduino™ Uno board and is compatible with many Arduino™ shields. It features a USB serial port interface for connection to the IDE and can be powered via USB or an external power supply. The uC32 board takes advantage of the powerful PIC32MX340F512 microcontroller. This microcontroller features a 32-bit MIPS processor core running at 80MHz, 512K of Flash program memory and 32K of SRAM data memory.

The RDA5807M – an equivalent of Philips TEA5767 and pin-to-pin compatible – is a single-chip broadcast FM stereo radio tuner with fully integrated synthesizer, IF selectivity and MPX decoder. The tuner uses the CMOS process, support multi-interface and require the least external component.  It is completely adjustment-free. The RDA5807M has a powerful low-IF digital audio processor, this make it have optimum sound quality with varying reception conditions. The RDA5807M can be tuned to the worldwide frequency band.

The Digilent chipKIT  uC32 and Basic I/O shield  communicating in I²C protocol with the RDA5807M module can be quite a powerful, yet simple, FM Radio tuner. I²C uses only two bidirectional open-drain lines, Serial Data Line (SDA) and Serial Clock Line (SCL), pulled up with resistors. Typical voltages used are +5 V or +3.3 V although systems with other voltages are permitted.





a) Install libraries of Basic I/O Shield in MPIDE environment for uC32 board

We assume that you have already installed MPIDE environment.

You will need to know the location of MPIDE sketches folder:

Run MPIDE  . In menu do File -> Preferences find the sketchbook location:

tempmon4Take note of the location of your sketches (MPIDE codes are called “sketches”). In your Windows navigate to where the folder is, and create a directory named ‘Libraries’.

Download from here the zipped file containing libraries and documentation for using the Basic I/O Shield™ with the chipKIT MPIDE and unzip into the Libraries folder you have just created:

tempmon5So here we are to go to next procedure

b) Hardware set up

In the first place prepare Digilent chipKIT uC32 board for I²C communication in pins A5 and A6.

On uC32 you must have Jumpers JP6 and JP8 set in the RG3 and RG2 positions.

jumpersInstall the Basic I/O shield on top of Uc32 as shown on the above image . Connect to the PC with USB cable. USB connection will power the Uc32 and the Basic I/O shield simultaneously. Connect the FM module to uC32 and Basic I/O shield.

The following circuit diagram shows the connections to FM Radio Module:

fmradioc) Firmware installation

We assume that you have already installed MPIDE environment.

You will need to know the location of MPIDE sketches folder:


We will use RDA5807M in Philips TEA5767 mode.

Now do File -> New and write a new Sketch:

Code based on Dr Monk's TEA5767 FM Radio Breakout Board
for Arduino at:
For a similar but more advanced project have a look at:

Adapted for Digilent chipKIT uc32 and Basic I/O shield by
Tayeb Habib


#include <Wire.h>
#include <IOShieldOled.h>

unsigned char frequencyH = 0;
unsigned char frequencyL = 0;

unsigned int frequencyB;
double frequency = 0;

int tensf = 0;
int onesf = 0;
int dot_tensf = 0;
int dot_onesf = 0;
int freq=0;
void setup()
frequency = 89.5; //starting frequency

void loop()
   int reading = analogRead(0);

   frequency = ((double)reading *(108.0 - 87.5))/1024.0 + 87.5;
   frequency = ((int)(frequency * 10))/10.0;


   // to view frequency with Tools >> Serial Monitor
   // Serial.println(frequency);

   freq = frequency*100;
   dot_onesf = freq%10;
   freq = freq/10;
   dot_tensf = freq%10;
   freq = freq/10;
   onesf = freq%10;
   freq = freq/10;
   tensf = freq%10;
   freq = freq/10;

   //convert the digits data to ASCII
   tensf = tensf+48;
   onesf = onesf+48;
   dot_tensf = dot_tensf+48;
   dot_onesf = dot_onesf+48;

   // OLED display start up

      {// Display information on OLED display
   IOShieldOled.setCursor(0, 0);
   IOShieldOled.putString("FM Radio");
   IOShieldOled.setCursor(0, 2);
      if (tensf <= 48) //ASCII equivalent of zero
      { IOShieldOled.putString("1");
        IOShieldOled.putString(" ");
   IOShieldOled.setCursor(1, 2);
   IOShieldOled.setCursor(2, 2);
   IOShieldOled.setCursor(3, 2);
   IOShieldOled.setCursor(4, 2);
   IOShieldOled.setCursor(5, 2);
   IOShieldOled.setCursor(7, 2);

void setFrequency()
   frequencyB = 4* (frequency*1000000 + 225000)/32768;
   frequencyH = frequencyB >> 8;
   frequencyL = frequencyB & 0XFF;

Now first run the code with Verify verify to check if it compiles with errors. If does not compile, check the code and compare with the one above. A successful compilation MPIDE will  show a message similar to the following:

compilingNow we are ready to upload the firmware.

Check that your COM port. In my case it is COM30.

Now click on Upload button upload_button. With a successful upload MPIDE will show a message similar to the following:

uploadedIf all is well you can now tune FM Radio stations. The pot on Basic I/O is to be used to tune in the radio stations.

Demonstration Video

I have uploaded a video on Youtube that you can view to see the FM Radio tuner in action:

Next Step

You can add more features like a LED switching on when a station is tuned in. If the station is STEREO or MONO broadcast show it on OLED dspaly, and many other options that RDA5807M module allows. RDA5807M is superior to Philips TEA5767, and has many other possibilities and features.


The Digilent chipKIT  uC32 and Basic I/O shield  communicating in I²C protocol with the RDA5807M module can be quite a powerful, yet simple, FM Radio tuner.

What we have done effectively is a proof-of-concept, i.e. that Digilent chipKIT uC32 can be an adequate replacement to Arduino Uno board to work as a tuner of FM Radio.




About Tayeb

Electronics engineer, part-time webmaster and owner of "Aliatron", a tech-oriented company registered in Portugal and Mozambique.
This entry was posted in Electronic Projects and tagged , , , , , , , , , , . Bookmark the permalink.

2 Responses to FM Radio using RDA5807M module with Digilent chipKIT uC32 and Basic I/O

  1. Pingback: Control Remotely a FM Radio module using RDA5807M with a Digilent chipKIT uC32 and Basic I/O | RedAcacia

  2. Pingback: FM Radio Over I2C with chipKIT uC32 and Basic I/O Shield » chipKIT Development Platform

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s