I've got a dashboard which I want to control from an Arduino. I've got the concept but I'm having issues with the power supply of the circuit. The Arduino is connected to my PC via USB (and it's supply is the USB).

I have some lamps I want to control, as you can see on the first figure. switching lamps with MOSFETs

I've also got some gauges which need amplifiers (figure 2). controlling gauges from Arduino PWM

To power these I've got a switch-mode power supply (24V DC).

My problem is whether I can safely connect the negative terminal of the supply to the ground of the Arduino (which is connected to the PC). I'd need this otherwise the circuits won't work properly, but I'm not sure it's alrigth to do so.

I tried to measure the voltage between my PC USB port (GND) and the negative terminal of the supply - I got a randomly changing voltage between about -0,15V and +0,15V. But there's a spike when I touch the multimeter to the cables, maximum of ~2,5V. Though I don't know this measurement is correct or not.

I'm afraid if the ground potentials are not the same, I'll destroy my PC motherboard via the USB.

So can I connect them safely or should I try to come up with something else?


You are wise to be wary here. You can connect them safely if you can be sure that the USB on your PC is tied to ground and you tie your power supply to the same ground, but if you are measuring a voltage between these grounds, your external supply must be floating. I would agree with you that you should not use the USB as your means of tying the grounds together, because the two supplies will float apart each time you disconnect the USB cable and you will get a spike or surge when you reconnect. You would want to make sure that the grounds are always tied together through a separate path. Unfortunately, you can's just tie your external supply to earth because PC USB grounds are not always tied to earth, especially when using laptops.

For safety, use opto isolators or similar between your arduino pins and other circuitry.

  • 1
    \$\begingroup\$ I agree. An opto is the best sollution to be safe. Using an opto as an enable signal to MOSFET is the safest way. You Just need to select the correct configuration of an opto and that's all. \$\endgroup\$
    – Dimitri
    Jan 8 '18 at 15:12
  • \$\begingroup\$ I'm more worried about the USB path between my PC and my Arduino (e.g. my PC is worth about 10 times more than an original Arduino board). Another thing come to my mind though; what if I regulated my power supply to 12V (with a switch-mode step down) and supply the Arduino with it as an external power supply? This way all the circuits would have the same ground (the negative terminal of the power supply). Then the only connection between the Arduino and the PC would be data + and - (theoritically). Or would there still be a connection (Vcc and GND in USB) that could harm the PC? \$\endgroup\$
    – CptZsolt
    Jan 8 '18 at 15:32
  • \$\begingroup\$ You would still be tying the ground connection on the USB cable to the ground of the arduino power supply when you plug in the cable, so I think that caution is still a good idea. \$\endgroup\$ Jan 9 '18 at 14:19

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.