User avatar
solar3000
Posts: 1051
Joined: Sat May 18, 2013 12:14 am

RPI Zero DOES have sound

Sat Nov 28, 2015 10:53 pm

Why is it people are saying they need to add a USB sound card?
I just played an AVI file with omxplayer and BLAM there was sound coming out of my monitor speakers!
Antikythera

asandford
Posts: 1997
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: RPI Zero DOES have sound

Sat Nov 28, 2015 10:57 pm

solar3000 wrote:Why is it people are saying they need to add a USB sound card?
I just played an AVI file with omxplayer and BLAM there was sound coming out of my monitor speakers!
Sound over hdmi wasn't removed, only analogue

User avatar
solar3000
Posts: 1051
Joined: Sat May 18, 2013 12:14 am

Re: RPI Zero DOES have sound

Sat Nov 28, 2015 10:59 pm

do you know the solder points?
Antikythera

asandford
Posts: 1997
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: RPI Zero DOES have sound

Sat Nov 28, 2015 11:42 pm

solar3000 wrote:do you know the solder points?
No idea. I don't think analogue is available at all, but there are many posts about using RC circuits on the GPIO pins in alt modes to getv PWM sound out.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12407
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: RPI Zero DOES have sound

Sat Nov 28, 2015 11:49 pm

there are no solder points, but what can be done is to solder some components to a few GPIO pins to turn a PWM signal into an analog signal. you can redirect the PWM signal that originally went into signals going to the components for the analog audio port and redirect these PWM signals so they come out of GPIO header pins.
in fact the people at adafruit have a page describing the details, here:
https://learn.adafruit.com/introducing- ... io-outputs

it has this part of the B schematics, with the conversion hardware from PWM to audio:

Image

the diodes are there so that the GPIO's are protected against voltages < 0V or > 3.3V, which as we should know can cause latch up damage in the SoC.

not only do they give you a schematic of the conversion hardware, but also details on how to change the software settings for it.
This is the schematic used by the B, the B+ (and 2B) actually first buffered the PWM signal with a pair of buffers running from its own very clean 2.5V power, to get rid of the noise on the 3V3 PWM signal, so on a B+ it sounds a bit better, but for without the buffers it will also work fine, especially as on the zero the 3V3 power is probably much cleaner than it was on a B.

Nightwing2012
Posts: 48
Joined: Sat Oct 29, 2011 9:19 pm

Re: RPI Zero DOES have sound

Sun Nov 29, 2015 5:26 am

mahjongg wrote:there are no solder points, but what can be done is to solder some components to a few GPIO pins to turn a PWM signal into an analog signal. you can redirect the PWM signal that originally went into signals going to the components for the analog audio port and redirect these PWM signals so they come out of GPIO header pins.
in fact the people at adafruit have a page describing the details, here:
https://learn.adafruit.com/introducing- ... io-outputs

it has this part of the B schematics, with the conversion hardware from PWM to audio:

Image

the diodes are there so that the GPIO's are protected against voltages < 0V or > 3.3V, which as we should know can cause latch up damage in the SoC.

not only do they give you a schematic of the conversion hardware, but also details on how to change the software settings for it.
This is the schematic used by the B, the B+ (and 2B) actually first buffered the PWM signal with a pair of buffers running from its own very clean 2.5V power, to get rid of the noise on the 3V3 PWM signal, so on a B+ it sounds a bit better, but for without the buffers it will also work fine, especially as on the zero the 3V3 power is probably much cleaner than it was on a B.
Thank you! ^_^

User avatar
solar3000
Posts: 1051
Joined: Sat May 18, 2013 12:14 am

Re: RPI Zero DOES have sound

Sun Nov 29, 2015 11:18 am

Image
Antikythera

KenT
Posts: 758
Joined: Tue Jan 24, 2012 9:30 am
Location: Hertfordshire, UK
Contact: Website

Re: RPI Zero DOES have sound

Sun Nov 29, 2015 12:08 pm

