Raspberry Pi Pico Project - Amplified MP3 Playback
NOTE:
- Had to install CircuitPython to replace MicroPython
- Match the project files that you use with the CircuitPython version you are using. I used version 9 which was alpha.
- To use an mp3 for this project it needs to be less than 64kbit/s with sample rates between 8kHz and 24kHz to work.
- Used one pico for testing on the breadboard and another for finished product. The testing pico had pins soldered to it for easy bread board use. I soldered these previously but you can also buy them pre-soldered.
Parts/tools I used:
Here are some links on Amazon and Adafruit. The Amazon links are paid affiliate links.
- Raspberry Pi Pico RP2040 microcontroller - 4 Pack
- Adafruit Mono 2.5W Class D Audio Amplifier - PAM8302
- Mono Enclosed Speaker with Plain Wires - 3W 4 Ohm
- Hakko FX888D-23BY Digital Soldering Station FX-888D
- AUSTOR 6 Pack 60-40 Rosin Core Solder
- KOTTO Helping Hands Soldering Tool PCB Holder
- 4PCS Breadboards Kit
- AUSTOR 560 Pieces Jumper Wire Kit
- On/Off Switch
- AAA Battery Holder Case Box
- iFixit Mako Driver Kit - 64 Precision Bit Set for Electronics Repair
- micro-USB cable
- another micro-USB cable
Steps I took:
- Placed Raspberry Pi Pico on bread board ( pins previously added )
- Soldered wires and connector to amplifier
- Connect speaker to amplifier ( using tiny screws)
- Plugged Amp wires into bread board to connect to the pico
- Hold bootsel button and connect USB cable (pico shows up as drive)
- Download CircuitPython
- Download Adafruit project files ( just python and mp3 file needed, lib wasn’t actually included but wasn’t needed )
- Copy CircuitPython install file to disk ( will show up as a CircuitPython drive instead now )
- Copy Adafruit python file and mp3 file
Should be working when plugged in now
- Unplugged amp from breadboard
- Soldered amp wires to second “production” Raspberry Pi Pico
- Copied CircuitPython and project files to this second Raspberry Pi Pico ( same as steps for first one )
- Solder battery connector and power switch
This is the first example from the Adafruit guide:
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
CircuitPython single MP3 playback example for Raspberry Pi Pico.
Plays a single MP3 once.
"""
import board
import audiomp3
import audiopwmio
audio = audiopwmio.PWMAudioOut(board.GP0)
decoder = audiomp3.MP3Decoder(open("slow.mp3", "rb"))
audio.play(decoder)
while audio.playing:
pass
print("Done playing!")