Mattb1969
Posts: 8
Joined: Sat Aug 27, 2016 9:29 am

Background Hiss from Audio jack

Mon Jun 10, 2019 8:56 pm

Hi,

I’ve making a coin drop machine as a project for a local charity to raise some much needed funds to replace the heating system for the old building. So far we have built the coin drop machine and as part of the design I have reed switches to trigger when the coin drops to the bottom. I’ve written a fairly simply python program that has events setup on 3 GPIO channels that trigger pygame to play the associated sounds and flash less for a light show.

I’m having a few challenges with the quality of the audio produced as there is a continual background hiss and crackle which is worse while the python program is running. The setup I have is the audio from the jack is fed into amplifier and then into a PC speaker. Everything works fine except the hiss.

I have tried a number of different things including:-

- A USB audio device
- Various different RPIs, including a zero, a original B and the latest revision
- I’ve added disable_audio_dither=1 to config.txt
- Setting audio output to the jack socket
- different amplifiers

One thing I have noticed is that the hiss is markedly louder when the program is running, so I assume it is processor noise that is feeding into the audio channel.

Due to budget constraints I am reluctant to buy an audio card as the coin machine is part of a fund raising project.

Anybody got any ideas on what I can try to resolve it?

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

Re: Background Hiss from Audio jack

Tue Jun 11, 2019 9:53 am

My Pi analogue out produces hisses and crackles when connected to a self-powered mini-speaker but was as crystal clear as it could be when connected to the Hi-Fi when I tried that a while ago. So, unless things have got worse since then, I would guess it comes down to 'immunity to RF and EMI' of the cable and amp rather than it being a Pi problem per se.

LTolledo
Posts: 1643
Joined: Sat Mar 17, 2018 7:29 am

Re: Background Hiss from Audio jack

Tue Jun 11, 2019 11:51 am

I encountered this on any amp sharing the same power supply with the RPi (either taking from the USB port, or from a split in the microUSB cable line).

clamping some ferrite cores to the power line and both sides of the audio line did "attenuate" the hiss and crackles, but still there.
Using separate power supply unit made better improvements
I think I did some post on that here in the forum... let me post the link later....

now am using DAC HAT with built in Amplifier (like the Supronics X400) and its been great ever since (my DIY VU meter decks are happy as well)
later this month am going to try one other DAC/AMP HAT intended for an RPiZW....

Edit: found the link
viewtopic.php?f=29&t=202961&p=1416561&h ... s#p1416561

oh...and one other thing.... don't connect the ground lines as a loop
and its best to connect the ground line of each device to a single point (ground star connection)
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

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

Re: Background Hiss from Audio jack

Tue Jun 11, 2019 12:49 pm

LTolledo wrote:
Tue Jun 11, 2019 11:51 am
I encountered this on any amp sharing the same power supply with the RPi (either taking from the USB port, or from a split in the microUSB cable line).
A very timely observation. My self-powered speaker contains a LiPo, charged via USB. I just re-tested and -

When connected to the same USB PSU as the Pi; hiss and crackles.

With the USB cable unplugged, running from internal battery; no crackles, very slight hiss.

When plugged into a cheap USB PSU; no crackles but some 50Hz mains hum.

When plugged into a better USB PSU; no crackles, no mains hum, very slight hiss.

Using a set of cheap mains-powered PC speakers; crystal clear, no hiss.

So, for both of us, it seems our problem is the Pi causing interference on the PSU which is then making its way to the audio amp connected to the same PSU.

If the OP's PC speakers are USB powered; it's probably worth trying mains-powered speakers. If they are mains-powered maybe try a different pair.

User avatar
Imperf3kt
Posts: 2527
Joined: Tue Jun 20, 2017 12:16 am
Location: Australia

Re: Background Hiss from Audio jack

Tue Jun 11, 2019 7:43 pm

hippy wrote:
Tue Jun 11, 2019 12:49 pm
So, for both of us, it seems our problem is the Pi causing interference on the PSU which is then making its way to the audio amp connected to the same PSU.
Wouldn't that be the other way around? The amplifier is causing interference on the ground plane which is affecting the audio output on the Pi and thus feeding into the amp
55:55:44:44:4C
52:4C:52:42:41

LTolledo
Posts: 1643
Joined: Sat Mar 17, 2018 7:29 am

Re: Background Hiss from Audio jack

Tue Jun 11, 2019 9:33 pm

hippy wrote:
Tue Jun 11, 2019 12:49 pm

