I've created a simple controller with a nodemcu to connect a RGB strip that I had to the internet.

The thing that happens is that when I go to plug in the nodemcu to my iMac(to power the nodemcu), I see small sparks on the metal casing of the iMac appear until I fully plug in the USB. I don't know if this is a problem because I've had this working a while and it still works just fine and causes no problems, I'm just curious.

I created a simple fritzing diagram below: diagram Is this right? I have IRF540N N-Channel Mosfets and 470ohm resistors. The 12v power supply is there to power the RGB strip. One thing to add is that the mosfets get quite hot when under use does anyone know how to fix this?

  • \$\begingroup\$ The Fritzing diagram is a wiring diagram. We need a schematic. Fritzing should be able to generate one for you. Please post it in your question instead of the wiring diagram. \$\endgroup\$ – Transistor Mar 26 '18 at 8:35

Is this right?

Yes, this can happen.

Both devices, the iMac and the 12V power supply will will have a Y-class capacitor.
The iMac will have a mains filter. With CY 1nF to Earth.
mains filter

The power supply (assuming cheap wall-wart) will have a Y-capacitor.

Causing a small current to flow.
Usually this isn't a problem when you have grounded sockets. But if you do not have grounded sockets, the current will flow between the power supplies, though your board.

It sparks because the circuit changes from infinite resistance to a short.
This can cause damage to sensitive components if these are the first to make contact, or cause chips to glitch or reset if the impedance of ground is high or chips are improperly bypassed. Which is why the shield on USB, VGA, HDMI connect first, then the power and the signals last. Take a look inside the plug to see the pins with different length.

Sometimes you can mitigate the effects of these capacitors by reversing one of the plugs, and making sure you disconnect live when using a switch.

You do not want to remove these capacitors, because instead of a clean 50/60 Hz leakage current, you will then be looking at kHz or even MHz leakage and common mode noise.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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