lithium630
Posts: 14
Joined: Sat Aug 31, 2013 11:27 pm

adding a speaker

Sun Sep 01, 2013 12:05 am

I'm trying to stuff a Pi into an original Nintendo Gameboy case to make a portable Mame device. Most of the parts are on order. I would like to add a speaker to give the option of headphones or external sound. I found several similar projects but none that use a speaker. This is all new to me and I'm using this project to learn (and teach my kids). I would appreciate any links to similar setups.

User avatar
Hove
Posts: 1205
Joined: Sun Oct 21, 2012 6:55 pm
Location: Cotswolds, UK
Contact: Website

Re: adding a speaker

Sun Sep 01, 2013 7:10 am

The only real difference between headphones and speakers is the current they draw and hence how loud they are; headphones only need small current since they are so close to your ears; speakers need much higher current to produce what seems like a similar volume because they are so much further from your ears. It's the current that's the problem to solve: the Raspberry Pi cannot supply the current required by a passive speaker, so you'll either need to buy a set of powered speakers you can plug into the RPi headphoe jack (I use these http://www.amazon.co.uk/Edifier-Aurora- ... B003TWN684 as they are cheap and sound great, or you'll need to build an audio power amplifier to do the same things. That's not as bad as it sounds - I've just dug this up http://uk.farnell.com/stmicroelectronic ... dp/1842519 from farnell / element 14 / Newark that should so the job nicely - there's many others available, this was just a 30s scan. You'll need a power supply more powerful than a mobile charger for driving the amp / speakers too.
www.pistuffing.co.uk - Raspberry Pi and other stuffing!

User avatar
Hove
Posts: 1205
Joined: Sun Oct 21, 2012 6:55 pm
Location: Cotswolds, UK
Contact: Website

Re: adding a speaker

Sun Sep 01, 2013 10:18 am

Off-topic but wow, "cheap" definitely subjective with £75 for a tiny speaker set.
Oops, sorry! I paid half that from here: http://www.pixmania.co.uk/uk/uk/search/ ... play-list/ though their stock level was a lot better with all colours when I bought mine. Shop around -- anything more than £40 /
is a rip off.

Having said that, size isn't everything! Despite being small, these have an astonishing audio quality full-stop / period; they've won awards as a result. In a previous life, I was a HiFi geek, both buying and building speakers and amplifiers. The quality of these Edifiers isn't so far off a £1000 pair of speakers I built which in turn would have cost twice the price to buy the equivalent in a shop.
www.pistuffing.co.uk - Raspberry Pi and other stuffing!

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: adding a speaker

Sun Sep 01, 2013 11:15 am

If you're looking for some cheap speakers then perhaps - http://www.raspberrypi.org/phpBB3/viewt ... 69#p375869

Richard S.

karlkiste
Posts: 189
Joined: Tue Jan 22, 2013 8:50 am
Location: berlin, germany

Re: adding a speaker

Sun Sep 01, 2013 12:15 pm

The output impedance of the Pi's analog audio out is more than 100 Ohm. Connected to a 8 Ohm speaker, you might get something like 0,5 milliwatts. I dare say, this is barely audible.

But, suggesting a 25 watts amplifier to have a beeping hand-held device is a bit too much, I think. Looking at the power ratings of one to two inch speakers, 1 watt per channel should be way enough.

A cheap high-power op-amp like a L2722 could do the job (in stereo!). You could even think of a one-transistor class-a amplifier.

Greets,
Kiste

P.S.: The protective diodes on the Pis analog audio out are unwisely connected AFTER the dc-blocking capacitors, therefore the outputs can not swing more than ~0.6V to the negative side. External bias to +1V or so could improve the sound when connecting to an amplifier with high input impedance.

User avatar
Burngate
Posts: 6090
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: adding a speaker

Sun Sep 01, 2013 3:23 pm

karlkiste wrote:The protective diodes on the Pis analog audio out are unwisely connected AFTER the dc-blocking capacitors, therefore the outputs can not swing more than ~0.6V to the negative side. External bias to +1V or so could improve the sound when connecting to an amplifier with high input impedance.
Though, since the 0 - 3v3 swing of the (PWM) audio is devided down by the potential devider to only 1v p-p, and therefore only go ±0.5v, those diodes won't have much effect.

