ThisCalculator

Everyday

TEA5767 FM Radio with ILI9341 TFT and ESP32: Build Guide

Updated · Standard formula, shown below

Frequency after step 87.60 MHz
Start frequency
87.5 MHz
You entered
Step size
0.1 MHz
You entered

TEA5767 FM Radio with ILI9341 TFT and ESP32: Build Guide

This article explains how to build a standalone FM radio receiver using a TEA5767 module, an ILI9341 TFT display, and an ESP32 microcontroller. You’ll learn the wiring, code structure, and common pitfalls so you can assemble a working radio that shows frequency, volume, and signal information on a color screen.

Background: Why These Three Components?

The TEA5767 is a low-cost, low-power FM stereo radio chip from NXP (originally Philips). It communicates over I2C and requires only a handful of external components. The ILI9341 is a 240×320 pixel TFT LCD controller that supports SPI or parallel interfaces, making it ideal for displaying a simple radio UI. The ESP32 is a dual-core microcontroller with built-in Wi-Fi and Bluetooth, but for this project you only need its I2C and SPI peripherals, plus 3.3V logic levels that match both the radio and the display.

This combination is popular among hobbyists because it produces a self-contained radio with a graphical interface, without needing a phone or computer. You can add presets, a volume bar, or even a spectrum analyzer if you connect an audio input.

How the TEA5767 Works

The TEA5767 is a complete FM receiver front-end. It takes the antenna signal, mixes it down to an intermediate frequency, demodulates it, and outputs stereo audio via left and right channels. It also provides a digital signal strength indicator (RSSI) and a stereo/mono flag. The chip is controlled via I2C at addresses 0x60 (write) and 0x61 (read). You send a 5-byte command to set the frequency, mute, or search mode, and you read 5 bytes back to get status.

The frequency is set by a 14-bit word: freq = (4 * (frequency_in_MHz * 1,000,000 + 225,000)) / 32,768. For example, to tune to 100.0 MHz, you compute (4 * 100,225,000) / 32,768 = 12,238 (rounded). That value is split into two bytes. The chip also needs a 7.6 MHz crystal, which is already on most breakout boards.

Wiring the ESP32 to the TEA5767 and ILI9341

Here is a typical wiring table. Use the ESP32’s default I2C pins (GPIO 21 for SDA, GPIO 22 for SCL) and default SPI pins (GPIO 18 for SCK, GPIO 19 for MISO, GPIO 23 for MOSI, GPIO 5 for CS, GPIO 17 for DC, GPIO 16 for RST).

  • ESP32 3.3V → TEA5767 VCC and ILI9341 VCC
  • ESP32 GND → TEA5767 GND and ILI9341 GND
  • GPIO 21 (SDA) → TEA5767 SDA
  • GPIO 22 (SCL) → TEA5767 SCL
  • GPIO 18 (SCK) → ILI9341 SCK
  • GPIO 23 (MOSI) → ILI9341 SDI (MOSI)
  • GPIO 5 (CS) → ILI9341 CS
  • GPIO 17 (DC) → ILI9341 DC
  • GPIO 16 (RST) → ILI9341 RST

Do not connect the TEA5767 to 5V unless the module has an onboard regulator. Most breakout boards are 3.3V only. Also, the ILI9341 backlight LED pin (usually LED or BLK) should go through a 100-ohm resistor to 3.3V, or to a GPIO for brightness control.

Code Structure and Key Functions

You will need two libraries: Adafruit_ILI9341 and Adafruit_GFX for the display, and a TEA5767 library such as TEA5767 by Matthias Hertel. The ESP32 core includes the Wire library for I2C.

The main loop does three things: read the rotary encoder or buttons, update the TEA5767 frequency, and redraw the display. Here is a minimal pseudo-code outline:

  1. Initialize I2C and SPI, then initialize the TEA5767 with the I2C address.
  2. Initialize the display with rotation, and draw a static background (title, frequency label, volume bar).
  3. In the loop, check if the encoder has turned. If yes, increment or decrement the frequency by the step (e.g., 0.1 MHz).
  4. Call radio.set_frequency(freq) to send the I2C command.
  5. Read the status with radio.read_status() to get RSSI and stereo flag.
  6. Update the display: show the frequency as a large number, draw a small bar for signal strength, and show “STEREO� or “MONO�.

For volume, the TEA5767 has no digital volume control; you must use an external potentiometer or a digital potentiometer. Many builds use a rotary encoder with a push button to mute, and a separate analog pot for volume.

