Introduction

Author: Elizabeth Roy, Microchip Technology Inc.

This application note describes how to record, store, and play back sound using the new tinyAVR® 1-series microcontroller with ADC and DAC peripherals, using either an SD card or a serial Flash to store raw data. It details the usage of the ADC for sound recording, the Serial Peripheral Interface (SPI) for data storage device interfacing and DAC for playback, with the use of a timer to define sampling frequency and event system for inter-peripheral signaling. Typical applications that would require one or more of these blocks are temperature loggers, telephone answering machines, or digital voice recorders. The products used in this application note include the ATtiny817 Xplained Pro board, both the I/O1 and OLED1 Xplained Pro Extension Kits, and a few extra components for the microphone and speaker circuits. Alternatively, the ATtiny817 based AVR Parrot (ATAVRPARROT) - field engagement board can be used. For more information on the board, visit http://www.microchip.com/developmenttools/ProductDetails/ATAVRPARROT.

The tinyAVR® 1-series is used to take analog samples from a microphone and convert them to digital values with its ADC. Its built-in SPI interface controls data transfers to and from the SD card (or DataFlash). The DAC is used for playback. The sampling and playback frequency is defined using a timer, with inter-peripheral signaling via the event system and interrupts. The code size is fairly small (around 2 kB including a data storage interface driver) meaning the application is suitable for smaller AVR devices.

Two accompanying projects are available for this application note in Atmel START. The implementation of sound data sampling and playback is identical for both; the only difference is the mode of data storage. The first project stores raw data on an SD card, and is designed to be used with an ATtiny817 Xplained Pro and external components. The second project is for the ATtiny817 Parrot Field Engagement Board and uses a serial DataFlash for data storage.