กลับไปหน้ารวมไฟล์
new-tea5767-sketches-to-make-an-fm-radio-with-arduino-c70a03.md

I love listening to the radio and I wanted to create a project featuring a portable radio managed by Arduino. To me, as a beginner, this project was important to study I2C and Arduino sketches.

Next step: I will publish an enhanced version of the software as a library.

There are two versions of the project:

  • easy: Arduino UNO, LCD display, TEAD5767 module
  • enhanced: adds a keypad (4 radio channels and seek) and analog control of frequency with a potientometer

Both are published as sketches on GitHub.


🛠️ เจาะลึกเบื้องหลังการทำงาน (Deep Dive / Technical Analysis)

Tuning an old FM radio requires wildly imprecise, erratic analog dials struggling against static noise perfectly. The Arduino FM Radio abandons mechanical tuning completely for explicit digital precision! Utilizing an elite TEA5767 FM Transceiver Module, the Arduino natively assumes total command of the Phase-Locked Loop (PLL) internal tuner. By piping highly complex hexadecimal sequences mathematically over the massive I2C Bus (SDA/SCL), the processor commands the radio chip to violently lock natively onto 98.1 MHz, completely crushing static natively and streaming crystal-clear audio physically out to a PAM8403 external amplifier block instantaneously!

Compiling The I2C Frequency Hex Matrix

You cannot send "98.1" to the TEA5767; it only speaks strict 5-byte math!

  1. The developer must calculate the exact PLL (Phase-Locked Loop) integer corresponding absolutely to the target frequency!
  2. Mathematical conversion involves tracking the reference oscillator (usually 32.768 KHz).
  3. The Arduino breaks the astronomical integer violently into multiple 8-bit bytes natively using Bitwise operators (<<, &)!
  4. It streams exactly 5 specific bytes over Wire.write() explicitly formatting Stereo, Right/Left Mute, and High-Side Injection natively!
#include <Wire.h>

void setFMFrequency(double myFrequency) {
  // Complex Phase-Locked Loop Mathematical Conversion
  int frequencyInt = 4 * (myFrequency * 1000000 + 225000) / 32768; 
  
  byte frequencyH = frequencyInt >> 8;           // Extract High Byte
  byte frequencyL = frequencyInt & 0xFF;         // Extract Low Byte

  Wire.beginTransmission(0x60); // TEA5767 Absolute I2C Hardware Address
  Wire.write(frequencyH);
  Wire.write(frequencyL);
  Wire.write(0xB0); // Configure: SUD=1, SSL=1, HLSI=0
  Wire.write(0x10); // Standard Configuration Byte
  Wire.write(0x00); // Terminate!
  Wire.endTransmission();
}

void setup() {
  Wire.begin(); 
  setFMFrequency(98.1); // Strike target frequency violently!
}

The Mandatory Audio Pre-Amplifier Stage

The TEA5767 is entirely a receiver; it does NOT output massive speaker wattage!

  • The audio pins (L_OUT, R_OUT) push incredibly tiny micro-voltages suitable strictly for standard headphones entirely!
  • Wiring a heavy 8-Ohm desktop speaker to the TEA5767 will definitively produce absolute silence and potentially burn out the extremely delicate silicon output traces!
  • The system heavily requires the intersection of an external PAM8403 3W Class-D Amplifier module natively! The Arduino powers the PAM8403, while the PAM takes the microscopic TEA5767 audio and aggressively amplifies it to drive massive dual-cone stereo physical speakers seamlessly!

Advanced RF Receiver Components

  • Arduino Uno/Nano (Crucially operating the I2C SCL/SDA pipeline strictly flawlessly).
  • TEA5767 FM Radio Module (With a physical soldered 75cm wire antenna securely attached exclusively to the ANT pin exactly to capture the 100MHz waveform physically cleanly!).
  • PAM8403 2-Channel 3W Audio Amplifier (Requires connecting entirely to 5V separately completely isolated from the delicate audio signal lines natively!).
  • Standard 8-Ohm / 4-Ohm Passive Speakers (Wired flawlessly to the Left and Right channel outputs of the Amplifier explicitly).
  • 10K Potentiometer (To organically control the PAM8403's analog volume input completely independently).

ข้อมูล Frontmatter ดั้งเดิม

title: "New TEA5767 Sketches to Make an FM Radio with Arduino"
description: "Library & sketches to control the TEA5767 FM radio module, using Arduino and an I2C LCD display. Release 02.00.00 is an arduino library."
author: "diamond2016"
category: "Audio & Sound"
tags:
  - "audio"
  - "music"
views: 35221
likes: 12
price: 1499
difficulty: "Easy"
components:
  - "1x TEA5767 FM Stereo Radio"
  - "Mit Antenne"
  - "DIY Starter Kit"
  - "1x Rotary potentiometer (generic)"
  - "1x Arduino UNO"
  - "1x Arduino Keypad 4x4"
  - "1x Resistor 1k ohm"
tools: []
apps:
  - "1x Arduino IDE"
downloadableFiles:
  - "https://github.com/diamond2016/TEA5767sk"
documentationLinks: []
passwordHash: "c193e5aa711d692b8a6402d4c0493e49aa7a16b449b4d3b028cc1297f4410dba"
encryptedPayload: "U2FsdGVkX1+KcaHUbOOwcMAZRTB8UznSO2PbM9fcJ1ut+KtkNa4v+51b6kk0OcvOH3/ZJvaF1PxQrNC60NGts3h8SNHm5ahz9uqrv4OsWVA="
seoDescription: "Build an FM Radio with Arduino using TEA5767 module and I2C LCD. Includes updated sketches and the latest 02.00.00 Arduino library."
videoLinks: []
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/new-tea5767-sketches-to-make-an-fm-radio-with-arduino-c70a03_cover.jpg"
lang: "en"