Connecting USB generates voltage spikes in circuit.

Started by pcbGuru 2 years ago6 replieslatest reply 2 years ago510 views


           I have a PCB with an MCU, opamps meant to measure a weak differential signal from a sensor. Every thing works as expected. However when I plug the board to a wall charger through a USB I get voltage spikes all over the circuit. This causes erroneous measurements.

I observed that if the GND is already connected to mains ground, then connecting USB creates no spikes. Also I cut the USB cable and put in a 4 ohm resistor in the 5V line. This reduced the spikes as well.

What should I do to avoid this problem? Is it a good idea to use and inrush current limiting resistor ?


[ - ]
Reply by MichaelKellettMarch 23, 2022

Low cost chargers with USB connections are renowned for low quality. Typical problems are electrical noise, poor safety practice and out of spec output voltage.

If you must use one, then try to ensure that it's ofgood quality and bought from a reputable source. The market is flooded with fakes so just because it has a name you recognise on it that doesn't mean it was actually made by them.

If your ciruit is sensitive to noise then you will need to filter the power from the charger. Try a common mode choke (one with two windings, one for 0V and one for positive) and some shunt capacitors. This may not be enough. If the current drawn by your circuit is low try chokes (inductors) in the positive connection and shunt capacitors. You should read up on filtering because just randomly choosing parts can cause problems worse than just not working.

If you are only trying to get one of these to work (rather than making lots of them) then you may be able to find an older "wall wart" with a 50Hz transformer rather than a switcher in it. These are often much quieter.


[ - ]
Reply by DilbertoMarch 23, 2022


Some questions:

Have you measured the power supply line quality of your wall charger? 

Besides the wall charger, is there another live power supply tied to the circuit when you plug in the wall charger?

If so, how is the GND of the USB connector connected to the general circuit GND?

Do you have decoupling caps on the power supply lines?

Best regards!

[ - ]
Reply by arnigeirMarch 23, 2022

Might want to consider some surge protection or maybe just a simple Zener diode to clamp the highest voltage allowed on the 5v line. Maybe a capacitor as well on your power input port to filter noise? Note that by grounding your circuit, to mains ground, your circuit is no longer galvanically isolated from mains - you might get transients through that same mains ground that affects your circuit. 

[ - ]
Reply by pcbGuruMarch 23, 2022

Thanks for all your responses. Regarding quality of charger, I noticed that changing the USB cable to a higher quality one did make a big difference. While it helps, there is no way to guarantee that the client will use a high quality cable, so our device must have its own protection. We want our units to work with really noisy power supplies. I will look into the use of choke.

Currently we have a ferrite bead in +5V line and shunt capacitors.

I will try a shunt resistor, and clamping zener now.


[ - ]
Reply by mikethewireMarch 23, 2022

You've probably done this but the supply rails to your more sensitive analogue circuitry should be better filtered and stablised, as per methods above, compared to the rest of the circuit.