geekhack Projects => Making Stuff Together! => Topic started by: superfuturekeys on Tue, 19 October 2021, 00:02:02

Title: Custom PCB causing audible noise on USB audio output devices
Post by: superfuturekeys on Tue, 19 October 2021, 00:02:02
Hi guys,
During COVID I decided to design my own PCB for the very first time, to go along with a custom case design I was building. Unfortunately, after putting it together I ran into a pretty annoying issue that I am assuming is due to some sort of poor design on my part. I am by no means an expert on PCB design, but I'm guessing it could be due to how I've ended up laying out my design.

The Board:

Pretty standard modified TKL design, with support for an OLED, USB-C passthrough to USB type A, rotary encoder, & RGB's via a ISSI controller. Uses a ATmega32 microprocessor. Keys work fine, with no issues. OLED also works fine as well. Have had some trouble getting the ISSI controller to work. For convenience of the RGB light layout, the board is 4 layer.

With the keyboard plugged in & pressing keys, there is a faint but audible and very annoying high pitch noise that can be heard on USB output devices. I have attached two frequency plots of USB output audio I captured to demonstrate the issue present. The plot with the many spikes is when a key is being pressed on the plugged in keyboard.

What I've tried:
Tried different USB audio outputs, different cables, different computers, different operating systems, so the issue is definitely the keyboard. I double checked to make sure everything was soldered correctly --- also resoldered my USB-C connector & removed the ISSI controller as I thought that may potentially be contributing to the problem if busted.

I am by no means an expert with PCB design, so hopefully someone here might have some pointers as to what type and origins the noise has. At this point if I had to guess this is caused by how I chose to stack my power & ground planes. I currently do not have access to an oscilloscope, but can get access to one if recommended for debugging & hunting the issue down.

Let me know if you need more info! I suppose I can also post / PM my kicad design if someone is willing to review it. Worst case I'll toss the design and work backwards with an already established, open source TKL design that I can modify to my needs.
Title: Re: Custom PCB causing audible noise on USB audio output devices
Post by: nevin on Tue, 19 October 2021, 06:55:55
probably a bad ground or there might be something wrong around the usb connector (missing capacitors, etc.)

sounds like ground loop check your grounds on the keyboard. make sure you have a good solid ground from the board to a good usb cable.
- may not be an intermittent connection but you probably need a better pathway for ground. (there's resistance)

if the board is missing caps or something else by the usb connector and you don't want to redo the pcb, this might be an option.
ai03's Unified Daughterboard -
Title: Re: Custom PCB causing audible noise on USB audio output devices
Post by: vvp on Tue, 19 October 2021, 12:18:51
My guess would be that you are (almost) shorting +5V usb power line to ground when scanning a pressed key. This would result in dips in +5V line which may be shared between more usb devices. You can check this with scope or if you have an externally powered USB hub which has isolated power line for devices then usb audio devices connected through that hub should be noise free.
Title: Re: Custom PCB causing audible noise on USB audio output devices
Post by: tszaboo on Tue, 14 December 2021, 04:27:28
There are cheap "USB charger doctors"  available online from stores like aliexpress or ebay. See how much is the board power usage. It should be fairly low without LEDs, like 20ma, and less tha 500 with.
Also, try putting ferrite beads on the USB cable.
Finally you might want to put a larger capacitor on your board. 100uF or larger.
Let me know if this helps.