TEA5767 FM Radio Module Features
The TEA5767 module is an FM radio receiver that can be connected to a microcontroller using the I2C protocol to search for radio stations. This module has a headphone output.
You can download the TEA5767 FM Radio Module datasheet here.
TEA5767 FM Radio Module Datasheet
1 file(s) 200.43 KB
TEA5767 FM Radio Module Pinout
This Module has 4 pins:
- VCC: Module power supply – 5 V
- GND: Ground
- SLC: Synchronization for I2C protocol
- SDA: Data for I2C protocol
You can see pinout of this module in the following image.
Required Materials
Hardware Components
Software Apps
Interfacing TEA5767 FM Radio Module with Arduino
Step 1: Circuit
Connect the module to Arduino according to the following image.
Note
To receive signal, you should connect a headphone or antenna to the antenna jack.
Step 2: Installing Library
Install following library on your Arduino board.
Suggested Reading
If you need more help with installing a library on Arduino, read this tutorial: How to Install an Arduino Library
Step 3: Code
Upload the following code to Arduino.
/*
modified on Sep 7, 2020
by big12boy Examples from https://github.com/big12boy/TEA5767.git
Home
*/
#include <TEA5767.h>
TEA5767 radio = TEA5767();
//User changeable
short minlvl = 14; //Required Signal Level (0-5=unuseable, 6-9=poor, 10-12=good, 13-14=really good, 15=excellent)
long baud = 250000; //Baudrate of the Serial Interface
//---------------
void setup() {
Serial.begin(baud); //Initialize Serial Connection
radio.init(minlvl); //Initialize needed Features and search for Stations
//Print the result
Serial.print("Found ");
Serial.print(radio.getStations()); //Get Number of Stations from Library
Serial.println(" Station(s):");
Serial.println();
//Print all available Stations
listStations();
Serial.println("Send something to change to the next Station!");
}
void loop() {
//Wait for User Input
if(Serial.available()){
radio.nextStation(); //Switch to next Station
delay(50); //Wait for the Signal to stabilize
printStation(); //Print Station Details
while(Serial.available())Serial.read(); //Clear the Serial Buffer
}
}
void listStations(){
short stations = radio.getStations(); //Get available Stations
for(short i = 0; i < stations; i++){ //Go through all Stations
delay(50); //Wait for the Signal to stabilize
printStation(); //Print Details
radio.nextStation(); //Jump to the next Station
}
Serial.println("----------------------"); //Finish of the List
}
void printStation(){
Serial.print("Frequency: ");
Serial.println(radio.getFrequency()); //Print current Frequency
Serial.print("Signallevel: ");
Serial.println(radio.getSignalLevel()); //Print current Signal Level (0-15)
Serial.println();
}
After running the code, you will see the following image in the serial output.
Comments (4)
This is what happened here:
Arduino: 1.8.19 (Windows 10), Board: “Arduino Uno WiFi”
C:\Users\XXXXXX\Documents\Arduino\sketch_apr02b\sketch_apr02b.ino: In function ‘void setup()’:
sketch_apr02b:17:3: error: ‘radio’ was not declared in this scope
radio.init(minlvl); //Initialize needed Features and search for Stations
^~~~~
C:\Users\XXXXXX\Documents\Arduino\sketch_apr02b\sketch_apr02b.ino:17:3: note: suggested alternative: ‘random’
radio.init(minlvl); //Initialize needed Features and search for Stations
^~~~~
random
C:\Users\XXXXXX\Documents\Arduino\sketch_apr02b\sketch_apr02b.ino: In function ‘void loop()’:
sketch_apr02b:34:5: error: ‘radio’ was not declared in this scope
radio.nextStation(); //Switch to next Station
^~~~~
C:\Users\XXXXXX\Documents\Arduino\sketch_apr02b\sketch_apr02b.ino:34:5: note: suggested alternative: ‘random’
radio.nextStation(); //Switch to next Station
^~~~~
random
C:\Users\XXXXXX\Documents\Arduino\sketch_apr02b\sketch_apr02b.ino: In function ‘void listStations()’:
sketch_apr02b:44:20: error: ‘radio’ was not declared in this scope
short stations = radio.getStations(); //Get available Stations
^~~~~
C:\Users\XXXXXX\Documents\Arduino\sketch_apr02b\sketch_apr02b.ino:44:20: note: suggested alternative: ‘random’
short stations = radio.getStations(); //Get available Stations
^~~~~
random
C:\Users\XXXXXX\Documents\Arduino\sketch_apr02b\sketch_apr02b.ino: In function ‘void printStation()’:
sketch_apr02b:55:18: error: ‘radio’ was not declared in this scope
Serial.println(radio.getFrequency()); //Print current Frequency
^~~~~
C:\Users\XXXXXX\Documents\Arduino\sketch_apr02b\sketch_apr02b.ino:55:18: note: suggested alternative: ‘random’
Serial.println(radio.getFrequency()); //Print current Frequency
^~~~~
random
exit status 1
‘radio’ was not declared in this scope
This report would have more information with
“Show verbose output during compilation”
option enabled in File -> Preferences.
I tried many different codes for TEA5767. This was the most “friendly” code output I got.
I am not a programmer, I thought that it would be easier, honestly.
Hi,
There was somethiong wrong with the code. It’s now updated.
This is the error I get 🙁
C:\Users\USER\OneDrive\Documents\Arduino\TEA5767_test\TEA5767_test.ino: In function ‘void setup()’:
TEA5767_test:18:20: error: no matching function for call to ‘TEA5767::init(short int&)’
radio.init(minlvl); //Initialize needed Features and search for Stations
^
In file included from C:\Users\USER\OneDrive\Documents\Arduino\TEA5767_test\TEA5767_test.ino:7:0:
C:\Users\USER\OneDrive\Documents\Arduino\libraries\Radio\src/TEA5767.h:37:10: note: candidate: virtual bool TEA5767::init()
bool init(); // initialize library and the chip.
^~~~
C:\Users\USER\OneDrive\Documents\Arduino\libraries\Radio\src/TEA5767.h:37:10: note: candidate expects 0 arguments, 1 provided
TEA5767_test:22:22: error: ‘class TEA5767’ has no member named ‘getStations’; did you mean ‘getRadioInfo’?
Serial.print(radio.getStations()); //Get Number of Stations from Library
^~~~~~~~~~~
getRadioInfo
C:\Users\USER\OneDrive\Documents\Arduino\TEA5767_test\TEA5767_test.ino: In function ‘void loop()’:
TEA5767_test:35:11: error: ‘class TEA5767’ has no member named ‘nextStation’
radio.nextStation(); //Switch to next Station
^~~~~~~~~~~
C:\Users\USER\OneDrive\Documents\Arduino\TEA5767_test\TEA5767_test.ino: In function ‘void listStations()’:
TEA5767_test:45:26: error: ‘class TEA5767’ has no member named ‘getStations’; did you mean ‘getRadioInfo’?
short stations = radio.getStations(); //Get available Stations
^~~~~~~~~~~
getRadioInfo
TEA5767_test:49:11: error: ‘class TEA5767’ has no member named ‘nextStation’
radio.nextStation(); //Jump to the next Station
^~~~~~~~~~~
C:\Users\USER\OneDrive\Documents\Arduino\TEA5767_test\TEA5767_test.ino: In function ‘void printStation()’:
TEA5767_test:58:24: error: ‘class TEA5767’ has no member named ‘getSignalLevel’
Serial.println(radio.getSignalLevel()); //Print current Signal Level (0-15)
^~~~~~~~~~~~~~
exit status 1
no matching function for call to ‘TEA5767::init(short int&)’
This report would have more information with
“Show verbose output during compilation”
option enabled in File -> Preferences.
This is the error I get
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_685177\sketch_oct05a.ino: In function ‘void setup()’:
sketch_oct05a:18:20: error: no matching function for call to ‘TEA5767::init(short int&)’
radio.init(minlvl); //Initialize needed Features and search for Stations
^
In file included from C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_685177\sketch_oct05a.ino:7:0:
C:\Users\USER\OneDrive\Documents\Arduino\libraries\Radio\src/TEA5767.h:37:10: note: candidate: virtual bool TEA5767::init()
bool init(); // initialize library and the chip.
^~~~
C:\Users\USER\OneDrive\Documents\Arduino\libraries\Radio\src/TEA5767.h:37:10: note: candidate expects 0 arguments, 1 provided
sketch_oct05a:22:22: error: ‘class TEA5767’ has no member named ‘getStations’; did you mean ‘getRadioInfo’?
Serial.print(radio.getStations()); //Get Number of Stations from Library
^~~~~~~~~~~
getRadioInfo
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_685177\sketch_oct05a.ino: In function ‘void loop()’:
sketch_oct05a:35:11: error: ‘class TEA5767’ has no member named ‘nextStation’
radio.nextStation(); //Switch to next Station
^~~~~~~~~~~
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_685177\sketch_oct05a.ino: In function ‘void listStations()’:
sketch_oct05a:45:26: error: ‘class TEA5767’ has no member named ‘getStations’; did you mean ‘getRadioInfo’?
short stations = radio.getStations(); //Get available Stations
^~~~~~~~~~~
getRadioInfo
sketch_oct05a:49:11: error: ‘class TEA5767’ has no member named ‘nextStation’
radio.nextStation(); //Jump to the next Station
^~~~~~~~~~~
C:\Users\USER\AppData\Local\Temp\arduino_modified_sketch_685177\sketch_oct05a.ino: In function ‘void printStation()’:
sketch_oct05a:58:24: error: ‘class TEA5767’ has no member named ‘getSignalLevel’
Serial.println(radio.getSignalLevel()); //Print current Signal Level (0-15)
^~~~~~~~~~~~~~
exit status 1
no matching function for call to ‘TEA5767::init(short int&)’
This report would have more information with
“Show verbose output during compilation”
option enabled in File -> Preferences.