FM-Radio Empfänger TEA5767

TEA5767 Radio-Empfänger-Modul mit I²C-Schnittstelle

Spezifikationen laut Hersteller

"The TEA5767HN is a single-chip electronically tuned FM stereo radio for low-voltage applications with fully integrated Intermediate Frequency (IF) selectivity and demodulation. The module is based on the chip TEA5767HN, it incorporated all the necessary circuit includes power circuit, antenna, amplifier and AGC circuit."

Verwendete Bauteile

Schaltplan für den Aufbau mit Arduino, LCd und TEA5767
Abb.: Schaltplan für den Aufbau mit Arduino, LCD und TEA5767

Sketch

#include <Wire.h>
#include <LiquidCrystal.h>

#define PIN_RS 12
#define PIN_EN 11
#define PIN_D4 5
#define PIN_D5 4
#define PIN_D6 3
#define PIN_D7 2

#define PIN_BUTTON_NEXT 6
#define PIN_BUTTON_PREV 7

unsigned char search_mode = 0, frequencyH = 0, frequencyL = 0;
int b = 0, c = 0;
unsigned int frequencyB;
double frequency = 0, freq_available = 0;
LiquidCrystal lcd(PIN_RS, PIN_EN, PIN_D4, PIN_D5, PIN_D6, PIN_D7);

void setup()
{
    Wire.begin();
    lcd.begin(16, 2);

    pinMode(PIN_BUTTON_NEXT, INPUT_PULLUP);
    pinMode(PIN_BUTTON_PREV, INPUT_PULLUP);

    frequency = 87.5; //starting frequency
    frequencyB = 4 * (frequency * 1000000 + 225000) / 32768; //calculating PLL word
    frequencyH = frequencyB >> 8;
    frequencyL = frequencyB & 0XFF;

    delay(100);
    Wire.beginTransmission(0x60);   //writing TEA5767
    Wire.write(frequencyH);
    Wire.write(frequencyL);
    Wire.write(0xB0);
    Wire.write(0x10);
    Wire.write(0x00);
    Wire.endTransmission();
    delay(100);
}

void loop()
{
    unsigned char buffer[5];
    lcd.setCursor(0, 0);
    Wire.requestFrom(0x60, 5); //reading TEA5767

    if (Wire.available()) {
        for (int i = 0; i < 5; i++) {
            buffer[i] = Wire.read();
        }

        freq_available = (((buffer[0] & 0x3F) << 8) + buffer[1]) * 32768 / 4 - 225000;
        lcd.print("FM ");
        lcd.print((freq_available / 1000000));
        frequencyH = ((buffer[0] & 0x3F));
        frequencyL = buffer[1];

        if (search_mode) {
            if (buffer[0] & 0x80) search_mode = 0;
        }

        if (search_mode == 1) {
            lcd.print(" SCAN");
        } else {
            lcd.print("       ");
        }

        lcd.setCursor(0, 1);
        lcd.print("Level: ");
        lcd.print((buffer[3] >> 4));
        lcd.print("/16 ");

        if (buffer[2] & 0x80) {
            lcd.print("STEREO   ");
        } else {
            lcd.print("MONO   ");
        }
    }

    // button next
    if (!digitalRead(PIN_BUTTON_NEXT) && !b) {
        frequency = (freq_available / 1000000) + 0.05;
        frequencyB = 4 * (frequency * 1000000 + 225000) / 32768 + 1;
        frequencyH = frequencyB >> 8;
        frequencyL = frequencyB & 0XFF;

        Wire.beginTransmission(0x60);
        Wire.write(frequencyH);
        Wire.write(frequencyL);
        Wire.write(0xB0);
        Wire.write(0x1F);
        Wire.write(0x00);
        Wire.endTransmission();
        b = 100;
    }

    // scan up
    if (!digitalRead(PIN_BUTTON_NEXT) && b == 1) {
        search_mode = 1;

        Wire.beginTransmission(0x60);
        Wire.write(frequencyH + 0x40);
        Wire.write(frequencyL);
        Wire.write(0xD0);
        Wire.write(0x1F);
        Wire.write(0x00);
        Wire.endTransmission();
        b = 100;
    }

    if (!b == 0) {
        b--;
    }

    // button previous
    if (!digitalRead(PIN_BUTTON_PREV) && !c) {
        frequency = (freq_available / 1000000) - 0.05;
        frequencyB = 4 * (frequency * 1000000 + 225000) / 32768 + 1;
        frequencyH = frequencyB >> 8;
        frequencyL = frequencyB & 0XFF;

        Wire.beginTransmission(0x60);
        Wire.write(frequencyH);
        Wire.write(frequencyL);
        Wire.write(0xB0);
        Wire.write(0x1F);
        Wire.write(0x00);
        Wire.endTransmission();
        c = 100;
    }

    // scan down
    if (!digitalRead(PIN_BUTTON_PREV) && c == 1) {
        search_mode = 1;

        Wire.beginTransmission(0x60);
        Wire.write(frequencyH + 0x40);
        Wire.write(frequencyL);
        Wire.write(0x50);
        Wire.write(0x1F);
        Wire.write(0x00);
        Wire.endTransmission();

        c = 100;
    }

    if (!c == 0) {
        c--;
    }
}

Dies ist ein Sender, der unter sehr starkem Rauschen empfangen werden konnte:
(246kB)

Ob die Empfangs-Qualität durch das Modul oder andere Störungen kommt, konnte ich bisher nicht herausfinden.

Es gibt auch einige fertig Libraries zur Ansteuerung des TEA5767-Moduls, z.B. https://github.com/andykarpov/TEA5767, welche ich aber noch nicht ausprobiert habe.

zurück