What are the two diodes per channel for. I wonder if they protect the outputs from spikes when plugging in the jack or mis-wiring, and can be missed out when hard wiring to an amplifier.
Pi Presents - A toolkit to produce multi-media interactive display applications for museums, visitor centres, and more
Download from http://pipresents.wordpress.com

User avatar
rpdom
Posts: 15579
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: RPI Zero DOES have sound

Sun Nov 29, 2015 12:26 pm

KenT wrote:What are the two diodes per channel for. I wonder if they protect the outputs from spikes when plugging in the jack or mis-wiring, and can be missed out when hard wiring to an amplifier.
the diodes are there so that the GPIO's are protected against voltages < 0V or > 3.3V, which as we should know can cause latch up damage in the SoC.

User avatar
malinuxTele
Posts: 3
Joined: Sat Aug 22, 2015 11:10 am
Location: Bamako, Mali
Contact: Website

Re: RPI Zero DOES have sound

Tue Jan 05, 2016 4:31 pm

Another solution for lazy people might can be to buy USB sound card. they can be bought for arround 1$ on aliexpress, you can buy a OTG hub allowing you to have many USB plug from your Pi.

It's not so existing as building your own sound output, but it might help if this option is not appropriate for your project.

Still need to check if cheap usb -> sound dongle are linux-compatible. I'll check and tell you.

Julien

User avatar
karrika
Posts: 1072
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: RPI Zero DOES have sound

Tue Jan 05, 2016 6:07 pm

I got an USB sound card from ebay for 0.78 € and it worked really well.
Image

The 2nd card for 1€ was louder but the sound was not as crisp as in the cheaper variant.
Image

So in my opinion the cheaper one is the winner. Plus you save 22 cents.

The prices here include free shipping :o

Both work with PiZero out-of-the plastic bag.

User avatar
liz
Raspberry Pi Foundation Employee & Forum Moderator
Raspberry Pi Foundation Employee & Forum Moderator
Posts: 5202
Joined: Thu Jul 28, 2011 7:22 pm
Contact: Website

Re: RPI Zero DOES have sound

Tue Jan 05, 2016 8:58 pm

Actually, it DOESN'T use that part of the B schematics - I think Limor just got lucky!
Director of Communications, Raspberry Pi

User avatar
TimG
Posts: 294
Joined: Tue Apr 03, 2012 12:15 am
Location: Switzerland

Re: RPI Zero DOES have sound

Wed Jan 06, 2016 2:12 am

mahjongg wrote:it has this part of the B schematics, with the conversion hardware from PWM to audio:

Image

the diodes are there so that the GPIO's are protected against voltages < 0V or > 3.3V, which as we should know can cause latch up damage in the SoC.
Wouldn't the protection diodes be better placed upstream of the filter? Or at least upstream of the 10uF DC-blocking capacitors. As they are shown they will not protect the GPIOs against an oscillating signal applied to the outputs: the diodes will limit it to about +3.9V and -0.6V, but after the 10uF capacitors this becomes +/-2.3V. +2.3V is ok, but -2.3V is not.
I'd also put the DC-blocking before the low-pass filter, in order to reduce the load on the GPIOs. Something like this:
text4189.png
text4189.png (14.56 KiB) Viewed 33390 times

toxibunny
Posts: 1382
Joined: Thu Aug 18, 2011 9:21 pm

Re: RPI Zero DOES have sound

Wed Jan 06, 2016 10:41 am

I'm going to be using a mini hdmi to vga converter - one of the ones with an audio out. They're less than a fiver on ebay, require no setup, and don't need USB.
note: I may or may not know what I'm talking about...

andybiker
Posts: 15
Joined: Fri Apr 26, 2013 7:46 am

Re: RPI Zero DOES have sound

Thu Jan 07, 2016 3:28 pm

Maybe if there is a future revision then the missing resistors and capacitors could be added to the board.
Even if the outputs came to solder pads then this would be enough.
My own application for one (as soon as I can get my hands on one!) is to make a neater internet radio for my wife.
The Pi Zero will fit beautifully behind the display giving a very neat package - I just need to add the missing filter components.

Beautiful product anyway!

