I've seen similar topics to this posted a few times, but I could never find a definitive answer to my application.
Say that an Arduino is being powered from a mains AC to DC PSU. A desktop computer used to debug and program it is also run on the same mains power supply.
I know that the uno has a voltage selection circuit that allows it to be powered via VIN or the barrel jack, while also being plugged in to the computer for debug and programming. However, I'm unsure if ESP boards have this feature.
My question is whether you can safely debug and program any arduino (or most microcontrollers) if you use a modified"data-only" usb cable. That is, a usb cable with the 5v wire cut off, so the usb cable can NOT provide power to the MCU, but can still transfer data (via the 2 data lines and ground wire).
And can this also be safe if you're communicating with an Arduino that is powered from the same mains supply as the PC?
P.S I already have an ftdi converter which I hooked up to 3 high speed optocouplers on a breadboard, which can provide completely isolated communication/programming between my arduinos and computer, and also reduce noise, but im wondering if the data-only usb solution would also work, as it's more simple.
thanks!
Edit; forget that the original post included the term "ground-loop". I may have misinterpreted that term.
I've also just discovered that inexpensive USB isolator's exist, which would make the setup a lot easier, as you don't need to hook an isolated FTDI converter up to a board every time you want to communicate.
However a lot of the USB isolators have isolated 5v power supplies included, which could still screw things up if I've also got the board also running off an external mains supply, but I can just desolder the isolated supply off probably.
The Uno is a board (with extra circuitry). ESP32 is just a microprocessor. What the board you purchased is capable of depend on the supporting circuitry.
If your computer (more appropriately a laptop) is not grounded you should be able to plug directly into it (with VBus un-cut), depend on how the USB voltage and system voltage is handled. Sometimes they go directly to the mcu's dedicated pins (only) and branch off to some voltage regulator stuff. Other times not so much.
There is a PPTC on I think all arduinos (beside the ancient Arduino Serial and Arduino USB). You can remove them to completely remove VBus from system.
I know you deleted the comment, but I'll just assume that all the ground cables in my household are interconnected, as well as the earth cables, and simply buy a cheap USB isolation module, as there's an extremely small chance it could cause damage to my PC or boards.
It depend where you live and what kind of modular power supply you are using with the arduino.
In UK i assume all devices need a safety ground connection. In U.S. or China you have massive amount of 2-prong barrel jack power supplies that claim to be "double insulated" and do not have a safety ground. Many laptop power bricks and phone "wall warts" too.
I prefer ones with safety ground as it minimizes the chance of ESD damage (since you will be touching grounded parts very frequently), but the theory is that you don't need a safety ground and you will be perfectly fine as the GND pins cycle between +10V and -10V (half of output voltage) RMS.
In some cases you might actually prefer to not have insulation as it allow you to ground your laptop and remove extra charge. And if the Arduino is un-grounded, ground it via the desktop.
In all cases, it's probably necessary to disconnect vBus when you are powering the board externally. You might be able to get away if the voltage regulator is very good and or if vBus is not used to power the board (and in the case that the vBus lead directly to the mcu you might actually need it). If you cannot confirm just cut vbus.
ok this this is embarrassing as I may have completely misinterpreted what a ground loop is. I thought it meant interconnecting 2 negative wires, not earth wires...I will edit it out of the post and clarify my mistake.
The main question of this post is whether it is safe to hook data+, data- and ground (negative) of a USB cable (i.e. having the VBUS+ cut off) into an Arduino, when the arduino is receiving its power from a separate mains AC-DC power supply?
The computer communicating with the arduino and the external power supply for the arduino are being powered on the same mains circuit. Does this pose any risks to the computer or the Arduino?
Maybe, maybe not. If your DC negatives are connected to the mains protective ground - as they are in all "desktop" PC and many laptops, then you do have a ground loop. Whether this causes a problem will depend on many factors, notably what - such as faults - may cause sufficient current to flow in the protective ground circuit, how large the loop is; whether it is just two systems plugged into adjacent outlets or quite different areas on a property, and how robust and how short the negative wires between power supply and each component, are.
Ground loops are a major problem in audio systems, such as I am having at my local church, recording sermons on a USFF PC which uses a power "brick" with a three pin ("Clover") inlet.
Given that the equipment is all in good order and plugged into the same multiple outlet or "power board" there should be no trouble.
I was querying why you wanted to break the USB power feed. The only real reason to do this is when using a UNO(, Mega 2560, Leonardo) which may under some peculiar circumstances (of voltages) feed power from a 5 V supply on the "5V" pin back into the PC's USB port and cause it to malfunction. Nanos do not have this problem.
Thanks a tonne @Paul_B! Thank you Xavier too for your input about power supplies!
I actually had a Mega (clone) and a few other components blow up a year ago when I connected it to a PC through a powered usb cable.
I had the Mega serially communicating with a clone Nano and a Wemos d1 mini, through 2 of the megas extra hardware uarts.
everything was being powered by a 12v ac to dc PSU (extra buck converter used to power wemos at 3.3v).
The whole circuit worked fine. To reupload to the mega, and other boards, I shut off the 12v supply to everything.
One day though I disconnected only the 12v power into the mega (via barrel jack), but left the nano and the wemos powered by the 12v. Since the nano and wemos were still connected to the mega (through uart lines and gnd), there was still a connection between with 12v mains supply and the mega. This 12v supply had a 2 pin socket btw, so no earth.
Upon connection between the desktop computer and the mega usb port, the mega immediately blew up, along with 4 peripherals connected to the mega (sd card reader, I2C backpack, lcd display).
ALSO, a blutooth module connected to an adjacent usb port in my computer got destroyed.
the computer, along with the nano and the wemos were not damaged (atleast I think).
So your input about the Mega may have been the reason for this happening.
I solved this problem by putting a switch in the computer USB cable to open the red +5 line. This allows me to power my Arduino when the computer is off, or not power it when the computer is on as the case may be. The Arduino's have a built-in diode to prevent current backflow of the Arduino trying to power the computer. I used a simple 1/4" SPDT toggle switch and 3D printed a box. Works like a charm and no plugging and unplugging all the time.
The switch doesn't prevent back flow, but it is a way to power cycle the cards without unplugging & replugging. It allows me to bring up either the PC or the Arduino without the other.
Hi,
If I am programming a controller/project that is dependently powered I use my +5V isolated cable, no questions asked if the controller has back feed diodes or not.
No brainer...