NoiseBlaster 32

A custom music player that utilizes the PIC32MX microcontroller and a TI headphone amp/DAC to play up to 512 WAV files from an SD Card

Source Code Link: https://github.com/andrade824/NoiseBlaster32

The NoiseBlaster was developed as a joint project between Alex Lao and myself during our free time after work while interning at Altera. Our goal was to design a music player from the ground up: from PCB design to firmware. In the span of only a month, we were able to accomplish this goal. The final product can play up to 512 audio files stored on an SD Card and has next/previous, play/pause, and volume up/down controls.

Hardware Design

The PCB was designed using Altium Designer. We chose to use the PIC32MX270 because it contains an audio I2S (inter-inter sound) interface, was available in an easy-to-solder SOIC package, and we both had previous experience with the PIC32MX microcontroller series. To handle audio output, we chose the TI TLV320DAC23 for both digital to analog conversion and headphone amplification. This chip takes in audio data over I2S and outputs the amplified analog audio signals. It also contains an I2C interface for control purposes (changing volume and initialization). Special care was taken to minimize the noise on the audio lines in terms of the PCB design (carefully placed capacitors and ground fills).

To make this design as portable as possible, we also designed in a LiPo battery charging circuit (with a micro-USB port for charging and power purposes). A reset circuit is also included to make sure the components on the board don't get damaged or operate in a battery under-voltage situation.

Firmware Design

The firmware consists of reading WAV files off of a FAT formatted SD card, decoding the audio data, and sending the data to the DAC over I2S. It also initializes all of the hardware components on the board (DAC, SD card, etc.) and uses interrupt-driven I/O for the control buttons (next/previous, play/pause, and volume up/down controls).A layered approach was taken to creating the firmware. Instead of creating one large chunk of code that read from the SD card and decoded data, we wrote separate drivers for SPI, SD Card I/O, reading files from FAT, and decoding WAV audio. Each of these layers works with the layer above and below it to get data from SD Card to DAC. This allowed us to split the work and debug our code far more easily than if we took a monolithic approach.

After stress testing how fast we could run the SPI signals to the SD Card, we found that we had more than enough bandwidth to play 16-bit WAV audio files recorded at a 44.1KHz sample rate. One of our biggest worries was that we wouldn't be able to read from the SD Card (and FAT filesystem in row) fast enough to play the audio data without skipping. When we created the drivers for the SD card and FAT filesystem, we designed everything around 512-byte chunks. This is because a single sector within the SD card is 512 bytes and it's far faster to read data on sector boundaries than not. We also utilized the DMA within the PIC32 to transfer data between the SPI and I2C modules without CPU intervention. That design coupled with designing our PCB so that we could run 20MHz SPI signals without any significant noise allowed us to play back audio at the standard sample rate of 44.1KHz.

The finished PCB design

The final hand-soldered board!