Sound

The Teensy brand of microcontrollers are known for their ability to play and manipulate high quality sound. It takes a few parts to make sound: a micro sd card with .wav sound files, an audio amplifier, and a speaker.

Get a file on the SD card

Record or find some .wav file audio clips. A nice source is the free website. Copy the files to the micro sd card, using short names for convenience later. Plug the micro sd card into the Teensy.

Wire up the audio amplifier and speaker

The speaker requires an amplifier to produce loud and clear sound. The I2S amplifier receives the sound from the Teensy digitally, resulting in less scratchy noise from the speaker. Connect the amplifier ground to ground, 5V to 5V, MISO to MISO, and MOSI to MOSI. I have pre-soldered wires onto the speaker. Connect the speaker wires to the amplifier in the green screw terminals.

Image of sound circuit Speaker circuit

Play the sound

It takes several libraries to play the .wav files using I2S.

Solution

Play the sound and use potentiometer volume

Write some code that plays a sound when the IMU is tapped, and read from the pot to set the volume.