Jump to content

Raspberry Pi Music Streamer Clean Power Supply?


Richard10002

Featured Posts

Over the past week I've created a music streamer by loading Pi Core Player onto a Raspberry Pi 4b. The digital signal goes from the Pi's USB socket to a Topping E30 DAC, and then to a Sony Car Stereo head unit.

 

Feeding both Pi and DAC from USB sockets on the boat supply, there is an irritating hiss from the speaker. If I feed the Pi and DAC from a 10,000 mAh rechargeable battery pack, the hiss disappears, and the sound is very good, but it doesn't last a full day.

 

I can understand the boat power supply being electrically noisy, and am wondering if there is anything I can fit either before, or after, the USB sockets, or even if a special USB socket exists that eliminates the electrical noise?

 

Some suppliers of HATs for the Pi actually recommend using a battery pack for a clean power supply, so I might have to get a bigger rechargeable battery pack if I can't clean the boat supply.

 

 

Link to comment
Share on other sites

I think it is not so much the boat’s power supply, as the 12v to 5v reduction that occurs in the USB socket. This will be some sort of switch mode buck converter that involves switching (square waveform) at a high frequency.

 

So the answer will be to filter out the noise created by the switching, using eg a choke and capacitor filter. Or (easier in practice) get a better USB socket with low noise 12v to 5v reduction circuit.

Link to comment
Share on other sites

 Check all the cable screens are in good order and continously connected.

 

After that the obvious answer is to stick the output on a 'scope. I think there are fairly simple  Pi projects to make one, if you don't have one.   No need for super high frequency capability, you have an audio problem☹

Then an RC filter to get rid of the noise.

 

You could also try feeding the Pi from the boat and the DAC from the battery to see which is being affected most by the power supply.

 

 I would see what happens if you put the battery in parallel with the boat supply.  The battery may be able to swallow the noise.

N

Link to comment
Share on other sites

A possible source of the problem is a ground-loop. The audio output of the DAC is referenced to the same ground as the power supply, so changes in the current used by the DAC and the PI get coupled into the audio by the non-zero resistance of the supply cables. The normal solution is an isolating transformer on the audio.

 

MP.

 

Link to comment
Share on other sites

The root of the problem will be the switching converter as Nick has said. If there is a ground loop issue, then filtering may well not work. (I tried inductors, capacitors on my media player and had no joy.) Try swapping the battery to just one of the devices to see if one or other is the issue. If either sorts it (ie one device on battery other on USB) then you have a ground loop problem. Otherwise it's plain supply noise. Consider using an analogue regulator such as a 7805. Will be slightly less efficient, but with the small currents involved may not be an issue.

Link to comment
Share on other sites

8 hours ago, MoominPapa said:

A possible source of the problem is a ground-loop. The audio output of the DAC is referenced to the same ground as the power supply, so changes in the current used by the DAC and the PI get coupled into the audio by the non-zero resistance of the supply cables. The normal solution is an isolating transformer on the audio.

 

MP.

 

Had this on my boat, but with the 12V computer that was doing the audio being driven by a mains power brick and the audio amplifier driven by the 12V batteries. An isolating transformer in the audio lines solved it.

Jen

Link to comment
Share on other sites

I had possibly related issues with a laptop  driving a usb soundcard and the signal connected to a car radio. This was a ground loop, or strictly a ground noise problem. The Laptop and radio have individual 12 volt supplies both running to the distribution board at the back of the boat so a lot of cable length to develop volt drops on the negative wires. I solved this with a audio transformer. I have now upgraded things and use some good active bookshelf speakers, these have an optical input so I used the optical output from the soundcard to avoid any common grounds. Optical is a good way to go on boat 12 volt systems.

 

.................Dave

Link to comment
Share on other sites

14 hours ago, BEngo said:

 Check all the cable screens are in good order and continously connected.

 

Check!

 

14 hours ago, BEngo said:

 

