• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Boost sound from Raspberry pi

Status
Not open for further replies.

lilimike

Member
When I connect the Raspberry Pi (running the Linux application Mplayer2 streaming music or playing an MP3 file) to the phone system and I put a phone on hold, I hear next to nothing, I just barely distinguish that music is playing.
When I try to connect an 8Ω speaker directly to the analog output of the Pi I am getting just a little more volume as with the phone system. Since I do not have access to the phone system I am testing with the speaker. I figured it was close enough.

The phone system in question is a Norstar ICS 4.0 and from its manual it indicates the folowing:
Code:
External music source (customer supplied)
The music source can be any approved low-power device such
as a radio with a high-impedance earphone jack. The
recommended ICS input level is 0.25 V rms across an input
impedance of 3300 Ω.
My objective is to reach he maximum volume possible with no distortion and from this I can control (reduce) the volume from the Mplayer2 command line application.
 

lilimike

Member
Hi



Knowing that the LM386 amp solution works perfectly to solve your sound problem, I would say you should let sleeping dogs lie, and move on to deal with overheating problem, as that's a whole lot easier to fix.

Three pin linear regulators produce heat, as watts, based on how much current is going through them times the voltage drop across them. You are dropping from 9 volts down to 5 volts, or 4 volts of drop, times the max current of the RassPi, which as stated is 1 Amp. So with 4 volts times 1 amp, you are dissipating 4 Watts in the LM7805. Without heat sinking, it is obviously going to overheat.

Your first and simplest option, is to try and heat sink it better. But this is not a great solution, as you need it in an enclosed space. Second is to try and drop some of the voltage in an external part before it gets to the regulator. Something like a resistor, transistor, or zener can be made to do this. But this is also not the best solution as the added part will just be taking the heat burden in the LM7805's place.

With the above in mind, why don't you use one of TI's "SIMPLE SWITCHER®" products, or something similar? They are very simple, easy to use buck converters in a TO-220-5 package with a minimal need for external parts. They are almost exactly like their three terminal cousins. The difference is these guys operate in switching mode, so they have almost no power loss, and thus, virtually no heat production. Doing this side steps the whole overheating issue, and has the added benefit of being more power efficient. Win-Win honestly.

Something like the LM2575T-5.0 would be a perfect fit, and is only $2.50 +S&H. It only needs 4 external parts, two you are going to have to use for a three terminal regulator anyway. *HERE* is the data sheet. Note that C[SUB]out[/SUB], like most SMPS output caps, needs to be a low ESR type or it will fail prematurely. You CAN get away with paralleling a bunch of normal electrolytic caps together, but you probably shouldn't.
This is good information. I am still going to try a little harder to have my solution using the original 5V but as a next option I will try this out.

Thank you!

Mike
 

()blivion

Active Member
I am still going to try a little harder to have my solution using the original 5V
Something like the MAX9722A can do what you want then as it has an internal charge pump. But you will need a TSSOP-16 or THIN QFN breakout to use it with protoboard. And using a breakout might cause layout related issues.
 

ronv

Well-Known Member
Most Helpful Member
The LM386 should have worked with 5 volts. Since you have a scope set the output to .25 volts. This won't be very loud into a speaker, but might be loud in an earphone or phone system. While your at it measure the input from the raspberry.
 

()blivion

Active Member
Yeah actually, it really should have worked. It should work with the Pi honestly, as 0.25 V RMS across 3300 Ω is not really very high demand. Shouldn't the Pi easily be able to output this? I wonder if the input to the phone system is not somehow damaged and drawing more current than it should be? Then again, I don't really know for sure.

I just came in because the regulator problem was easy to solve.
 

ronv

Well-Known Member
Most Helpful Member
Your probably right (). I don't know what the raspberry put out. Do you?
 

lilimike

Member
I am trying again with the LM386 at 5V and the volume at 1/4 the sound is quite bad, sounds like a train + and distortion.
Do I need a tone generator to measure the output from the Raspberry Pi? using music it keeps changing.

Edit: Maybe my values or something is wrong?
This is what I have:
LM386.PNG
 
Last edited:

lilimike

Member
I think I have found why the sound is so bad...
I am using LM386N-4 and according the the datasheet Min = 5V
The RasPi is delivering 4.8V

