How to Add Audio to Your Embedded Project Using SparkFun's Qwiic Twist and Audio Player Breakout
Introduction
Looking to bring sound into your next embedded project? In this tutorial, we'll walk you through using the SparkFun Audio Player Breakout in combination with the Qwiic Twist to let you select and play tracks from a microSD card. It's a compact and powerful way to add audio interactivity to your prototype using simple I2C and serial connections.
Follow along on video here, or find the full tutorial below.
Hardware
To follow this experiment, you will need the following materials. While this is a simple project, we wanted to make sure that you have everything you need to get started before we get to the code.
Wiring
Qwiic Twist connected to RedBoard Qwiic via Qwiic cable Audio Player Breakout:
TXO
→ RedBoardD8
RXI
→ RedBoardD9
VIN
→ RedBoard5V
GND
→ RedBoardGND
Audio Out → Mono Audio Amp → Speaker Mono Audio Amp
PWR -
→GND
PWR +
→5V
Software Setup
To follow along, install the following libraries via the Arduino Library Manager:
Use Example4_QwiicTwist.ino from the SparkFun MY1690 MP3 Decoder Library examples. It enables the Qwiic Twist to:
- Rotate to change track number
- Press to play the selected track
- Display info via serial monitor
How It Works:
- The Audio Player Breakout receives serial messages from the RedBoard Qwiic.
- The Qwiic Twist allows you to navigate through tracks by rotating and play one by pressing.
- The selected audio file is played through the MY1690 and sent to the mono amp and speaker.
Serial Feedback: The sketch prints useful debug messages to the Serial Monitor, including the number of tracks on your SD card and the currently selected track.
Tips:
- Make sure your microSD card is formatted correctly and contains MP3/WAV files.
- Use a single-cell LiPo if you'd like to run this portable.
- You can customize the playback behavior by editing the example sketch.
Conclusion
This setup gives you a simple and intuitive audio playback solution for embedded projects. With just a few SparkFun parts and a handful of wires, you can control sound output with a tactile, menu-like experience. It’s perfect for interactive displays, soundboards, or even DIY toys!
Let us know what you build with it!