After that the obvious answer is to stick the output on a 'scope. I think there are fairly simple  Pi projects to make one, if you don't have one.   No need for super high frequency capability, you have an audio problem☹

Then an RC filter to get rid of the noise.

 

Cant see me making a scope, but maybe if necessary. Is an RC something I can buy and fit?

 

14 hours ago, BEngo said:

 

You could also try feeding the Pi from the boat and the DAC from the battery to see which is being affected most by the power supply.

 

I've done that, and vice versa, and the effect is much the same both ways.

 

14 hours ago, BEngo said:

 

 I would see what happens if you put the battery in parallel with the boat supply.  The battery may be able to swallow the noise.

 

 

It's a TP Link Power bank with a micro USB charging socket. If I plug the charging cable in, the power out cuts off. I'm wondering if there are some power banks like these that will allow power out when charging.

 

At worst, I suppose I could have 2 power banks, so one can be on charge while the other is being used, but it would be good if the Pi and DAC could be plugged into the mains 24/7 so I dont have to faff around with batteries.

Link to comment
Share on other sites

14 hours ago, MoominPapa said:

A possible source of the problem is a ground-loop. The audio output of the DAC is referenced to the same ground as the power supply, so changes in the current used by the DAC and the PI get coupled into the audio by the non-zero resistance of the supply cables. The normal solution is an isolating transformer on the audio.

 

MP.

 

 

