Bluetooth Speaker With Audio Visualizer
190 Views, 0 Favorites, 0 Comments
Bluetooth Speaker With Audio Visualizer
This is a Bluetooth Speaker with an LED matrix display used as an audio visualizer. This was done as a final project for ECET 380 at Purdue University. Here is a demo video.
The speaker utilizes an ESP-32 and a custom PCB to handle Bluetooth communication and the audio output to the speaker as well as control and power for the LEDs.
Originally this project was more ambitious than it turned out to be and is missing a few features that the PCB was designed for. Initially we intended to use a PCM3060 audio codec to generate higher quality audio, a filtering network with potentiometer control to act as an audio equalizer, and an LCD to display the currently playing song. None of these additional features turned out to work due to the degraded audio quality caused by op-amps operating on a single supply in the filtering network. The poor audio quality from the filtering network caused us to shift around the IO to output audio through the on board DACs of the ESP-32, which made the LCD unusable as a by product. To fix this issue is as simple as reworking the PCB design to include a switched capacitive voltage regulator to provide -5V to the op-amps, and removing the DC biasing resistors in the equalizer circuit. Unfortunately due to project deadlines we did not have the time to order another PCB and thus had to make do.
Supplies
Materials:
- 5V 5A Positive Tip Barrel Jack Power Supply
- 8x32 LED Matrix
- 3.5mm Jack Speaker With USB Power
- Solder and Flux
- Micro-USB cable
- Tape
- Printer Paper
- Shoe Box
- 22 AWG wire
- ESP-32 Recommend the 3-Pack
- Various Components for the PCB
- The PCB (We recommend using JLCPCB for manufacturing, the Gerbers ZIP file on the GitHub is ready to upload to JLCPCB for manufacturing)
Tools/Software:
- KiCad (If you want to view or edit the PCB files)
- Soldering Iron
- Wire Strippers
- Wire Cutters
- Tweezers
- ESP-IDF
- VSCode
- Small flathead screwdriver
Solder Components Onto the PCB
- Soldering tutorials are readily available online for 0402 component soldering, TSSOP soldering, and through hole soldering.
- When soldering we recommend soldering all of the smallest components such as the 0402 package resistors and capacitors first. Be careful not to send them flying when picking them up with tweezers as they are impossible to find once you lose sight of them.
- Then move onto larger SMT components such as the audio codec and op-amp ICs. We recommend using copious amounts of flux when soldering these components to avoid solder bridges.
- Finally solder the through hole components such as the connectors and the ESP-32.
Fixing the PCB
To fix the PCB we must do two things:
- Remove the capacitor labelled C8 from the board
- Add a jumper wire from the header labelled VO to the pad on the right side of capacitor C8 which was just removed
- A visual representation of this jumper wire is shown in the picture above
Solder Wires to LEDs
- Solder two lengths of 22 AWG wire to the +5V and GND terminals of the LEDs. These are the two wires seen in the middle of picture #1 above. We are replacing the wires that come with the LEDs with longer wires to fit our requirements.
- Splice dupont wires onto the LED data wires as shown in picture #2
- Be sure to add tape or heat shrink to the spliced wires to avoid shorts! We recommend heat shrink with electrical tape as a second option. Although we used scotch tape as it was what we had on hand.
Build and Assemble Enclosure
- Cut a hole in the back of your shoe box for the power supply cable, as shown in picture #1 above.
- Cut a hole in the top left front corner of the shoe box for the LED wires to feed through, as shown in picture #2 above.
- Tape the LEDs to the front of the shoe box. as seen in the picture in the introduction.
- Then tape printer paper over the front of the shoe box, also as shown in the picture in the introduction.
Install ESP-IDF and an IDE
- We recommend the ESP-IDF programming guide documentation for installation and setup
- We recommend VSCode as the development environment but any modern IDE should do
Clone Our Github Repository
To get all of the project files and code clone our GitHub repository. Instructions on how to do so are available in the GitHub documentation.
Change Speaker Name (Optional)
In the Bluetooth Speaker folder we cloned from GitHub open the main folder and then in the main.c file you can alter line 31 to change the name that appears when you connect to the speaker through Bluetooth.
Change LED Colors (Optional)
Just like in Step 7, if we go to the Bluetooth Speaker folder that was cloned from GitHub, open the components folder, then the leds folder and then in the leds.c you can alter the array shown in the picture above from line 29 to 61 to change the colors used in the LED array. These seemingly arbitrary values are the RGB values of the LED matrix. We recommend using a google RGB color picker to find values if you choose to change them.
Upload the Code
- Open the esp-idf command line
- cd into the Bluetooth speaker directory cloned from GitHub
- follow this ESP-IDF guide starting from the connect section
Wire Things Up
- Run the power supply cable through the hole in the back of the shoe box
- Connect the power supply to the barrel jack on the PCB board
- Run the wires from the LEDs through the front hole into the shoe box
- Connect the three data line wires to the data line headers accordingly, they are labelled on the LEDs and on the PCB
- Connect the two LED power wires to the PCB by screwing them into the screw clamp terminals
- Then run the 3.5mm jack cable from the speaker through the front hole in the shoe box and connect it to the 3.5mm jack on the PCB
- Finally connect the USB from the speaker to a USB port for power and plug the power supply into the wall