Friday, October 11, 2024

Audio on the Pico part 2 the hardware

For an index to all my stories click here.

This is the second part in series about playing audio with The Raspberry Pi Pico.

The Raspberry Pi Pico can produce wonderfull audio. But it has to be in a certain format. The format is 8K wav. With the free software Audacity you can convert any audio (like MP3) to any other format. Even better: you can edit the audio like cutting parts out of it etc. This makes Audacity perfect for our purpose. The previous story discused the elements of Audacity that we need. You can read that story here 
http://lucstechblog.blogspot.com/2024/10/audacity-pico-audio-part-1.html


Please note that this will work both on the Raspberry Pi Pico and the Pico W.

To produce audio on the humble Raspberry Pi Pico we need just a few (very cheap) parts:
- 2  1K resistors
- 4  2K2 resistors
- 2  47nF capacitors.
- An active speaker set and/or
- earbuds

The active speaker set is just a set of speakers with a build in amplifier. Computer speakers are an example of these. Earbuds will also do the job if you want to listen in privacy. Just note that there is no volume adjustment in the hardware or software.

With these parts we build a simple low-pass filter which is enough to produce fantastic sounding audio.



This is how you can build the hardware on a breadboard. In this setup The audio output is connected to an active speaker with Alligator clips.

There are cheap audio amplifiers around which you can use on a breadboard. An example is the PAM8403 which I used in the series about Talkie on this weblog. You can use one of these with a separate speaker but don't forget to add a seperate power supply in that case as the PAM8403 needs more power as the Pico can deliver.



For your convenience I provide a wire-schematic which simplifies the breadboard setup a bit.



And as extra an electronic schematic which may be easier to understand.

Power supplies and long wires tend to produce noise that the audio circuit might pick up. So keep all wires as short as possible. Best is build this on a stripboard. If you want to do that, wait till this series ends. I am going to show you how to build a talking thermometer but I am also going to expand the setup with an SD card and some buttons to build a full audio player.

Connecting to a speaker

Most active speakers have a 3.5mm plug, just like earbuds have.



The picture shows how the connections on the plug are organised. Connect the alligator clips to the plug according to the left-right-gnd connections.

In the next part in this series we are going to play some sounds. The software is written in MicroPython. No less then 5 libraries are needed. So stay tuned.

Till next time
have fun

Luc Volders