Sounds good. I dont really know what one is? :( Is there a USB version of an isolating transformer and where would it go? Audio goes from the Pi USB socket to the DAC USB input, then from DAC to amp via RCA cables.

5 hours ago, Floating Male said:

The root of the problem will be the switching converter as Nick has said. If there is a ground loop issue, then filtering may well not work. (I tried inductors, capacitors on my media player and had no joy.) Try swapping the battery to just one of the devices to see if one or other is the issue. If either sorts it (ie one device on battery other on USB) then you have a ground loop problem. Otherwise it's plain supply noise. Consider using an analogue regulator such as a 7805. Will be slightly less efficient, but with the small currents involved may not be an issue.

 

Done the swap thing, and neither sorts it. I've googled 7805 analogue regulator and find things that have 3 prongs and look like they need soldering somewhere, which is beyond me. Is there something ready made with connectors, so it can be slotted..... where?

Link to comment
Share on other sites

4 hours ago, dmr said:

I solved this with a audio transformer.

 

As above, this is all a bit beyond me. Is there an example of one, how it would fit, and where?

Thanks to all for the help.... looks like I need spoon feeding with all these gizmos, or to take the easy workaround of 2 power banks.

Link to comment
Share on other sites

26 minutes ago, Richard10002 said:

 

Sounds good. I dont really know what one is? :( Is there a USB version of an isolating transformer and where would it go? Audio goes from the Pi USB socket to the DAC USB input, then from DAC to amp via RCA cables.

In the RCA cables.  Eg. https://ebay.co.uk/itm/3-5mm-Car-RCA-Amplifier-Audio-Noise-Filter-Ground-Loop-Isolator-Channel-Tool/313465473734

 

MP.

 

 

Edited by MoominPapa
  • Greenie 1
Link to comment
Share on other sites

11 minutes ago, DaveP said:

I used an optical output from the pi to eliminate this problem.  I used this one, only issue being having to cut the housing to get the connector out. https://www.tindie.com/products/beni_skate/tinytoslink-raspberry-pi-optical-audio/

 

I could get a HAT with an optical output. I think JustBoom or HifiBerry do one.

Link to comment
Share on other sites

If you want to try the 7805 then this module would do the job and replace your usb drivers.

https://www.ebay.co.uk/itm/L7805-LM7805-Three-Terminal-Voltage-Regulator-Module-Power-Supply-7-5V-20-to-5V/161798846149?_trkparms=aid%3D111001%26algo%3DREC.SEED%26ao%3D1%26asc%3D20160811114145%26meid%3Dbcbbddcf1d4f43c8a693065c2699fb18%26pid%3D100667%26rk%3D1%26rkt%3D8%26mehot%3Dag%26sd%3D161798846149%26itm%3D161798846149%26pmt%3D0%26noa%3D1%26pg%3D2334524%26brand%3DUnbranded&_trksid=p2334524.c100667.m2042

 

Also be aware the transformer will only solve the problem if it is a ground loop that is causing the noise. Whilst this is sounding quite likely, given the testing of each item separately, there may be induced noise into the circuits as well. Also (depending upon how critical you are) the transformers will degrade your audio a bit. Probably not an issue, but my ears don't like them!!

 

The 7805 solution will still give you a direct audio link, the ground loop will be a DC drop, which you will be unable to hear!

 

Course you could go mad and do both. Its only £12 the lot, which is seriously cheap by boat standards!

Link to comment
Share on other sites

4 hours ago, Floating Male said:

The 7805 solution will still give you a direct audio link, the ground loop will be a DC drop, which you will be unable to hear!

 

With the 7805 gizmo you link to it looks like a power cable goes in one end and out the other, which is straightforward, but where does it go? Do I break into a USB power cable to find the power wires? Or does it go in an audio feed, (still USB or RCA cables)?

 

It cant go in the 12v supply to the USB sockets as it outputs 5V - unless I'm missing something - maybe it can?

 

4 hours ago, Floating Male said:

 

Course you could go mad and do both. Its only £12 the lot, which is seriously cheap by boat standards!

 

When you say both, do you mean the audio transformer, (ground loop), and the 7805 thing, (circuit noise)?

 

Given that this is a bit of a learning* thing, as well as an attempt to get good sound on the cheap, a few quid here and there is not deal breaking.

 

*On the learning thing, is there a more appropriate forum where this kind of thing is discussed quite regularly - more the noise in the circuit, and ground loop, thing, rather than Raspberry Pi?

Link to comment
Share on other sites

The 7805 board replaces your USB driver. So the input comes from your 12V boat electrics. and the output is 5V and feeds the Pi and DAC instead of the output of your USB driver. Both do a similar job, but the USB device is more efficient (But noisy!).

 

Regarding learning, I'm not aware of a better site. Having spent 50 years doing electronics and sound I've sort of passed that point!

Anyway it sopunds like your almost there.

 

John

Link to comment
Share on other sites

On 26/03/2021 at 12:44, Floating Male said:

The 7805 board replaces your USB driver. So the input comes from your 12V boat electrics. and the output is 5V and feeds the Pi and DAC instead of the output of your USB driver. Both do a similar job, but the USB device is more efficient (But noisy!).

 

Regarding learning, I'm not aware of a better site. Having spent 50 years doing electronics and sound I've sort of passed that point!

Anyway it sopunds like your almost there.

 

John


OK :) so I have two 5v cables coming out of the 7805 with bare ends. Given that the Pi has a USB C power input, how do I get the 5v from the bare wires to the USB input?

 

I appreciate that I good put some “terminals” on the bare cables and slot them onto two of the 40 pins on the Pi, but that’s not particularly user friendly, and would probably preclude the fitting of a HAT, (Allo, Justboom, Hifiberry etc.).

 

I suppose there will be a cable I could buy that has bare ends at one end, and a USB C at the other?

Link to comment
Share on other sites

Hmm.

I had a quick look and couldn't find a lead - USB C to bare wire. You could just cut one of course.

In the long run why not fix a usb type a socket on the output of the 7805 board (all in a box) so you can use the lead I presume you already have?

I may be missing the point as I'm not sure of exactly what you have.

John

Link to comment
Share on other sites

14 minutes ago, Richard10002 said:

I appreciate that I good put some “terminals” on the bare cables and slot them onto two of the 40 pins on the Pi, but that’s not particularly user friendly, and would probably preclude the fitting of a HAT, (Allo, Justboom, Hifiberry etc.).

 

You can do that yes. As you say, it makes using hats as well difficult. You also have no protection from mistakes. Over voltage, or reversed connection and your Pi will release its magic smoke.

 

15 minutes ago, Richard10002 said:

I suppose there will be a cable I could buy that has bare ends at one end, and a USB C at the other?

You can indeed get these. This link is French, but it is the first one I found. Someone will sell these on Ebay for sure.

https://www.audiophonics.fr/en/power-supply-accessories/male-90-angled-usb-c-to-bare-wires-power-cable-22awg-25cm-p-13575.html

Jen

  • Greenie 1
Link to comment
Share on other sites

35 minutes ago, Floating Male said:

Hmm.

I had a quick look and couldn't find a lead - USB C to bare wire. You could just cut one of course.

In the long run why not fix a usb type a socket on the output of the 7805 board (all in a box) so you can use the lead I presume you already have?

I may be missing the point as I'm not sure of exactly what you have.

John


You’re not missing the point at all.... however, some phrases that roll off your tongue are like a foreign language to me :) , and I’m going to have to get to grips with soldering.

 

