Airpods like True Wireless Speaker bluetooth experiment on ESP32 Proto

I was wondering how my wireless AirPods earbuds clones were able to achieve a truly wireless stereo (TWS) experience in both the left and right ear with only a single classic Bluetooth audio connection (A2DP) to my phone. To satisfy my curiosity, I decided to create a prototype using two ESP32 Proto boards. Here’s how it works:

First, connect to the left ESP32 as a standard Bluetooth device. The left device will then transmit the right channel data to the right ESP32 using the ESP-NOW protocol, which offers the advantage of very low latency. After a predetermined duration, the left and right devices will play their respective audio samples synchronously, continuing this process until the next sample.

We managed to make it work using our Muse Proto board, as this board features a built-in 3W amplifier with speaker and battery support. If you are eager to try it out without having to compile the code yourself, it is available for download. Simply use a Chrome browser to visit our app store, select “Proto - TWS,” and you’ll be good to go. Note that you will need two Proto boards, one for the left and one for the right:

You can find the source code here on GitHub. While it was specifically designed for the Proto board, it should be relatively straightforward to adapt it for use with other boards that support audio.

Just a quick reminder: this setup is a personal experiment of mine and not a commercial product. We only spent a few hours on it. The code, particularly in regards to managing the audio buffers, is still very much a work in progress. While it’s an exciting start and a lot of fun to play with, please manage your expectations as the range is limited to just a few meters, and sometimes data loss can result in audio cuts. With additional time and effort spent on improving the code, this could potentially be used as a serverless wireless stereo system in a living room, eliminating the need for unsightly audio cables strewn about between speakers.