So, for both of us, it seems our problem is the Pi causing interference on the PSU which is then making its way to the audio amp connected to the same PSU.

If the OP's PC speakers are USB powered; it's probably worth trying mains-powered speakers. If they are mains-powered maybe try a different pair.
I've been doing lots of experimentation on improving my audio experience with the RPi
...was so bent on using single power supply at that time ( started with RPi3B and Jessie with Pixel).

back then I thought that the PSU type was a problem (switching regulators vs linear regulators)
made an "old school" 5.1v 3A linear regulator (transformers, bridge rectifiers, LM338, large heatsink, and large capacitors) for the test
was an expensive setup, did not improve audio....but was nice to have during the cold months (generating lots of heat).

found another link to my old post detailing some of my test
viewtopic.php?f=91&t=226228&p=1389188&h ... o#p1389188
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

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

Re: Background Hiss from Audio jack

Tue Jun 11, 2019 10:12 pm

Imperf3kt wrote:
Tue Jun 11, 2019 7:43 pm
hippy wrote:
Tue Jun 11, 2019 12:49 pm
So, for both of us, it seems our problem is the Pi causing interference on the PSU which is then making its way to the audio amp connected to the same PSU.
Wouldn't that be the other way around? The amplifier is causing interference on the ground plane which is affecting the audio output on the Pi and thus feeding into the amp
I guess the way to tell would be to cut the ground wire to the 3.5mm jack plug. I'll see if I can find an extension cable which volunteers itself for being sacrificed.

I was thinking it more likely the Pi is propagating EMI than the amplifier seeing as it's a thing with MHz of oscillation from various clocks and signal lines where the amplifier is just a single linear chip.

That would also seem to correlate with things getting worse when the Pi is running harder, because that shouldn't have any effect if the issue was originating from the amp.

User avatar
Imperf3kt
Posts: 2527
Joined: Tue Jun 20, 2017 12:16 am
Location: Australia

Re: Background Hiss from Audio jack

Wed Jun 12, 2019 8:47 am

I was actually suggesting you might have a ground loop.
https://en.m.wikipedia.org/wiki/Ground_ ... ectricity)

Cutting the ground on the 3.5mm jack won't help, and instead could make the matter worse.

The reason why the noise changes with processor load would be because as the processor works harder, it draws more current, and the potential on the ground changes, resulting in a different hum/buzz/crackle/other noise.
55:55:44:44:4C
52:4C:52:42:41

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

Re: Background Hiss from Audio jack

Wed Jun 12, 2019 9:38 am

Imperf3kt wrote:
Wed Jun 12, 2019 8:47 am
I was actually suggesting you might have a ground loop.

Cutting the ground on the 3.5mm jack won't help, and instead could make the matter worse.
I don't see why it would not help or make things worse. A ground loop is when a 0V (ground) from one item goes to the 0V (ground) of another item through two separate paths. The cure is to remove one of those signal paths, which prevents it being a loop.

This is roughly what we have -

Code: Select all

      .----------------------.
      |                      |       Amplifier
      |   .------------.     |   .--------------.
5V ---^---|----.-----  |     `---|---------.    |
          |    |       |         |         |    |
          |  |\|       |         |   _   |\|    |
          |  |  >------|---------|--|_|--|  >---|----.
          |  |/|       |         |       |/|    |   _|_ /|
          |    |   .---|--X------|--.      |    |  |_ _| |
          |    |   |   |         |  |      |    |    |  \|
0V ---.---|----^---^-  |     .---|--^------^----|----'
      |   `------------'     |   `--------------'
      |                      |
      `-------------------Y--'
The ground loop would be the two 0V connections which pass through X and Y. Cutting either would remove the ground loop.

It would be better to cut X rather than Y so the current through the amp doesn't then pass through the Pi's 0V tracking from X to 0V.

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

Re: Background Hiss from Audio jack

Wed Jun 12, 2019 10:14 am

The trouble with that is that any ground current feeding the amp will superimpose noise on the audio.
The solution - or at least one solution - is to totally isolate the audio ground from the power ground, with perhaps an audio transformer

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

Re: Background Hiss from Audio jack

Wed Jun 12, 2019 10:43 am

An additional way to tell if it is ground loop or something else, would be to power the amplifier separately while connecting the amplifier's 0V to the Pi's PSU 0V.

That would keep the ground loop in place and, if hiss and crackles go away, it suggests they are related to the common 5V connection.

And the result for me; hiss and crackles went away.

Return to “Graphics, sound and multimedia”