255-Voice PCM Sound Generator. Part 1. Schematic

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.

255-Voice PCM Sound Generator on ATtiny861

Because it can be controlled with ease, this project is usable as sound module for toys, tone ringers, amusement machines and gadgets.


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

ATtiny861 Block Diagram
Click to enlarge

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.

255-Voice PCM Sound Generator Schematic
Click to enlarge

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.


JLCPCP: 2USD 2Layer 5PCBs, 5USD 4Layer 5PCBs

You may have to register before you can post comments and get full access to forum.
User Name
Fragments of discussion:Full version of discussion »
  • Thanks so much for sharing this. It is perfect for a project I am working on. I have three questions for you: (a) Your mono (OCL) configuration implies that the output signal is differential in that case. Is that true? (b) If so, any particular reason I should not prefer that with an Amp as opposed to the Mono (Hi Res w/ Amp), which appears to mix two single-ended signals prior to amplification? (c) Can you suggest a simple (couple of Watts or so) Amp design? Since the signals are PWM I'm thinking just a couple of FETs to boost current might be sufficient (i.e. the output stage of a class D amplifier)?
PCB Design Analysis Software-NextDFM One-click Design Analysis for Manufacturability Layout Engineer Free Forever