karlkiste
Posts: 189
Joined: Tue Jan 22, 2013 8:50 am
Location: berlin, germany

Re: adding a speaker

Sun Sep 01, 2013 5:08 pm

Though, since the 0 - 3v3 swing of the (PWM) audio is devided down by the potential devider to only 1v p-p, and therefore only go ±0.5v, those diodes won't have much effect.
This explanation had made more sense to me, if both the anodes and the cathodes had been connected to GND. Then the swing would be limited to ±0.6v. Now it is limited to -0.6/+4.1v. Looks a bit like not much thought of to me.

lithium630
Posts: 14
Joined: Sat Aug 31, 2013 11:27 pm

Re: adding a speaker

Sun Sep 01, 2013 11:22 pm

I appreciate all the replies. I wouldn't want this to be too easy. :) It seems like the PI can power the amplifier on the Sony speakers suggested. I'll give it a try. I sense a lot of trial and error coming.

User avatar
Burngate
Posts: 6090
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: adding a speaker

Mon Sep 02, 2013 10:01 am

karlkiste wrote:This explanation had made more sense to me, if both the anodes and the cathodes had been connected to GND. Then the swing would be limited to ±0.6v. Now it is limited to -0.6/+4.1v. Looks a bit like not much thought of to me.
Agreed - I'd have put it before the cap, where it would protect the GPIO. But it hasn't changed since the first version, so maybe the designer knows more than me?

I once came across a very expensive HI-Fi amp - so expensive it had no tone controls, and was DC-coupled throughout - the owner was complaining that the volume control was crackling.
Turned out his (very expensive) pre-amp was putting DC on its output. So I stuck a couple of caps on the volume control input. The guy was ecstatic. I never let on I'd removed the DC coupling - one of the 'features' he'd wanted when he bought it.

PiGraham
Posts: 3671
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: adding a speaker

Mon Sep 02, 2013 11:11 am

If you want a small, cheap amplified speaker you could do worse than one of these 'hamburger speakers' for under a fiver.

The sound quality and volume is similar to my Samsung Galaxy SII tat full blast and should be appropriate for a portable console project. You could probably extract the speaker and amp to fit them into your own case if the pop-up design doesn't suit you.

A switched 3.5mm jack socket will allow you to use the speaker of headphones.

karlkiste
Posts: 189
Joined: Tue Jan 22, 2013 8:50 am
Location: berlin, germany

Re: adding a speaker

Mon Sep 02, 2013 12:26 pm

But it hasn't changed since the first version, so maybe the designer knows more than me?
I presume, the problem is - that it works :-) It was never meant to be approved by hifi-freaks who claim to hear a difference between speaker cables made from copper and those made from silver. I think it is a quickly designed part which does produce sound. The worst shortcomings are now worked around in firmware, and here we are ;-)

Metatronin
Posts: 55
Joined: Sat Aug 04, 2012 5:19 am

Re: adding a speaker

Mon Sep 09, 2013 5:26 am

You can run several LM386's off of the 5v GPIO. However you can just tie the left and right channels together and do a mono set-up with one chip and just a few capacitors. Less than 5$ in parts. Or spend 10-20$ for a mini 1-5W amplifier chip. Adafruit makes one(class D amp). If you can solder into the jack from the backside you could keep the headphones ability, and add a speaker with lm386 and a tiny audio pot/wheel. Just use a low power flat speaker that's rated at no more than 3W.

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: adding a speaker

Sat Sep 21, 2013 12:31 pm

While continuing the "speaker" discussion my local Poundland have been selling battery powered speaker amplifiers today.
The speakers have a nasty tinny audio response, however you could wire something much bigger and better for improved fidelity.
The amplifier IC itself an LM4871 has a mono output in BTL mode and operates from a wide power supply 2.0v to 5.5v.
If you're thinking of building an amplifier but don't want the hassle then this £1 kit is perfect for hacking and running off the Pi’s power supply (or 2 x for stereo output).

Richard S.

Return to “Graphics, sound and multimedia”