Building an Atmel-powered Trinket audio player

Adafruit’s Trinket platform – powered by Atmel’s versatile ATtiny85 microcontroller (MCU) – supports high-speed PWM mode. So with just a few extra components the Trinket can be used for projects requiring audio output.

“You could make an electronic greeting card with your own customized message or song, add a background soundtrack to a model train diorama, or create the world’s smartest whoopee cushion,” explained Adafruit’s Phillip Burgess. “[Nevertheless], it is a very simple circuit that just plays a short ‘raw’ audio loop.”

According to Burgess, there are two primary phases to the project. The first employs an Arduino to load sound data onto a flash memory chip, while the second, using Adafruit’s Trinket, plays it back.

“Loading” stage components include:

  • Atmel-powered Arduino Uno or similar board
  • Capacitor: one 0.1 μF
  • Resistors: 3 each 470 Ohm and 1K OhmAn LED (any color) and 220 Ohm resistor for a status indicator (optional)

“Playback” stage components include:

  • Adafruit Trinket 3.3V (NOT 5V!)
  • Capacitors: one 10 μF, 2 each 0.1 μF
  • Resistor: one 68 Ohm
  • 10K potentiometer
  • Headphone jack and headphones or portable amplified speaker OR
  • Audio amplifier board and 4 Ohm speaker (or 8 ohm)

On the software side, the project uses both Processing and the Arduino IDE, while sound files can be in WAV format, uncompressed (PCM), 8- or 16-bit resolution. In terms of playback, the ATtiny85 chip at the heart of Trinket is capable of producing a 250 KHz 8-bit PWM signal.

“A low pass filter circuit then smooths the ‘square’ PWM into a usable audio waveform. A very basic low pass filter can be made from just a capacitor and resistor. [However], first we need to know the filter’s cutoff frequency — frequencies below this pass through, while higher frequencies (like the PWM signal) are attenuated,” said Burgess.

“A rule of thumb with PWM audio is that the highest usable audio frequency (our cutoff frequency) is about 1/10 the PWM rate. The latter we’ve already established is 250 KHz, so a good cutoff would be 25 KHz.”

Interested in learning more about putting together an Atmel-powered Adafruit Trinket audio player? A full tutorial, written by Phillip Burgess is available here.

2 thoughts on “Building an Atmel-powered Trinket audio player

  1. Pingback: Building a Trinket-powered (ATtiny 85) rover | Bits & Pieces from the Embedded Design World

  2. Pingback: How much you can hang off a Trinket (ATtiny85)? | Bits & Pieces from the Embedded Design World

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s