I have a problem with a PCB, powered directly by a switching power supply, which transforms 230 Vac into 5 Vdc. It has an ATmega328 (Arduino standalone) microcontroller for managing PC LED strips.

If it is not connected to the PC it works perfectly, but when I connect via USB the GND of the computer to the GND of the PCB it goes crazy.

Measuring the 5 V power supply, this voltage is seen on the oscilloscope: enter image description here

Any ideas to reduce this?


Thanks @MarkU for your comment .. I didn't know!

Returning to us, touching the female USB port with the other male USB connected to the pc, I noticed small sparks. Therefore I tried to connect the power supply output GND to the lightning rod of my house. This drastically reduce the problem, without disappearing completely.

Another strange thing is that the problem disappears completely if, keeping the internal power supply, I feed the PCB to the PC through a CP2102 Breakout used previously to program the microcontroller.

I tried to search for the CP2102 Breakout scheme to understand the reason for this behavior, but alas to no avail ..

  • 1
    \$\begingroup\$ Related: electronics.stackexchange.com/questions/78920/… \$\endgroup\$
    – MarkU
    Jul 24, 2021 at 1:55
  • 2
    \$\begingroup\$ It sounds like the power supply is not properly grounded, faulty and and or has a leakage problem. Check its data sheet to be sure it is galvanic isolated. Measure between it and ground, there should be zero volts, if not replace it. \$\endgroup\$
    – Gil
    Jul 24, 2021 at 2:41
  • \$\begingroup\$ @Gil Are you saying between the negative of the power supply and the grounding of the home system? \$\endgroup\$
    – Pinguto
    Jul 24, 2021 at 8:41

1 Answer 1


To be safe the power lines must be isolated from human contact. All of my bench equipment is grounded with the third pin on the line cord, you scope should be as well assuming it is plugged into the mains. This holds for almost all line powered systems as well. There is an exception, where the items are double insulated, like some power tools and wall warts. When you got sparks the energy had co come from somewhere, probably the power lines. This could be coupled via capacatance, I cannot see your setup. Does that power supply have a ground connection and is it connected, if not that could explain what you are seeing. I am basing that on your scope photo. The signal is approximately power line voltage and frequency. Try this link on Galvanic isolation from Wikipedia: https://en.wikipedia.org/wiki/Galvanic_isolation This will hopefully explain a lot better than I can in the allocated space here. Follow the links as well.

  • \$\begingroup\$ You were right! The voltage between the GND of the PCB and the isolation of the USB ports of the PC was almost one volt, so as I replaced the power supply the problem was solved! :) \$\endgroup\$
    – Pinguto
    Jul 25, 2021 at 15:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.