---

Friday, March 23, 2012

TEA5767 FM Radio Breakout Board for Arduino

Update: Monkmakes.com now selling a breakout board for this: http://www.monkmakes.com/#!/~/product/category=0&id=36087884



I recently failed to resist buying two TEA5767 FM Radio modules from eBay for almost nothing. These little modules use the I2C serial protocol and so are ideal for connecting to an Arduino.

These things are tiny. This image is much larger than the real thing. In fact, the connectors on the side are at a smaller pitch than the 0.1 inch found on the Arduino connectors.

So, the first just was to make a little breakout connector using a bit of stripboard.





First cut the tracks on the back like this:

Then solder short lengths of solid core wire in place, either side of the breaks in the strips. 
 Bend the cut ends inwards so that they will meet the connectors on the module. Trim the ends of so they just reach the module. I actually cut mine a bit short (see below) which made thins more difficult.
Before trying to solder the leads to the module, fit a crocodile clip over the leads to act as a heat sink, otherwise the leads are likely to become detached from the strips beneath.
When all the pins are soldered, solder in a link wire between pins 3 and 6. This is also the ground connection.
I also attached 0.1inch header sockets for ease of experimentation.
Here is the pinout for the finished module. On the left we have the IC2 connections SDA and SCL that will go to pins A5 and A4 respectively on the Arduino Uno.

The right hand side has a connection ANT (antenna) left and right audio and ground.
Connect all the left hand connections to the Arduino as described above.

If you want to be able to control the tuning of your radio (you don't have to, you can just set the frequency in the sketch) then optionally use a solderless breadboard to hold a pot (I used 10K linear).

The pot should be connected with the center slider to Arduino pin A0 and one end to GND and the other to +5V. Turning this pot will change the frequency.

Note that I actually used a Freetronics USB Droid board, as that was what I had to hand, rather than an Uno, but an Uno will work fine.

On the right-hand side of the breakout board (top in the picture above) I attached a 3.5mm socket to one channel and GND and poked a length of wire into the ANT socket to act as an antenna.

The sketch is very simple, all the real action is in the function setFrequency(). 

In the 'loop' the analog reading from the pot is converted into the frequency range and then rounded to 1 decimal place, to make it easier to tune.

The output from the module requires amplification. An iPod dock with aux-in will work fine and I was surprised at the quality of the sound, given the price.

For a similar but more advanced project have a look at: http://www.electronicsblog.net/arduino-fm-receiver-with-tea5767/ I found this very useful when making this project.

#include <Wire.h>

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

unsigned int frequencyB;
double frequency = 0;

void setup()
{
  Wire.begin();
  frequency = 93.0; //starting frequency
  setFrequency();
  Serial.begin(9600);
}

void loop()
{
  int reading = analogRead(0);
  //frequency = map((float)reading, 0.0, 1024.0, 87.5, 108.0);
  
  frequency = ((double)reading * (108.0 - 87.5)) / 1024.0 + 87.5;
  frequency = ((int)(frequency * 10)) / 10.0;
  
  setFrequency();
  Serial.println(frequency);
}

void setFrequency()
{
  frequencyB = 4 * (frequency * 1000000 + 225000) / 32768;
  frequencyH = frequencyB >> 8;
  frequencyL = frequencyB & 0XFF;
  delay(100);
  Wire.beginTransmission(0x60);
  Wire.write(frequencyH);
  Wire.write(frequencyL);
  Wire.write(0xB0);
  Wire.write(0x10);
  Wire.write((byte)0x00);
  Wire.endTransmission();
  delay(100);  
}



About the Author
These are my books. Click on the image below to find out more about them.




                                                                                                                  

5 comments:

go hye jo fans said...

sir can you give me a code to enable stereo of tea5767? my radio cant't detect stereo from radio station. it always show mono on display. i guess my tea5767 set mono as default output. i want to set stereo enabled but dont know how.. iam newbie. thank you sir for your help, best regards

go hye jo fans said...

sir can you give me a code to enable stereo of tea5767? my radio cant't detect stereo from radio station. it always show mono on display. i guess my tea5767 set mono as default output. i want to set stereo enabled but dont know how.. iam newbie. thank you sir for your help, best regards

go hye jo fans said...

sir can you give me a code to enable stereo of tea5767? my radio cant't detect stereo from radio station. it always show mono on display. i guess my tea5767 set mono as default output. i want to set stereo enabled but dont know how.. iam newbie. thank you sir for your help, best regards

aldo said...

Hi Dr. Monk :)
I am working on a school project that requires an alert to be triggered when a set frequency is lost and it goes to static after 5 seconds or so.

For instance...
If I have a separate transmitter sending an FM Signal at say FM 97.1 and that transmitter fails, this receiver would pick up on that failure and trigger an alert.

Would that be possible with this? How would you say I get this to do that?

Thanks in advance.
-Aldo

aldo said...



Hi Dr. Monk :)
I am working on a school project that requires an alert to be triggered when a set frequency is lost and it goes to static after 5 seconds or so.

For instance...
If I have a separate transmitter sending an FM Signal at say FM 97.1 and that transmitter fails, this receiver would pick up on that failure and trigger an alert.

Would that be possible with this? How would you say I get this to do that?

Thanks in advance.
-Aldo