Raspberry Pi Pico PWM audio output circuit – Built-in processing design

By way of Jeremy S. Cook dinner

Freelance Technical Journalist / Technical Author, Technical Marketing consultant

Jeremy Cook dinner Consulting

June 27, 2023

Blogs

Authentic sure GPIO sign (yellow), sure and detrimental oscillating shifted audio line sign (blue)

As mentioned in school 7 of my Creating with Pi collection, Sound and Tune Output with Raspberry Pi RP2040 Pico, and Raspberry Pi Pico/RP2040 is a horny spectacular sound supply. No longer simplest can it generate beeps and program boops as chances are you’ll be expecting from an Arduino Uno and the like, it will probably additionally play uncompressed WAV recordsdata, in addition to compressed MP3s. The large restriction is that the Pico simplest has 2MB of Flash reminiscence, even if the RP2040 can run on as much as 16MB, making an allowance for slightly extra space relying at the card.

Within the magnificence discussed previous, I hooked up the output pin and down to earth a small speaker to provide audio and used an I2S amplifier. The direct GPIO connection manner produces an audio output. Alternatively, this is a DC sign, various between 0 and three.3V.

Line-level corrected audio indicators are AC, starting from ±1.736 in skilled packages to a lot decrease for shopper apparatus. Whilst I have not performed any obvious hurt the usage of this DC setup in my restricted checking out, I do not precisely consider it both.

Thankfully, there’s a ready-made answer discovered on web page 23 of the Raspberry Pi RP2040 {hardware} design information, proven in Determine 22:

Caption: PWM Audio Circuit from the RP2040 {Hardware} Design Information / Symbol Credit score: Raspberry Pi

Thru a configuration of capacitors and resistors, the circuit transforms GPIO27 and GPIO28 into stereo AC indicators which can be fed into an audio jack. The configuration makes use of a devoted 3.3V audio provide with a good judgment buffer to mitigate virtual noise from the principle provide. It is a easy sufficient circuit as it’s, however I have distilled it additional to get rid of exterior energy for a mono output:

Caption: Simplified Circuit / Symbol Credit score: KiCad screencap

This simplified circuit produces the specified mono AC audio output. By way of binding the end and ring segments of the three.5mm jack in combination, sound is output concurrently from the left and proper audio system of the headphones. This is the circuit laid out on a breadboard, with GPIO15 used rather than GPIO20:

Caption: Simplified circuit on breadboard / Symbol credit score: Jeremy Cook dinner

I have additionally made a variation of this circuit on a mission I have been running on. Right here I used a 2k resistor I had available as a substitute of the 1.8k element laid out in the design information. Each produced audio in a lot the similar method.

Caption: PCB circuit. Changed 2K resistor with 1.8K resistor. 220 ohm resistor close to Pico now not proven. / Symbol credit score: Jeremy Cook dinner

Listening with first rate headphones, the clips sound just right when performed at complete quantity. Alternatively, there may be noticeable hiss when the amount is became down. Whether or not this can be a results of now not the usage of a separate energy provide, or if it is because of every other {hardware} and/or tool factor, I am not positive. This setup is now able to sending a suitably alternating audio sign, and I would not (a lot) hesitate to glue it to unfamiliar audio apparatus.

Since imposing this sort of audio output is an issue of element pennies in comparison to merely connecting an output to a GPIO, I’d imagine it a suitable audio answer in a variety of eventualities. On the similar time, we wish to discover other filtering how you can get rid of low-level hiss in manufacturing. You may additionally imagine the usage of an I2S booster just like the MAX98357A instead, even if this will likely require using 3 GPIO pins and a few other programming.

Jeremy Cook dinner is a contract technical journalist and technical advisor with over 10 years of revel in in manufacturing facility automation. An avid author and experimenter, you’ll practice him on Twitter or watch his electromechanical feats on Jeremy S. Cook dinner’s YouTube channel!

Extra from Jeremy

#Raspberry #Pico #PWM #audio #output #circuit #Built-in #processing #design
Symbol Supply : embeddedcomputing.com

Leave a Comment