Arduino: Risks of two power sources (frying PC?) - Page 1
Forum section: electronics / general

author: roffelkartoffel
author_rank: Newbie
timestamp: February 28, 2023, 08:01:18 pm
content: I have an arduino pro mini wich is powered with a linear regulator (CJ78L05 Three-terminal positive voltage regulator). The regulator itself is powered by a PN8015-Voltage regulator (circuit very similar to this circuit:http://www.zm699.com/UploadFiles/FCK/2015-07/PN8015m%E5%BA%94%E7%94%A82(OK).jpg). This all works fine. However, I want to programm the microcontroller via FTDI232-programmer wich works too. At the moment I am powering the arduino either via computer or the power supply of the kettle. Now I am afraid that I can kill the arduino, the programmer, or worse my laptop as the GND could be at different potentials. So the question is as follows: Can I savely operate the arduino with both power sources or not?Thx in advance.

author: james_s
author_rank: Super Contributor
timestamp: February 28, 2023, 08:21:22 pm
content: Two power sources are fine. The problem here is the PN8015 is a non-isolated converter, so "ground" in that circuit is not actually at earth potential. You could use a USB isolator but this is still quite dangerous. If you need in-circuit programming you should use an isolated power supply.

author: zilp
author_rank: Frequent Contributor
timestamp: February 28, 2023, 08:32:09 pm
content: > Now I am afraid that I can kill the arduino, the programmer, or worse my laptop as the GND could be at different potentials.... or yourself.Seriously, if you have to ask this, then you should not be working on stuff that isn't galvanically isolated from mains potentials. If that only kills your laptop rather than yourself, you can count yourself lucky.Now, I obviously have no idea what you are trying to interface here, but if at all possible, use an isolated power supply where touching your circuit is not going to kill you. And also don't connect it to anything that's connected to mains potential otherwise. And if you really have to (like, for signals that are referenced to mains potential), look into opto isolators or digital isolators.

author: roffelkartoffel
author_rank: Newbie
timestamp: February 28, 2023, 09:01:03 pm
content: James_S: Thank you for your answer. I had the feeling that "GND" is not GND too since the 5V is directly connected to mains voltage.Zilp: I was thinking about optocouplers too but have none at hand.The circuit I am working on is for a water-kettle wich went haywire (automatically switching on/off, not switching at all... it's a Carrera 551 model, typical issue according to amazon). I plan to make a custom pcb to use an arduino to read temperature, use beeper and such but implementing an isolated psu seems to be the better alternative. When I researched the used components it was very difficult to find english datasheets (or at least any datasheet at all) so I had a bad feeling again... or driving a 12V relais with 6V-ish (the nonlinearised supply voltage)...I am appending a photo of the PCB, I have soldered cables to the vias (besides R8, R19 to access a thermistor, and a relay) and two cables supplying +5V, GND from the arduino. The pcb is enclosed in the case again so there should be no possibility to touch live wire...Edit: the mangled "something" at D1 (upper right corner) is from factory.

author: james_s
author_rank: Super Contributor
timestamp: February 28, 2023, 09:05:14 pm
content: If the kettle has an electronic control that is acting up, the first thing I'd do is replace any electrolytic capacitors in the circuit, those are a common failure point.

author: roffelkartoffel
author_rank: Newbie
timestamp: February 28, 2023, 09:11:45 pm
content: Good point. But since they look good (no leak or bulging) I did not consider that. But as the foil of the capacitive buttons has been accidentally melted (have unsoldered the connector, and cut-off U1 to not interfere with the arduino) this this trashed beyond repairability (at least for decent costs).

author: james_s
author_rank: Super Contributor
timestamp: February 28, 2023, 09:48:36 pm
content: It's rare for them to leak or bulge, that was mostly a thing during the era of defective capacitors that would fail that way very early. The vast majority of failed capacitors I've replaced had no visible sign of failure.

author: Nominal Animal
author_rank: Super Contributor
timestamp: February 28, 2023, 09:53:28 pm
content: I do not deal with mains voltage. I consider 20 volts "high", because I usually only deal with voltages below 6 volts.So, I have no idea whether using an USB isolator helps OP with safety at all.I habitually use the cheap ADUM3160/4160 -based USB 1.1 isolators (12 Mbit/s max.) from eBay, those at or under 10€ / USD $10 apiece; they're direct implementations of the datasheet application example, and only differ in what isolated DC-DC converter they use. They are perfect for use with USB-to-UART converters, as well as microcontrollers having native USB ports at USB 1.1 Low Speed or Full speed (12 Mbit/s). You need ADUM3166 or USBISO211 or similar USB High-Speed (480 Mbit/s) for USB 2.0 High Speed stuff, and even more expensive isolators for USB 3. (Consider gigabit ethernet instead of USB 3, if you need both isolation and high bandwidth.)Typically, the DC-DC converters can provide isolated 200-350 mA (from 500mA upstream).ADUM3160 can easily withstand a couple of hundred volts difference (AC or DC) between grounds, and is rated for something like 400-600 VAC continuous (CSA Component Acceptance Notice #5A, IEC 60950-1: 600 V rms (basic); and DIN V VDE V 0884-10 (VDE V 0884-10):2006-12 VIORM = 560 V peak).The DC-DC converters vary, but I believe the Mornsun B0505S-1WR3 is typical, providing up to 180-200mA; it's specified for 1.5kV DC isolation for at least a minute, 3kV DC for one second; and is protected against continuous short circuit on the isolated side. It is a viable choice whenever the output doesn't need to be well regulated, and will mostly be used for regulation down to 3.3V, as is typical in most USB widgets. Most do omit the input-side EMC CLC filter (4.7µF + 6.8µH + 4.7µF), though; while it is not a problem for typical desktops and laptops (because they tend to have robust USB port electronics), it can be an issue for tiny single-board computers. If there is a 250 Ohm or larger resistor between the outputs of the B0505S-1WR3, it is there because it requires a minimum of 20mA load on the output for stable operation.Using an USB isolator between the computer and the microcontroller, or computer and the programmer connected to the microcontroller, with the programmer grounded to the microcontroller ground potential, eliminates the possibility of a ground loop. It means the case when the ground potential differs between the microcontroller and the computer is no longer a problem, up to a difference of a couple of a hundred volts.Also, even if components on one side of the isolator release the magic smoke, even due to an inductive spike of some sort, its effects will be limited by the isolator to that side, and the other side –– usually your laptop/computer/SBC –– is safe. (Things like having a stepper motor turn another stepper motor, with the latters windings having a connection to USB Vcc and GND, for example. No, don't ask, that is, uh, just an example I thought of. I promise. Although "butterfingers" would be an apt nickname for me, considering the number of components I have, uh, explosively investigated the properties of.)Again, I can say nothing about the safety, though; I'm just a hobbyist. The main reason for my use of the isolator is to reduce stress, as I know that any results from my own butterfingery is limited to circuits on that side of the isolator, and has nothing to do with biological safety.

author: ledtester
author_rank: Super Contributor
timestamp: February 28, 2023, 10:25:53 pm
content: Quote from: roffelkartoffel on February 28, 2023, 08:01:18 pmSome alternative ideas:- communicate with the microcontroller wirelessly -- like with a bluetooth module- build a "field programmer" -- a device which allows you to flash new firmware without using a computer. Like this project:http://www.gammon.com.au/forum/?id=11638The field programmer can be battery powered or even take power from the microcontroller it is flashing.

author: james_s
author_rank: Super Contributor
timestamp: February 28, 2023, 10:32:59 pm
content: Quote from: Nominal Animal on February 28, 2023, 09:53:28 pmIt does, the ADUM3160 provides isolation to 2.5kV. The only way for that to be safe though is to integrate the isolator so that no user accessible connectors are tied to the non-isolated source. It's easier though to just use an isolated power supply I think. Or the wireless route, ESPHome OTA update works nicely for example.