Continue to Site

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.

  • 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
I am looking for a cheap way to boost the analog sound from a Raspberry pi.

We have a phone system with a radio connected to it to play music for when a customer is on hold. Since the location gives poor signals and any radio station does not come in clear, I replaced the radio with a Raspberry pi and set it up to stream from the web.
Using mplayer2 there are some volume options to boost the sound but it comes with lots of distortion.

The phone system specs calls for an input level of 0.25 V rms across an input impedance of 3300 Ω.

Is there a circuit I can build for under $20 to boost the sound without distortion?
I don't need much level difference and the input is mono.

Mike
 
That came across my mind but I wasn't sure if it would generate distortion.
I will play with that.

Thanks.

Mike
 
I preferred a solution that could work from the 5V supplied from the Raspberry pi, so I tried using the LM386 audio amp. at 5 Volts I got too much distortion so (I could be wrong but) my next option was to use 9 volts supply to the LM386 and then a 5 Volts regulator to supply the pi. I didn't try this yet but having 2 different supplies (5 V to pi and 9V to LM386) is working perfectly when I set the volume at midway using the suggested diagram below.
lm386.PNG
The only difference is I didn't add a bypass capacitor at pin 7 and I didn't have a 10Ω for pin 5 so I connected the capacitor directly to ground. Does this cause an issue (long term maybe? as it is working fine for now with clear sound)

Something else I found mysterious; I wanted to replace the 10k pot with 2 fixed resistors. I tested the pot resistance at best setting, my 10k pot was actually 11k, and was very close to mid point give or take .5k so I used 2x 5.6k resistors (ground to pin 3, Vin to pin 3) and got a lot of distortion. Does this make sense?
 
I preferred a solution that could work from the 5V supplied from the Raspberry pi, so I tried using the LM386 audio amp. at 5 Volts I got too much distortion so (I could be wrong but) my next option was to use 9 volts supply to the LM386 and then a 5 Volts regulator to supply the pi. I didn't try this yet but having 2 different supplies (5 V to pi and 9V to LM386) is working perfectly when I set the volume at midway using the suggested diagram below.
View attachment 70746
The only difference is I didn't add a bypass capacitor at pin 7 and I didn't have a 10Ω for pin 5 so I connected the capacitor directly to ground. Does this cause an issue (long term maybe? as it is working fine for now with clear sound)

Presumably you're wanting to feed a speaker? - which you didn't mention previously - in which case you need a power amp, like the LM386.

The bypass cap is optional, and the 10 ohm is part of a zobel network, probably OK with it shorted out.

Something else I found mysterious; I wanted to replace the 10k pot with 2 fixed resistors. I tested the pot resistance at best setting, my 10k pot was actually 11k, and was very close to mid point give or take .5k so I used 2x 5.6k resistors (ground to pin 3, Vin to pin 3) and got a lot of distortion. Does this make sense?

Mid-point of a log volume pot will be nothing like half way, try a 10K (top) and 1K (bottom) and see what that's like.
 
Sorry for the confusion, the output of Raspberry Pi is going to the phone system and the only information I had was the specs I indicated in my first post. After some testing I got the same results as connecting to some cheap speakers.
I ended up not replacing the pot as some streaming radio stations have different volume levels. The one thing I did try was to add an LM7805 to feed the RasPi. The power source is a wallwart 9V 1A. I added a small heatsink such as this one with some cooler paste I normally use for CPU and it all works but it is getting hot, too hot to hold it for more than 3 seconds. So I connected my multimeter in series to see what the current consumption is but doing so I only get 185mA and the RasPi won't boot up so I have no way to figure out what the real consumption is.

Based on RasPi specs it should not exceed 1A and my application does not involve video or USB.
Is there another way to calculate current?
 
Did you fit the essential capacitors as close as possible to the 7805?. I've no idea what the current consumption is, I feed mine from a 5V wallwart.

But there's no need or reason to use an LM386 for this use, an opamp would be a better solution.
 
