- Written by Ravi Pujar on
- Published: 20 January 2013
Adding audio playback to a microcontroller circuit can be accomplished using either of two options,
Option #1 is a low cost, low audio quality option
Option #2 is available only in high end controllers and could not be economical.
Options #1. : Playing audio using an external audio/sound playback device
You can easily play audio in your project using an external sound recorder and playback device like APR9600/APR33A3 audio chipsets. These chips can record audio for a few seconds and play that audio when you press the play button. The record and play control functions are controlled by microcontroller IO pins. These chips have inbuilt pre-amplifier, so that you can connect the microphone directly to the chips input pin. And also come with inbuilt output audio amplifier, so that you can directly connect an speaker to the audio output of APR9600 chip. The recording time is limited to a few seconds, APR33A3 provides an increased recording time of 680 seconds compared to the predecessor APR9600.
Option #2. : Playing audio from an microcontroller with inbuilt I2S interface
Another option is to use a microcontroller with I2S interface. I2S also termed "Inter IC sound" interface is the standard serial interface protocol for transferring audio data between chips. The RAW/PCM audio data can be stored inside the microcontroller memory(if audio clip is small) and sent out on the I2S port of the controller to an audio DAC. The I2S is a slightly tricky protocol to implement as it will need an accurate clock for transferring data back and forth. The lowest cost controllers that come with I2S interface are the dsPIC family of controllers from Microchip.