Choosing the Right Display and Module

Not all ILI9341 modules are identical. Some have a touch screen (XPT2046) which you can ignore, but the pinout may differ. Check the back of the module for labels. For the TEA5767, there are two common breakout boards: one with a 3.5mm headphone jack and one with bare pins. Both work the same, but the headphone jack version includes an audio amplifier (usually a small class-AB amp) that can drive headphones directly.

If you want a larger display, you can use an ILI9488 (480×320) but the code will need different initialization. For this project, a 2.4-inch ILI9341 is the sweet spot because it is cheap, well-documented, and has plenty of resolution for a radio UI.

Common Problems and How to Fix Them

  • No audio or very low volume: Check the antenna. The TEA5767 needs a 30-75 cm wire soldered to the ANT pin. Also, ensure the headphone ground is common with the module ground.
  • I2C communication fails: The TEA5767 address is 0x60 for write, but the Wire library uses 7-bit addresses, so you should use 0x60 (the 8-bit address with the R/W bit is 0xC0). If you use 0x30, it won’t work. Double-check your wiring and pull-up resistors (usually 4.7kΩ to 3.3V).
  • Display shows garbage or white screen: The ILI9341 requires a reset pulse. Make sure the RST pin is connected and that you call tft.begin() after a delay. Also, verify the SPI frequency is not too high (try 40 MHz or lower).
  • Frequency changes but no station found: The TEA5767 has a search mode that stops at strong stations. If you use manual tuning, you may land on a weak signal. Also, the frequency calculation must be integer math; floating point may cause rounding errors.
  • Audio is noisy or distorted: The TEA5767 output is about 100 mV, so you need an amplifier. If you use the headphone jack module, it should be fine. If you use a bare module, connect the output to a PAM8403 or similar amp.

Safety and Power Considerations

The ESP32 can draw up to 500 mA during Wi-Fi transmission, but in this project Wi-Fi is off, so the current is around 50-100 mA. The TEA5767 draws about 15 mA, and the ILI9341 backlight can draw 50-100 mA depending on brightness. A USB power bank or a 5V 1A adapter is sufficient. Do not power the ESP32 from the 3.3V pin on an Arduino, as that regulator may not handle the current.

When soldering, avoid touching the crystal on the TEA5767 with the iron for more than a second; it can crack. Also, the antenna wire should be kept away from the I2C lines to reduce noise.

Alternatives and Upgrades

If you want better audio quality, consider the Si4703 or Si4735 chips, which also support AM and weather band. They are I2C compatible but have different command sets. For a simpler display, you could use a Nokia 5110 LCD, but the ILI9341 gives a much richer interface.

You can also add an RDS decoder (Radio Data System) to show station names and song titles. The TEA5767 does not support RDS; you would need a Si4703 or a separate RDS decoder chip. Another upgrade is to use a rotary encoder with a push button to switch between presets, or to add a microSD card slot to log listening habits.

Frequently Asked Questions

Can I use a 5V Arduino instead of an ESP32? Yes, but you must use level shifters for the I2C and SPI lines, because the TEA5767 and ILI9341 are 3.3V logic. The ESP32 is easier because it is natively 3.3V.

Do I need an antenna? Yes, the TEA5767 has an internal RF amplifier but it requires an external antenna. A simple wire of 30-75 cm works well. For better reception, use a telescopic antenna or a quarter-wave monopole (about 75 cm for 100 MHz).

How do I control volume? The TEA5767 has no volume register. You need an external analog potentiometer connected to the audio amplifier’s volume pin, or use a digital potentiometer (like MCP4131) controlled by the ESP32.

Can I play the audio through the ESP32’s DAC? No, the ESP32 has a DAC but it is not designed for FM radio audio; you would need to sample the analog signal, which is complex. Use the TEA5767’s audio output directly to an amplifier.

Why is the frequency not exact? The TEA5767 uses a 32.768 kHz crystal, and the frequency calculation involves rounding. The error is usually less than 0.05 MHz, which is acceptable for FM. If you need exact frequency, you can calibrate by adjusting the crystal trimmer capacitor, but most modules don’t have one.

Can I use the ESP32’s touch pins for buttons? Yes, the ESP32 has capacitive touch sensors on GPIO 4, 15, 27, etc. You can use them to make touch buttons for tuning, but they are less reliable than a physical button.

Related

Formula used
in freq | Start frequency | MHz | 87.5 | 0
in step | Step size | MHz | 0.1 | 0
out f | Frequency after step | MHz | freq + step | 2

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.