Wednesday, March 13, 2013

Revisiting Projects - Microcontroller Audio Playback

This is another one of my older projects from the fall of 2010. I became very interested in playing audio using my microcontroller. This project is based upon my ATmega Butterfly board but this time I have paired it with an SD card and a lone DAC for monaural audio playback.

The final project assembled on two breadboards.
The final project assembled on two breadboards.

This project was a great learning experience for me. The first hurdle that I had to overcome was the difference in logic levels between the AVR series of microcontrollers and the SD card that I was interfacing with. I overcame this through the use of resistive voltage dividers. I didn't need extremely high speed access to the data so this worked out well.

Once I had access to mass storage, I had to prepare a DAC. I used an R/R2 network assembled on a breadboard. I buffered the output using an LM358 op-amp and fed that into a single-package audio amplifier (TDA2002).

The first iteration of firmware that I wrote was functional but had no constant sample rate and lots of glitches. I was not using a timer or any kind of audio buffer. I rewrote the firmware to include a circular buffer and modified the SD card read routines to insert into the buffer. I then used a timer configured for a sample rate of approximately 44100kHz. The results were impressive and the audio quality was quite good.

Sample Audio 


Here is some sample audio from this project.

Star Wars - Cantina Song
Dubmood and Zabutom - Supersquatting
La Caution - The a la menthe

The complete setup, with some fancy waveforms. :]
The complete setup, with some fancy waveforms. :]

No comments :

Post a Comment

Note: Only a member of this blog may post a comment.