”fix a usb type a socket ........ “

 

Presumably one of these and some soldering? Which is the +ve connection, D+, D-, Vbus? Presumably Gnd is -ve.


https://www.ebay.co.uk/itm/2-x-USB-Type-A-Female-Socket-Breakout-Board-2-54mm-Pitch-Adapter-Connector-DIP/232686107596?hash=item362d2c3bcc:g:zDoAAOSw24RbDDaV

 

Link to comment
Share on other sites

D+ & D- are the data lines that you wont use.

Vbus is +5V

and Gnd is -ve

 

Marks 1/4 ? and yes you will have to do a bit of soldering.

What else would you be doing at the moment???

Link to comment
Share on other sites

15 minutes ago, davewally said:

Have you tried feeding the PI from the battery pack whilst the battery pack is in charge?


Yes.. the power out stops as soon as I plug the charging cable into the pack. TP Link 10,000mAh pack, about 5 years old, so things may have moved on by now:

 

I have wondered if there is a battery pack that will charge whilst allowing power out. If it could be USB C with higher wattage, (PD? 60w, 100w?), that could be ideal, as the charging would probably keep up with the discharge.

Link to comment
Share on other sites

On 25/03/2021 at 19:28, dmr said:

I had possibly related issues with a laptop  driving a usb soundcard and the signal connected to a car radio. This was a ground loop, or strictly a ground noise problem. [...] Optical is a good way to go on boat 12 volt systems.

Or Bluetooth, if you don't mind the slight delay & extra pairing fuss.

 

I have a 12V ex-car amp and the Bluetooth audio adaptor on that wanted a nice clean 5V supply, so I am taking that with a 7805 + standard smoothing capacitors, off the 12V for the amp. With a bolt into the amp's case so the 7805 can share its heatsink. I did try a (cheap) ground isolating transformer but didn't like it - forgotten why.

 

Bear in mind that the 7805 is ~40% inefficient, causing both power waste and excess heating. The usual 12V->5V converters are about 90% efficient and so can supply more power in a smaller box without overheating. You want to power the audio section with it, but prefer to avoid powering the Pi from 7805...  but then where they're electrically connected they need a (close enough) shared ground. Hence using optical or wireless over that gap.

 

There will be various ways to solve the problem, but if you want to do it quickly or efficiently it will be easier if you're near somebody who has the right kit and a spare hour (but lockdown fuss, ugh)...  which for Manchester'ish is not me this time, sorry.

 

15 minutes ago, Richard10002 said:

I have wondered if there is a battery pack that will charge whilst allowing power out. If it could be USB C with higher wattage, (PD? 60w, 100w?), that could be ideal, as the charging would probably keep up with the discharge.

In my experience most don't work in "UPS mode" like that. If you find one that does, you may bring back the ground noise by doing so.

ps. you can get ground-isolating USB adaptors, which only half solve the problem, but ISTR they are expensive.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.