Yes the caps are right next to it (on breadboard) is there any opamp that can accept a single supply at 5V?
 
Using mplayer2 there are some volume options to boost the sound but it comes with lots of distortion
If the sound is distorted at source then no amount of simple amplification will remove the distortion.:(
is there any opamp that can accept a single supply at 5V?
There must be plenty out there (e.g. the LM324). But not all will have enough drive current for your purpose, or will not have rail-to-rail output. Someone here should be able to advise on a suitable one.
 
If the sound is distorted at source then no amount of simple amplification will remove the distortion.
whatever is in the application (Mplayer2) that is boosting the sound is not doing a good job because If I use an LM386 instead I get crystal clear sound when boosted to the required level.

There must be plenty out there (e.g. the LM324). But not all will have enough drive current for your purpose, or will not have rail-to-rail output. Someone here should be able to advise on a suitable one.
Using the LM386 would be a great solution only I have to supply it with 9V and then reduce to 5V to supply the RasPi. Since I want to have the final product enclosed in a plastic box the heat is the only issue.

I will try out the LM324 and see how it goes.


Yes, plenty of them - or you could always generate a -5V supply, as I did in my analogue PIC tutorial.
Nigel If you are referring to the link you have in your signature, I could not find this information. Can you please indicate the URL.

Thanks
 
An LM324 has crossover distortion, is noisy (hiss) and has poor high frequency response.
With a 5V supply, its maximum output into a 3.3k load is only 3Vp-p. With a 5V supply, an LM386 power amp also has a maximum output of 3Vp-p.
 
I just got back from getting a few LM324 and 7660.
Audioguru what you are saying is at 5V the LM324 will not perform better than the LM386?
I did try the LM386 at 5V and there was too much distortion. (it may not be distortion but the sound quality was bad)

I am not understanding exactly how the 7660 is generating -5V from +5V does this mean I get a total output of 10V from a 5V input? Isn't this free energy?

Edit: OK, charge pump, starting to understand.
 
Last edited:
Like any amplifier that has its volume control turned up too high so its output is clipping, your LM386 did the same thing.
Yes, an LM324 produces exactly the same maximum output as the LM386 and it will have the same problem when they both have a 5V supply.
An MC34071 is a single opamp but the LM324 is a quad. The MC34071 has no crossover distortion and works well up to 100kHz so it is good for audio.
Its output voltage swing is the same as the LM324.

The 7660 has an oscillator that charges a capacitor to a negative voltage. Using it with an opamp will allow double the output swing from the opamp.
 
I definitely want to try the MC34071 but since I already have the LM324 + ICS7660 I gave it a try with those. This is my schematic:
lm324.PNG
I had a 10k Pot between pin 1 and the speaker but there was no significant enough sound unless the pot was at full position so I removed it. In this configuration I am getting about half the volume as I had with 9 Volts on the LM386. I would say the volume is at 75% of what I need. I tried 200K for R3 which I had hoped the gain would go from 100 to 200 but it didn't make a difference.

I don't know if the "hiss" sound you were talking about is what I hear but if I have everything plugged in and I have no sound at the input I get a 3Khz sound. Unplugging the RasPi from the input stops this sound however I tried measuring at the input and get nothing. This is what I get with my scope at the output with everything connected and no sound from RasPi.
scope.jpg
Will the MC34071 resolve all of my issues or do I have other options?

Edit: Note C4 is reversed in the schematic, my actual design have the positive side to pin 2.

Mike
 
In your first post the phone system music input was 3.3k ohms. Now you are shorting the output of the LM324 opamp with an 8 ohm speaker?

Your voltage gain (for a 3.3k load) is awfully high at 101 times which is used for a microphone. Is the output level from a rasberry pie as low as a microphone?
Where is the volume control?
 
Hi

lilimike said:
Using the LM386 would be a great solution only I have to supply it with 9V and then reduce to 5V to supply the RasPi. Since I want to have the final product enclosed in a plastic box the heat is the only issue.

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 the 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.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top