This is a simple SD audio player biult with only an 8-pin microcontroller. The ATtinyX5 series (25/45/85) 8-pin AVR microcontroller has two fast PWM outputs in 250kHz carrier frequency. This enables to output a wide frequency range audio signal. I built an audio player with the 8-pin AVR and an SD memory card (SDC). The SDC can be controled with only six lines, two for power supply and four for control signals. It can also be easily attached to 8-pin microcontrollers. The main application of the tiny X5 series AVR seems SMPS and related according to its integrated peripherals.
Anyway this audio player is very simple and a few wires to be solderd so that it is suitable for brief soldering work before breakfast. There is a similar project based on this project.
Right image shows the world's smallest audio player (as microSD player, perhaps...). There are four schematics for the player in different output configurations. The recording media to be used is a microSD. Of course the standard SDC and MiniSD can also be used by proper socket conversions.
The speakers are driven directly with PWM output of the AVR. The load may be too heavy for the output port. However the output current is never exceed the absolute maximum ratings at 3 volts supply voltage even if the port is tied to the power supply rails. Therefore it cannot sound loud but it will create sufficient sound that listen on the desk with high efficiency speakers. An optional 100μH series inductor on the PWM output will reduce power consumption. 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.
Using the memory cards on the embedded projects means that the firmware must manipulate the FAT file system. I used Petit-FatFs module branched from full featured FatFs module. The Petit-FatFs was developped for very small memory system that available RAM size is less than 512 bytes. It is suitable for tiny AVRs and PICs.
There are some different firmware files in the archive for each hardware configuration. The fuse values are combined to the hex files. However some AVR programmers may not support this sort of hex files and reject it on loading. If it is the case, remove fuse seciton from the hex file. The fuse values to be programmed are also found in the main.c.
The Mono configuration uses five I/O pins and it does not need to switch RSTDISBL fuse. It can be programmed in ISP method that supported by all AVR programmers. The dual output configurations, Stereo, Hi-Res and OCL, use all I/O pins including RESET pin. There is a problem that high voltage serial programming method is required to switch the RSTDISBL fuse. But most AVR programmer does not support the HVSP method. The ISP method can also program the RSTDISBL fuse only the first time but cannot re-program.
The SD audio player supports only RIFF-WAVE format sound files known as Microsoft wave file in LPCM, 8/16-bit, mono/stereo and upto 48kHz sampling rate. Each configuration accepts this range of formats. MP3 files must be converted to the .wav file. The player start to play on power-on or card insertion. If a sound file directory "wav" is exist on the root directory, the wave files in the sound directory will be played in order of directory listing. If the directory "wav" is not exist, the wave files on the root directroy is played instead. Push button switch is to jump to the next file.