ESP32 bluetooth speaker banner

ESP32 bluetooth speaker

4 devlogs
6h 0m 14s

Well its just a Bluetooth speaker built with an ESP32 microcontroller. You pair it to your phone just like a normal Bluetooth speaker, and it plays music through a small speaker using an audio amplifier. It has a TFT screen that shows the current …

Well its just a Bluetooth speaker built with an ESP32 microcontroller. You pair it to your phone just like a normal Bluetooth speaker, and it plays music through a small speaker using an audio amplifier. It has a TFT screen that shows the current content title, artist/channel, and volume level, with a scrolling effect for long titles. It also has three physical buttons so you can pause or skip tracks, plus a potentiometer to control the volume. This is only tested on Iphone so i cant guarantee it will work with every device.

This project uses AI

Help with questions, debugging and readme since i dont know alot of markdown.

Demo Repository

Loading README...

Whatsup

Shipped this project!

Hours: 6.0
Cookies: 🍪 133
Multiplier: 22.17 cookies/hr

I got some new Mini speakers, amplifier and a tft screen and i wanted to make a project where i can learn to use these. I decided on a bluetooth speaker. This project was a lot of fun to make and i was so happy its working well. Hope you like it. loveparrot

Whatsup

Readme

Well the project is done. This is just a readme. parrotintensifies

Attachment
0
Whatsup

Multimedia & UI

Visual Interface

I added a 1.8” TFT SPI display using the ESP32 VSPI hardware bus. Optimizing it brought up a few problems:

FreeRTOS Multithreading Collision:

  • Updating the TFT directly inside Bluetooth callbacks caused SPI bus collisions, locking up the hardware and making buttons unresponsive.
  • Fix: I decoupled the UI rendering. The callbacks now just set volatile bool flags, which the main loop() checks to safely draw updates without blocking audio processing.

SPI Bottleneck + Flickering:

  • Calling tft.fillScreen() pushed over 1.2 million bits per update, causing alot flickering and latency.
  • Fix: I replaced full screen clears with bounded box redraws (tft.fillRect) to only erase and update the changed pixels.

Metadata

AVRCP Bridge:

  • Used set_avrc_metadata_callback to fetch track duration, artist, and title from the phone.

Volume & Playback UI

Marquee for long titles:

  • Titles over 23 characters wrapped onto other UI elements, looking ugly.
  • Fix: Disabled text wrapping and added a millis() scrolling effect for long titles.

Volume Bar:

  • Added a bottom bar displaying potentiometer position and volume %.
    Playback Icons:
  • The play/pause icon updates based on a2dp_sink.get_audio_state().

Optimistic UI:

  • Pressing Play/Pause had a big visual delay while waiting for the phones Bluetooth confirmation.
  • Fix: The ESP32 now locally fakes the audio state and redraws the icon instantly, while handling the actual command in the background.

Content Duration:

  • Track duration may not work as expected because some phones dont send it.

Libraries

Adafruit ST7735 and ST7789:

  • Hardware driver for the 1.8” TFT.

Adafruit GFX:

  • Graphics library used to draw the UI.

Hardware Pinout (ST7735)

  • CS -> Pin 5
  • DC (A0) -> Pin 2
  • RST -> Pin 4
  • SCK -> Pin 18 (VSPI)
  • MOSI (SDA) -> Pin 23 (VSPI)
1

Comments

Whatsup
Whatsup about 1 month ago

Bruh devlogs should be a part of the optimization sidequest cuz you dont know how much i had to “optimize” this to meet the 2000 character limit lol grr

Whatsup

Playback controls and adjustable volume

Basically i added playback control to play the next/previous song or stop/play it aswell as adjustable volume with a potentiometer. I also added Led to blink when its not conneted to bluetooth, and turn off when it is. Also why its cramped is because the other side of the ESP is reserved for the display which will come next.

Also ehh button fell off in the video noo sob-wx.

I changed some wiring around so heres a new wiring overview:

Wiring:

Amplifier:

  • LRC -> Pin 26
  • BCLK -> Pin 27
  • DIN -> Pin 14

Playback and volume:

  • Next btn -> Pin 25
  • Prev btn -> Pin 32
  • Play btn -> Pin 33
  • Potentiometer -> Pin 34

Led:

  • Blue LED -> Pin 13

Problem with potentiometer:

  • The potentiometer was super jittery with values all over the place. Now normally a capacitor can be an easy fix, but i dont have one pf.
  • I opted for a fix in the code by just getting a 64 sample average which just adds up 64 readings and divides by 64 to get one value.
0
Whatsup

Esp32 bluetooth speaker setup and test

I had coded previously on this project but i lost the code as i didnt upload it to github. I started again now from scratch so thats why the time is 1 hour.

Basically wired the components and configurated the esp32 using Arduino with PlatformIO on VScode.

The program can connect to bluetooth and play content.

One issue i had when compiling and uploading to the esp, was that the program was too big so i had to include a .csv file with partition table as the default one limits size.

Components:

  • Esp 32 Devkit V1
  • Max98257A
  • Cheap 8ohm 3W mini speaker

Wiring:

  • 5V rail -> Amplifier VIN
  • Common GND between the amplifier and the ESP
  • LRC -> Pin 14
  • BCLK -> Pin 27
  • DIN -> Pin 26
  • Speaker to +- terminal on the Amplifier

Libraries:

  • Arduino-audio-tools
  • ESP32-A2DP
0