This is a simple sound generator based on 8-pin SD Audio Player. It is built with an Atmel ATtiny861 microcontroller from Atmel and an SD memory card. The tiny861 has fast PWM outpus like tiny85 so that it can generate clear sound compared to any other AVR chips. On 20-pin device, many GPIO pins are available. It enables to control the sound generator by external signals.
Because it can be controlled with ease, this project is usable as sound module for toys, tone ringers, amusement machines and gadgets.
Hardware
A MicroSD card is used as storage media and also SD and MMC can be used with proper socket conversion. It is controlled in SPI mode via USI. The audio signal is output in PWM and it can drive loudspeakers directly.
Attiny861 Block Diagram
It may be thought that the output current exceeds the rating but it is no problem because the output current is limited by output impedance at 3.3 volt supply voltage even if the output pin is tied to the rail. Therefore it cannot sound loud but it will create sufficient sound that listen on the desk with high efficiency speakers. When connect the audio outputs to the amplifier, the high frequency component must be filtered out with LPF. Do not input the PWM signals directly to the amplifier or the amplifier and speakers can be damaged.
Selecting an Audio Output Circuit
There are three different output circuit shown in the Circuit Diagram. These are exclusive each other. The firmware to be written into the AVR must be fit for the output configuration of the circuit. Each output configuration (Mono-OCL/Stereo/Mono-HR) correcponds the hex file (sdsg_mo.hex/sdsg_st.hex/sdsg_hr.hex). The fuse settings are combined with the hex files, however, some flash programmer does not support this sort of hex files. In this case, remove last three lines from the hex file and initialize the fuse bits separately with the fuse values found in main.c.
LED indicator
The LED indicates that a sound file is being played. It also flashes on any error. The number of flashes + a second of blank corresponds to the type of errors as follows:
- Two fhash - I/O error. (hard error or file system error)
- Three flash - The sound file is not found.
- Four flash - Invalid sound file.
Part 2. Software, configuration, sound file format, operating modes and control commands.