BMS Doug
Posts: 3824
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: RPI Zero DOES have sound

Thu Jan 07, 2016 4:39 pm

andybiker wrote:Maybe if there is a future revision then the missing resistors and capacitors could be added to the board.
Even if the outputs came to solder pads then this would be enough.
My own application for one (as soon as I can get my hands on one!) is to make a neater internet radio for my wife.
The Pi Zero will fit beautifully behind the display giving a very neat package - I just need to add the missing filter components.

Beautiful product anyway!
Either a cheap (<£2) USB soundcard or the £12 pHAT DAC will give you a better sound quality without taking up an enormous amount of space. but you will still need an Amp and speakers.
Doug.
Building Management Systems Engineer.

andybiker
Posts: 15
Joined: Fri Apr 26, 2013 7:46 am

Re: RPI Zero DOES have sound

Fri Jan 08, 2016 10:37 am

BMS Doug wrote:
andybiker wrote:Maybe if there is a future revision then the missing resistors and capacitors could be added to the board.
Even if the outputs came to solder pads then this would be enough.
My own application for one (as soon as I can get my hands on one!) is to make a neater internet radio for my wife.
The Pi Zero will fit beautifully behind the display giving a very neat package - I just need to add the missing filter components.

Beautiful product anyway!
Either a cheap (<£2) USB soundcard or the £12 pHAT DAC will give you a better sound quality without taking up an enormous amount of space. but you will still need an Amp and speakers.
I have tried the cheap USB soundcards and they do work well.
Unfortunately the Zero only has one USB and I need that for a wifi adapter. if I have to start adding a hub then why use a zero?
Fair comment with the pHAT DAC, (I had no idea they were so cheap) but it is then bigger.
I can add four capacitors and four resistors on a piece of veroboard the size of a postage stamp.
My application? an internet radio combined with "Andrew's Approximate Clock"
I have this running beautifully on a Pi model A but the zero is the perfect size.
I have large VFDs (220x45mm approx) (16 character dot matrix OR union-jack starburst) which makes it readable across the room. on it's 16 characters. scrolling the Station, Artist, Song, Time (approximate - "Almost quarter to four")
It's running MPD and controllable from my phone with MPDROID.
Sound is from the Analogue out to a pair of (nice) computer speakers or small HiFi. Quality is good - I have no complaints with the analogue out. maybe I'm lucky.
Sorry to veer off-topic but I'm just giving some background to as why I wanted the analogue audio feature !
cheers
Andrew

hippy
Posts: 6233
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: RPI Zero DOES have sound

Fri Jan 08, 2016 12:47 pm

andybiker wrote:Maybe if there is a future revision then the missing resistors and capacitors could be added to the board.
It would be nice but, as the board is designed for lowest cost, raw audio PWM channels can be routed to accessible GPIO pins, it would seem unlikely to happen.

I recall the Pi B+ introduced changes to the analogue outputs, a buffer amplifier and better power supply I believe, so to make the Pi Zero comparable may require more than just a couple of components. There are no full Pi B+ schematics available so I am just going by what others have said.

If there is demand for analogue audio from a Zero then someone could perhaps make an add-on board for that. Given the potential cost of that it might not be viable, leaving DIY circuitry, an add-on DAC, a USB sound card or buying a Pi with on-board analogue capability as the options.

I know some people have been dismissive of analogue audio quality from a Pi but I have found it entirely acceptable from my B+ through a Hi-Fi amp, but I'm no audiophile.

clacktronics
Posts: 60
Joined: Sat Mar 03, 2012 6:07 pm
Location: London
Contact: Website

Re: RPI Zero DOES have sound

Fri Jan 08, 2016 1:16 pm

I am designing a DIY board (through hole parts) brings out all the analogue elements you may need including VGA.

Image

I have only just tested it and it seems to work although if you want VGA and sound you basically only have 4 GPIO left! If you solder it onto the board it is pretty compact, not here though I am using a header socket.

