Introduction: 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

Step 1: Solder Components Onto the PCB

  1. Soldering tutorials are readily available online for 0402 component soldering, TSSOP soldering, and through hole soldering.
  2. 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.
  3. 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.
  4. Finally solder the through hole components such as the connectors and the ESP-32.

Step 2: Fixing the PCB

To fix the PCB we must do two things:

  1. Remove the capacitor labelled C8 from the board
  2. Add a jumper wire from the header labelled VO to the pad on the right side of capacitor C8 which was just removed
  3. A visual representation of this jumper wire is shown in the picture above

Step 3: Solder Wires to LEDs

  1. 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.
  2. Splice dupont wires onto the LED data wires as shown in picture #2
  3. 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.

Step 4: Build and Assemble Enclosure

  1. Cut a hole in the back of your shoe box for the power supply cable, as shown in picture #1 above.
  2. 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.
  3. Tape the LEDs to the front of the shoe box. as seen in the picture in the introduction.
  4. Then tape printer paper over the front of the shoe box, also as shown in the picture in the introduction.

Step 5: 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

Step 6: 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.

Step 7: 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.

Step 8: 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.

Step 9: Upload the Code

  1. Open the esp-idf command line
  2. cd into the Bluetooth speaker directory cloned from GitHub
  3. follow this ESP-IDF guide starting from the connect section

Step 10: Wire Things Up

  1. Run the power supply cable through the hole in the back of the shoe box
  2. Connect the power supply to the barrel jack on the PCB board
  3. Run the wires from the LEDs through the front hole into the shoe box
  4. Connect the three data line wires to the data line headers accordingly, they are labelled on the LEDs and on the PCB
  5. Connect the two LED power wires to the PCB by screwing them into the screw clamp terminals
  6. 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
  7. Finally connect the USB from the speaker to a USB port for power and plug the power supply into the wall

Step 11: Play Music

  1. Connect to the speaker through Bluetooth
  2. Play music through your phone (Spotify is the only app that we verified to work)
  3. Here is our demo of the completed project.