zipplet
Posts: 13
Joined: Sun Dec 11, 2016 4:05 pm
Location: Tokyo, Japan

How To Video: Get decent audio from a Pi Zero with PWM

Sun Dec 11, 2016 4:13 pm

Hi,

I am new here, but have been playing with various Raspberry Pi models for many years. I decided to join the community to share some tricks and knowledge.

I created this video which demonstrates very good sound quality from the PWM output of the Pi Zero and explains how to do this very cheaply yourself - including the schematic (and explanation of what each part does) and configuration files. In the same spirit as the Raspberry Pi Foundation, this video is not monetised by me, so I make no money from you watching this.

I need to clarify that a music claimant has monetised it, not me :( I cannot stop that unless I silence one of the better parts of the video at the end. I will be more careful next time.

(To the moderators: If posting video URLs is not allowed, I apologise)

How to: Get decent analog audio from your Raspberry Pi Zero: https://www.youtube.com/watch?v=ENUb4leJ_rM

The first 10 minutes is an introduction of sorts, then I demonstrate the audio quality until about 18:30, at which point I explain how the Pi generates audio in general, and how to replicate my work. After that, I just play more sound through it for fun :)

Please take a look, and if you have any questions I am happy to answer them here. The microphone on the camera does NOT do this justice.

This will also improve the audio of the Pi 1 as well mostly due to the output capacitor size and keeping the signals away from noisy parts of the board, so if you still have some of those knocking about and are annoyed with the sound from the built in jack, this might help you too.

For the Pi 2 and Pi 3, this probably will not improve much upon the built in analogue sound jack much (well it might; I have not tried it); on the Pi 2 and onwards the analogue jack is already quite good if you enable sigma delta modulation BUT PLEASE FEED IT TO AN AMPLIFIER - treat it as a line output jack - please!

To be honest, raspi-config should not call it a "headphone" jack - it should explicitly say "3.5mm line-out".

User avatar
diereinegier
Posts: 176
Joined: Sun Dec 30, 2012 5:45 pm
Location: Bonn, Germany

Re: How To Video: Get decent audio from a Pi Zero with PWM

Fri Apr 14, 2017 9:08 am

Hi,

thank you very much for sharing this. The possibility to remap the PWM output to accessible GPIO pins was completely new to me and opens up a lot of simple audio applications for the Pi Zero (talking clock etc.).

In the video you put some emphasis on the fact that the output capacitors should be electrolytics/polarized. More often than not ceramic or tantalum capacitors are used to get rid of the DC part of the signal. At least when used at the input of e.g. a amplifier.
Could you please elaborate on this?

Cheers
Georg
Clone or fork my repositories at https://github.com/GeorgBisseling

zipplet
Posts: 13
Joined: Sun Dec 11, 2016 4:05 pm
Location: Tokyo, Japan

Re: How To Video: Get decent audio from a Pi Zero with PWM

Fri Jun 23, 2017 10:43 am

diereinegier wrote: In the video you put some emphasis on the fact that the output capacitors should be electrolytics/polarized. More often than not ceramic or tantalum capacitors are used to get rid of the DC part of the signal. At least when used at the input of e.g. a amplifier.
Could you please elaborate on this?
Sorry about the late reply, I didn't get any email notification that you had replied to this thread.

About capacitor selection:
  • Tantalum capacitors are polarised, so the positive side must face the Pi (as the signal being fed in from that side will be between 0-3.3V positive). They are not preferred for many reasons (including combustion with flame if installed backwards) and they can colour the audio in some peoples opinions (personally I have not noticed a difference). They tend to be used in compact devices like smartphones because they can achieve a high capacitance value in a small package.
  • You do not need to use tantalum unless you are limited on space or just happen to have them at hand.
  • A high value ceramic would work in place of the polarised capacitor I used, but I don't think you can get them in values as high as 47uF yet.
  • An unpolarised electrolytic would be fine.
  • A smaller value will give poorer bass response - use 33uF as a minimum.
  • A larger value like 100uF also sounds pretty good, and there is no need to go higher than that.
Lastly, if you do use a polarised tantalum or electrolytic, the positive side of the capacitor MUST face the Pi output side. It might appear to work in reverse, but you are damaging the capacitor and suffering some possible audio quality loss (and failure down the road).

Return to “Graphics, sound and multimedia”