The problem I found with USB soundcards is primarily with omxplayer, they do not output the sound to ALSA it is direct so it cannont use USB, I am not sure if the i2s boards work either.
My Kickstarter for a analogue AV out - kck.st/1SuGDvV

drgeoff
Posts: 9916
Joined: Wed Jan 25, 2012 6:39 pm

Re: RPI Zero DOES have sound

Tue Jan 12, 2016 10:07 pm

Especially given the increasing use of Class D or T amps or "digital" amps, in some setups it can make sense to not filter the Zero's PWM audio in the manner described above.

Instead take the PWM signals via driver/bias components to complementary switching FETs fed from an appropriate voltage for the loudspeaker impedance and desired power. Then put an L-C low pass filter between the FETs and speaker.

A drawback is how to implement a volume control. If that is done on the RPi, the sound quality does degrade as the volume is turned down.

User avatar
sav25
Posts: 364
Joined: Thu Aug 30, 2012 7:18 pm
Location: Southend-on-Sea, Essex, UK
Contact: Website Twitter

Re: RPI Zero DOES have sound

Thu Jun 30, 2016 1:25 pm

Bit of a dated thread but wanted to ask a question if that's ok.

I'm trying this on a breadboard for a bit of fun, and I'm getting sound without the 3v3 section in the diagram - I'm just using GPIO 13 > caps/resistors > into an amplifier.

Is there any reason why I need to hook it up to 3v3 - will it sound better? And if so, is there any particular diode I should use?

It doesn't sound too bad just now :?
Averagemaker.com

andybiker
Posts: 15
Joined: Fri Apr 26, 2013 7:46 am

Re: RPI Zero DOES have sound

Thu Jun 30, 2016 2:15 pm

The diodes are there to protect the GPIO pin and the CPU itself.
If there is any voltage on the pin greater than 3.3v (plus diode drop) then this gets shunted to the 3.3v supply.
Any voltage less than 0 (minus the diode drop) gets shunted to ground.
Why put them on these pins? because headphones are an inductive load and could generate back-emf, destroying your Pi
You can leave these out if connecting to an amplifier but it's your choice.
Ordinary small 1n4148 diodes will work.
They will not affect the sound quality at all.

What makes a BIG difference is a usb sound card. I bought some direct from china for £0.69 each. including postage.(HOW?)
A tiny laptop hub (£1) and I have usb and wifi on my Zero.
At low volume the difference is really noticeable. If you have the choice then use a usb one.

User avatar
sav25
Posts: 364
Joined: Thu Aug 30, 2012 7:18 pm
Location: Southend-on-Sea, Essex, UK
Contact: Website Twitter

Re: RPI Zero DOES have sound

Thu Jun 30, 2016 2:17 pm

andybiker wrote:The diodes are there to protect the GPIO pin and the CPU itself.
You can leave these out if connecting to an amplifier but it's your choice.
That's exactly what I'm doing, this feeds straight into an amplifier.

Thanks :)
Averagemaker.com

User avatar
mamgeorge
Posts: 1
Joined: Fri Dec 15, 2017 7:52 pm

Re: RPI Zero DOES have sound

Fri Dec 15, 2017 8:15 pm

I am struggling to get sound out of my RPI0 ( RasperryPi Zero). I use a "USB Virtual Sound Adapter" that works on the RPI2B+ , but no luck. When using:
$ lsusb:
Bus 001 Device 002: ID 8086:0808 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

This suggests to me the device is not even being read. But using:
$ dmesg | grep C-Media
[ 1.691477] usb 1-1: Manufacturer: C-Media Electronics Inc.
[ 1.707135] input: C-Media Electronics Inc. USB PnP Sound Device as /devices/platform/soc/20980000.usb/usb1/1-1/1-1:1.3/0003:8086:0808.0001/input/input0
[ 1.779712] hid-generic 0003:8086:0808.0001: input,hidraw0: USB HID v1.00 Device [C-Media Electronics Inc. USB PnP Sound Device] on usb-20980000.usb-1/input3


What do I need to add? How can I even confirm if the driver is present? :shock:
Any help would be appreciated.... Thanks!

Return to “General discussion”