Perhaps I should use LM386N-1 which requires Min=4V ?
 

()blivion

Active Member
As far as I know, a LM386N is a LM386N no matter how you slice it. I don't think there is a real difference between -1 or -4. And even so, 4.8 volts is really close.

Edit: That doesn't mean that running so close to the min isn't the problem. Just that the different part number shouldn't make a difference.

What datasheet are you reading from? Can you provide a link?
 

ronv

Well-Known Member
Most Helpful Member
With the capacitor from 1 to 8 your gain is 200 so the output is probably clipping even when the pot is close to 0. You might also put a little resistance in series with the cap on the output. If you don't have 10Ω use 4.7 or 15. When you scope the output the voltage swing should be below 4 and above 1 or it is still clipping. The input should be less than 0.2 volts peak to peak. With those 2 numbers you should be able to set the gain correctly.
Yes, the -1 part is the right one but the others will probably work.
 

audioguru

Well-Known Member
Most Helpful Member
Remove your C1. It makes the gain way too high.
Add a 10 ohm resistor in series with C5 as shown on EVERY schematic in the datasheet of the LM386. It might oscillate without it.
The 220uF capacitor C2 is calculated for an 8 ohm load. To feed the 3300 ohm input of the phone system it should be 0.47uF or 1uF.

If you built the amplifier on a solderless breadboard then it is probably oscillating and distorting due to the high capacitance between rows of contacts.

With a 5V supply, the maximum output without distorting of an LM386 into a 3300 ohm load is 3.8Vp-p which is 1.34V RMS which is more than enough.
 

lilimike

Member
Ok I've removed C1 and that took a chunk out of the speaker volume as I went from a gain of 200 to 20, I added a 10Ω in series with C5 (that didn't make a difference but it is there now) and when I replaced C2 with 1uF the volume in the speaker is the same as if It was plugged in directly to the Pi (to my ears) I guess due to the speaker being 8Ω and the output now configured for 3.3k so I will solder everything like this and test it on the phone system hopefully this weekend.

Thank you all for your help.

Mike
 

lilimike

Member
I tested on the phone system and using 5V (from the Pi) I had to leave C1 and keep C2 at 220uF. Somehow I figured the 3.3k spec I read in the manual was either a min or a max or I simply had the wrong manual.
What I hear on the phone system is exactly the same as when I plug an 8Ω speaker.
Something I was not comfortable with was the volume generated distortion at less than about 1/4 of the way. I added a 100k resistor in series with the audio input and it now performs better, distortion starts at 3/4 up.
I have everything soldered and enclosed in a plastic box.
I still have a 4Hz low sound that becomes noticeable only when the music stops, I can live with this but if I had a fix it would make it perfect!
 

audioguru

Well-Known Member
Most Helpful Member
Since you needed to use a 220uF output capacitor on the LM386 amplifier then the input impedance of the phone system music-on-hold must be 8 ohms, not 3.3k ohms.
 

ronv

Well-Known Member
Most Helpful Member
You might need some big (maybe 47Ufd.) filter caps on the supply voltage and pin 7 to eliminated the "putt putts'. If you need more output without distortion it sounds like a 12 volt wall wort is in your future. :D
 

lilimike

Member
I tried adding a 47uF cap between pin 7 and ground, also tried between pin 7 and +5V and tried to add a 220uF between +5V and ground and it didn't make a difference. It sounds like a choo choo train when the volume is full down or when the music stops and turning the volume up doesn't seem to make that sound louder but when I stop the Mplayer service the sound stops so it must be something else but it is not noticeable when the music is playing so I can live with this.

As this project is for a specific use and I have to deliver, I will let it go as is. But working on this gave me a bunch of ideas so I've placed an order for a bunch of parts among which the LM2575T-5.0 suggested by ()blivion so I can get more power.

Mike
 

audioguru

Well-Known Member
Most Helpful Member
If you need more output without distortion it sounds like a 12 volt wall wort is in your future. :D
No.
The datasheet for the LM386 little power amplifier shows that a supply that is higher than about 9V simply increases the heat but barely increases the output power.
 
Status
Not open for further replies.

EE World Online Articles

Loading
Top