Building the BlueBox, an ESP32 Powered Bluetooth Speaker

What could possibly be more enjoyable than chilling, listening to your favourite music being played on a well-engineered Bluetooth speaker? Well for most people, spending countless hours, way too much money and pulling out your own hair in frustration just to get to hear some slightly better than sh*t sounding music from your very own Bluetooth speaker doesn’t sound enjoyable. This is the story of how I did exactly that.

Where It All Started

Since then I worked on a few electronics projects with varying degrees of success but nothing I could write home about. After moving abroad and spending 2 years in lockdown I found myself without any tools and longing to work on something electronics-related. I took a final look through the box of goodies that I had brought over with me and found that I still had an ESP32, 2 breadboards, and an I2S DAC chip that I had soldered to a DIP adapter a few years back. That night I ordered a breadboard jumper kit, a SparkFun LCD module, and an amplifier chip.

The Hills Are Alive With the Sound of… Wtf Is That Sound?

The days that followed all followed the same pattern. “Take off” a little early and tinker into the late evening or early morning with each day edging closer to a working prototype. I eventually got the LCD to display some text after figuring out that I had been initializing the display all wrong. It took me almost a week to figure out that the I2S chip I had soldered to the adapter all those years back wasn’t soldered on properly. The lack of a soldering iron proved to be a little challenging but I found out that heating a butter knife on the gas stove gets it hot enough to melt solder. I also learnt that this usually leads to angry stares from the wife. All in all, it took me around 2 weeks of late-night tinkering to get a somewhat functional circuit on breadboard that I could connect to using Bluetooth and stream some music.

The first working prototype of my speaker, stuffed into a cardboard box

I should come right out and say that the sounds that came out of this first version were not something you would voluntarily listen to for extended periods. While, yes, it was the music that I was streaming that came out of the speakers, it didn’t sound very good. Turns out, breadboard is not very good for high-speed digital applications like I2S and SPI. The fast-switching digital signals capacitively couple to anything and everything. I could quite literally hear the text change on the LCD screen.

Psst… Hey Kid, Want Some PCB?

The PCB layout for my Bluetooth speaker, note this screenshot is from revision 2 of my design so it’s slightly different from the manufactured PCB

After figuring out what the hell Gerber files are and how to export them, I sent the design off to be manufactured. It was going to take 2–3 weeks for the PCB and stencil to arrive back so this gave me plenty of time to order the required components from Mouser, order a hot-air rework station and get some tools. I was going to be soldering some small SMD components and needed tweezers. The logical thing to do after spending plenty of money to make sure I ended up with quality tools was to order a set of tweezers that looked too well-priced to be true. The lesson I learned was that cheap tweezers are often plastic tweezers and plastic tweezers melt when used with a hot-air gun. Not to worry though, my wife’s eyebrow tweezers turned out to be metal and worked like a charm.

The most beautiful PCB ever, complete with matte-black solder mask
Placing the components after applying the solder paste

When the PCB finally arrived I had all the components and tools ready to start. Over the course of a whole evening, I painstakingly placed each little component and used the hot-air gun to reflow. I was definitely not elegant in this process at all. Having never worked with SMD components, yet alone a rework station, I ended up needing to do a lot of reworking. I even managed to pull the pads off the PCB while moving one of the chips. This resulted in me having to desolder everything and start on a new board, luckily I ordered 10.

It Lives!

What all does it have?

  • 16-bit stereo output @ 44.1kHz via I2S DAC
  • Dual channel, 3W class D amplifier
  • 240x240 LCD display
  • 6 push button inputs
  • Li-Po Charging & Power Circuity, i.e. can charge or run off a Li-Po
  • USB-C with 5V/1A support

What all does it do?

  • Bluetooth audio streaming
  • WiFi for syncing with NTP (doesn’t work too well with Bluetooth enabled due to RAM constraints)
  • Exposes configuration/status via BLE
  • 5-band graphic equalizer

It’s a Never-Ending Story but That’s Okay

Testing the UI while playing some music in the background, very happy with the result!

I am hoping to find time to clean up the code just enough to share on GitHub and will update the article with the link when I do.

--

--

Software engineer @ Tesla & serial tinkerer, writing about the tech things that keep me up at night.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Keagan Ladds

Software engineer @ Tesla & serial tinkerer, writing about the tech things that keep me up at night.