abhi3188
Posts: 16
Joined: Mon Nov 16, 2015 7:34 pm

Whistling sound from speakers on connecting USB mouse

Sun Jun 10, 2018 8:41 pm

Hi,

I'm using GPIO12 & GPIO13 for PWM audio output to a set of powered speakers. However the speakers have a continuous high pitched beep to them which seems to be tied to the mouse being plugged into the USB port. As soon as I unplug the mouse, the beep disappears though there is still noise hiss/crackle emanating from the speakers. The speakers and Pi are powered from the same power supply.

I have attached a video that shows the problem. I can also seem to modulate the beep by lifting the mouse off the table https://streamable.com/qa66q

Any idea as to why this is happening?

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

Re: Whistling sound from speakers on connecting USB mouse

Mon Jun 11, 2018 10:31 pm

Is the mouse wired or wireless?

In any case, the cause is interfereance.

How have you wired it? (not in a position to view a video)
I suspect your wiring is acting like an antennae.
User experiencing technical difficulties.

abhi3188
Posts: 16
Joined: Mon Nov 16, 2015 7:34 pm

Re: Whistling sound from speakers on connecting USB mouse

Mon Jun 11, 2018 11:23 pm

It's a wired USB mouse. Any ways to minimize interference?

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

Re: Whistling sound from speakers on connecting USB mouse

Wed Jun 13, 2018 2:37 pm

Is the powered speaker getting its power from RPi USB hub? or are the two getting their power from the same power supply hub?

I encountered this problem before. Tried every solution to the point of using a 5v 10A single power supply with 2x2200uF capacitors for the USB mains and 100uF + 0.1uF for each USB port (made my own power hub then). Noisy as ever

The only solution that worked is separate power supply (from AC mains) for the RPi and the powered speakers.
"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!"

abhi3188
Posts: 16
Joined: Mon Nov 16, 2015 7:34 pm

Re: Whistling sound from speakers on connecting USB mouse

Wed Jun 13, 2018 4:26 pm

They are getting power from the same supply, not the Pi USB. I did try separate power supplies, it does get rid of the high pitched ring but there is still noise in the speakers.

The issue is I need to power the project from a single supply. I'm also using a 5V 10A supply. This should be more than sufficient to handle the power requirements but when I play anything I see the low voltage indicator crop up on the pi. And the high pitched issue continues to exist.

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

Re: Whistling sound from speakers on connecting USB mouse

Wed Jun 13, 2018 9:00 pm

abhi3188 wrote: The issue is I need to power the project from a single supply. I'm also using a 5V 10A supply. This should be more than sufficient to handle the power requirements but when I play anything I see the low voltage indicator crop up on the pi. And the high pitched issue continues to exist.
Failed to mention that I also clamped ferrite cores to the microUSB power cables (both sides of each cable). Reduced the noise, but still there.

Tried briefly (just for confirming) powering the whole setup using a 13000mAh USB Power Bank for "pure" DC supply. Noise gone (or have gone unnoticeable to me). However this method may be a bit impractical for you.
"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!"

User avatar
davidcoton
Posts: 3160
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Whistling sound from speakers on connecting USB mouse

Wed Jun 13, 2018 9:30 pm

abhi3188 wrote:
Wed Jun 13, 2018 4:26 pm
They are getting power from the same supply, not the Pi USB. I did try separate power supplies, it does get rid of the high pitched ring but there is still noise in the speakers.

The issue is I need to power the project from a single supply. I'm also using a 5V 10A supply. This should be more than sufficient to handle the power requirements but when I play anything I see the low voltage indicator crop up on the pi. And the high pitched issue continues to exist.
From your description it seems that your particular combination of Pi, mouse, speakers, PSU and wiring is causing an oscillation on the 5V rail. Do you have an oscilloscope to check the 5V rail? "Random" decoupling capacitors may help, but without a 'scope you won't really know what is happening.

Edit: typo
Last edited by davidcoton on Thu Jun 14, 2018 10:29 pm, edited 1 time in total.
"Thanks for saving my life." See https://www.raspberrypi.org/forums/viewtopic.php?p=1327656#p1327656
“Raspberry Pi is a trademark of the Raspberry Pi Foundation”

abhi3188
Posts: 16
Joined: Mon Nov 16, 2015 7:34 pm

Re: Whistling sound from speakers on connecting USB mouse

Thu Jun 14, 2018 3:52 am

Don't have an oscilloscope unfortunately to check but I can try to get my hands on one. What exactly should I be looking for and where would I ideally place the probes?

User avatar
davidcoton
Posts: 3160
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Whistling sound from speakers on connecting USB mouse

Thu Jun 14, 2018 5:15 pm

Check the 5V rail first, probably easiest on a 5V GPIO pin (TAKE CARE -- don't short anything with the probe).
Look for ripple at several kHz (corresponding to the whistle pitch).
Use AC coupling so you can observe the comparatively small ripple on top of 5V DC.
"Thanks for saving my life." See https://www.raspberrypi.org/forums/viewtopic.php?p=1327656#p1327656
“Raspberry Pi is a trademark of the Raspberry Pi Foundation”

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

Re: Whistling sound from speakers on connecting USB mouse

Thu Jun 14, 2018 10:27 pm

The longer I investigated solutions for this problem (yes problem, not issue), the more costly and cumbersome the system has become, and have grown impatient.
In the end I settled for the simplest cost-effective practical working solution, that is, separate smaller 5V power supply

If a practical one-power-supply solution can be found, am also interested in trying it out to confirm it.
"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!"

abhi3188
Posts: 16
Joined: Mon Nov 16, 2015 7:34 pm

Re: Whistling sound from speakers on connecting USB mouse

Fri Jun 15, 2018 9:29 pm

I still have to add 3 servos into my circuit so I'm definitely not looking forward to the noise those are bound to add in, along with the voltage drop issues they are likely to cause.

I tried researching ways to split a single 5v rail into two independent rails but haven't come across anything. I did find this one youtube video (https://www.youtube.com/watch?v=ENUb4leJ_rM) about audio output from a Pi where the guy alludes to having built a PSU that splits up the 5V line to get rid of the noise issue but couldn't find details of his build.

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

Re: Whistling sound from speakers on connecting USB mouse

Fri Jun 15, 2018 9:55 pm

In the video link there is no physically connected USB mouse and keyboard as the RPiZ setup is accessed remotely...

just tested it myself with a RPiA+ and DIY 1W class A amp. still noisy, as if there a gun battle going on.
DIY class A amp was actually noisy from the start, even after removing input .

then removed the DIY amp and replaced with USB speakers... noise attenuated but still there...
changed USB speaker power source from shared USB hub to separate 1A USB power supply from dollar store, noise gone
"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!"

Return to “Troubleshooting”

Who is online

Users browsing this forum: rpdom, Superbug50 and 33 guests