Creating your own Bluetooth Speaker is a simple and fun project, which you can use around the house or in the garden, even while camping with a portable power pack.
In this guide we use an ESP32 Dev Module, along with some old USB Speakers to make our own Bluetooth Speakers.
We also use a USB Passthrough so we can power both the ESP32 Dev Module, and the speakers from a single USB Connection.
This project simply shows how this can be achieved, and it could all be permanently wired together and hidden within a speaker easily for a more permanent installation.
It could also be minimised by using a standalone ESP32 chip, and a small number of components.
We are using a set of USB Powered speakers (an old equivelant of these), which have a 3.5mm Stereo Audio Jack connector, and USB Lead for power only.
These speakers already contain an amplifier so we don't need to add an amplifier circuit to our setup here.
We used a Female Audio connector so we can plug our speakers into this easily.
It also allows us to connect it to an existing stereo system with a Male to Male Audio lead.
The ESP32 Dev Module outputs audio the same audio on GPIO25 and GPIO26, we will join the Left and Right connections on our Female Audio connector together, so we only need one pin connected on our ESP32.
You can wire up both channels to the seperate ESP32 pins GPIO25 and GPIO26, which would look like below:
We will be using the ESP32-A2DP Library which allows us to harness the Bluetooth and PWM features of the ESP32 to create our Bluetooth Audio Receiver.
The library needs to be downloaded from GitHub here, and can then be installed manually, or by using the vMicro > Add Libraries > Install from ZIP command.
Once the library is installed, the example project can be downloaded from here, and opened in Visual Micro.
If you want to customise the name of the device, this can be edited in the
setup() function on the line
a2dp_sink.start("vMicro BT Speaker");
Now we can select the ESP32 Dev Module Board, and our COM Port, and Build and Upload as normal.
Now we can connect the Audio connector to the ESP32 on GND, and on GPIO25 (and GPIO26 if you are using it).
Finally we need to power both the speakers and the ESP32 to bring the system to life.
Now you can see the Bluetooth device "vMicro BT Speaker" on your laptop or mobile phone and connect to it to begin playing music through your new device.
Now we have the basics setup, we could add an LED Indicator to show when a device is connected, or when the volume changes, or alternatively a screen.
An SD Card could also be used to play audio from locally giving all the features of a modern Bluetooth speaker, with all the customisable features you want to add.
There is a short YouTube video below which covers this guide: