Author Topic: Help to understand power supply isolation and USB please, to avoid future damage  (Read 1869 times)

0 Members and 1 Guest are viewing this topic.

Offline DavidA

  • Contributor
  • Posts: 20
  • Country: nz
I would like to understand what happened with my circuit when I connected a USB AVR programmer to it. I clearly made a mistake and I want to learn from it.

The AVR ATtiny84 is connected across the outputs of a LD1117v33 regulator (3.3V) however due to a mistake on my part, the ground of the ATtiny wasn't actually connected properly. I had the regulator inputs connected to a PC PSU, across the 12V/5V supply to give 7V. I know this "7V trick" is a bad idea, and I think I understand why now, but let me continue. The PSU's ground was not connected to my circuit at all.

Because of the missing ground connection between the ATtiny and the regulator, the ATtiny wasn't powering up. But to really make things worse, I connected a C232HM USB programming cable to the ATtiny in-circuit (omitting the red VCC wire since it's already powered so I didn't need the 5V supply from it). I suppose, crucially, the ground wire was connected. When I connected this programmer to my powered USB hub (in turn connected to my laptop) the ATtiny got *very* hot. I managed to measure 8.something volts across VCC/GND on the ATtiny before I managed to disconnect everything in a big hurry.

To cut a long story short, the ATtiny seems to be quite dead. As is my USB hub - it provides power but does not recognise any USB devices any more. Everything else seems ok, including the C232HM cable.

I did notice that when I briefly touched the ground of the USB cable to ground on my circuit that the PSU shut itself down briefly - clearly a sign of bad things, but I didn't notice this until after I fried things unfortunately.

What I think happened here is that the bad idea of putting 7V on the regulator using the "7V trick" meant that the 3.3V output on the VCC of the ATtiny was actually 5+3.3 = 8.3V above the PSUs ground. When I connected the USB programmer, if the PSU ground is related to the USB ground somehow, it would have put 8.3V across the ATtiny, as well as across the USB rails too, which would explain why the USB hub was also damaged.

What I don't really understand though is that I thought the PC PSU was meant to be isolated, and even if the 5V and 12V supplies aren't isolated from each other, and have a common ground, they are isolated from the mains AC and therefore other grounds like the USB DC ground. So wouldn't this cause them to float relative to the USB ground (which I assume is not isolated?). However the PSU's DC ground wasn't connected so why did a potential difference develop at all? I'm really not clear on this side of things as I think I'm missing some knowledge so any guidance and advice would be welcome, please.
 

Offline DC1MC

  • Frequent Contributor
  • **
  • Posts: 981
  • Country: de
Your laptop power supply, the PC PSU cable, all have have power cables with protective ground connection, the electrical ground of them is connected to the protective ground, so even if you didn't explicitly put the ground on the PC power supply was still connected via the protective ground of the laptop.

The idea to make 7V as you've describe it, it's not stupid, it's MONUMENTALLY STUPID:palm:, for your safety and wallet sake don't do this shit anymore.

 
 

Offline janoc

  • Super Contributor
  • ***
  • Posts: 3032
  • Country: fr
PC ATX supplies are not floating! They are mains earth referenced - actually have to be, for safety reasons.  So your way of obtaining 7V is not only bad idea, it is outright dangerous and may blow up the power supply, along with whatever you connect to it. What you have done is only possible with totally floating supplies (being isolated from mains isn't enough!).

Also watch the Dave's video on how to not blow up your oscilloscope.  He explains the issues with the mains earth referenced gear.

You really shouldn't play with an ATX supply unless you understand basic stuff like this - that thing can deliver 20+ amps and that means major fireworks if you misuse it like this.

« Last Edit: December 25, 2017, 01:49:07 pm by janoc »
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 10515
  • Country: us
  • DavidH
The lack of galvanic isolation and lack of ease of implementing galvanic isolation is one of the reasons that USB is a terrible standard for use between devices which are separately powered and this goes double for development work.  It is great for USB powered peripherals, acceptable between peripherals powered from the same circuit, and horrible otherwise.  I am continually amazed that test instrument manufacturers include USB ports for connecting to line powered peripherals or computers without building in galvanic isolation.
 

Offline Damianos

  • Regular Contributor
  • *
  • Posts: 204
  • Country: gr
The lack of galvanic isolation and lack of ease of implementing galvanic isolation is one of the reasons that USB is a terrible standard for use between devices which are separately powered and this goes double for development work.  It is great for USB powered peripherals, acceptable between peripherals powered from the same circuit, and horrible otherwise.  I am continually amazed that test instrument manufacturers include USB ports for connecting to line powered peripherals or computers without building in galvanic isolation.
The USB is designed as most short-range communication systems. The problem is with stupid people that connect a point that is indented to be Earth-grounded, to a power supply or, generally, treat it independently of the rest of the circuit ... ...
The next step may be to blame Earth because is conductive, while we want to have grounded but simultaneously floating circuits!
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 10515
  • Country: us
  • DavidH
The USB is designed as most short-range communication systems. The problem is with stupid people that connect a point that is indented to be Earth-grounded, to a power supply or, generally, treat it independently of the rest of the circuit ... ...
The next step may be to blame Earth because is conductive, while we want to have grounded but simultaneously floating circuits!

I agree it is a misapplication but it is not just stupid people; manufacturers screw up USB and other grounding all the time.  I forgot who did it but there was a series of VGA monitors which were destroying laptops and shocking people.  Even if I do everything right, the last thing I want is a prototype development system connected to my expensive workstation through a non-isolated interface like USB and the same goes for test equipment.

The thing which makes USB difficult compared to say RS-232 is that bidirectional signal lines are much more difficult to isolate.  Inexpensive integrated isolation products are available now but since they are limited to 12 Mb/s, using them comes at a steep cost of not supporting USB 2.0's 480 Mb/s.  Ethernet is a good solution but so much more complicated.
 

Offline DC1MC

  • Frequent Contributor
  • **
  • Posts: 981
  • Country: de
...cut...

The thing which makes USB difficult compared to say RS-232 is that bidirectional signal lines are much more difficult to isolate.  Inexpensive integrated isolation products are available now but since they are limited to 12 Mb/s, using them comes at a steep cost of not supporting USB 2.0's 480 Mb/s.  Ethernet is a good solution but so much more complicated.

Eh, if we've only had some kind of good tested, standardized protocol, that allows for high speed packetized communication and can form complex networks that GPIB could only dream of. Also the physical layer would be so nice to be easy to isolate the signals from whatever high-voltage floating ground, get at least 10m at 10Gb/s  or 100m at 100Mb/s.
Of course if there would by like widespread parts and software supporting that protocol and specifications will be open, like done by a standards body such as IEEE, that would have been so nice.

I think two guys were working on it, some while ago, Bob and Dave, if I remember correctly, I think they wanted to call it Ethernet or Etherum or something, like this crypto coins, anyway I don't thing that with such a ridiculous name they ever finish it, and now we are stuck with the USB  :'(, very sad.
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 10515
  • Country: us
  • DavidH
...cut...

The thing which makes USB difficult compared to say RS-232 is that bidirectional signal lines are much more difficult to isolate.  Inexpensive integrated isolation products are available now but since they are limited to 12 Mb/s, using them comes at a steep cost of not supporting USB 2.0's 480 Mb/s.  Ethernet is a good solution but so much more complicated.

Eh, if we've only had some kind of good tested, standardized protocol, that allows for high speed packetized communication and can form complex networks that GPIB could only dream of. Also the physical layer would be so nice to be easy to isolate the signals from whatever high-voltage floating ground, get at least 10m at 10Gb/s  or 100m at 100Mb/s.
Of course if there would by like widespread parts and software supporting that protocol and specifications will be open, like done by a standards body such as IEEE, that would have been so nice.

I think two guys were working on it, some while ago, Bob and Dave, if I remember correctly, I think they wanted to call it Ethernet or Etherum or something, like this crypto coins, anyway I don't thing that with such a ridiculous name they ever finish it, and now we are stuck with the USB  :'(, very sad.

Like I said in the part you even quoted, Ethernet is a good solution but so much more complicated.
 

Offline DC1MC

  • Frequent Contributor
  • **
  • Posts: 981
  • Country: de
The joke wasn't directed to you David, but at this vendors that really just wanted replace their RS-232 interfaces with some smarter "serial like" thingy.
I actually fail to see how an Ethernet interface with a simple TCP/IP protocol stack would have been "much more complicated" than an USB stack with all these device class implementation, host OS drivers and all the other miserable stuff.
I think the first PICs with a TCP/IP stack were available at the beginning of 2000's, and all the instruments based on a PC platform or having a "proper" CPU could have easily added an TCP/IP stack instead of the USB stuff.
Not to mention how easy would have been interfacing with any type of PC/workstation or industrial controller. I remember seeing Serial over TCP/IP adapters in '99.

 DC1MC
 

Offline DavidA

  • Contributor
  • Posts: 20
  • Country: nz
Thanks for the responses everyone. I had a feeling it may not have been a smart thing to do however there's no substitute for real-life experience. Armed with this experience and your advice, I won't be making the same mistake again.

Maybe it's time I invested in a proper bench-top power supply. I just wish they all weren't so damn expensive in this part of the world.

 

Offline DavidA

  • Contributor
  • Posts: 20
  • Country: nz
The idea to make 7V as you've describe it, it's not stupid, it's MONUMENTALLY STUPID

BTW, it seems to be a widely used "trick" for running PC 12V fans at a slower speed, and Google is full of people doing this, which is where I got the idea from. I did look around for serious warnings against this practice, but didn't really find much to suggest it was a bad idea. However now I understand the bigger picture better, it does seem like a really bad idea.
 

Offline DC1MC

  • Frequent Contributor
  • **
  • Posts: 981
  • Country: de
David, now you're a seasoned electronics experimenter that have seen things  ;D, now throw away that improvised crap and get a proper power supply to start the year properly, a cheap one will do for starters and be many times better than what you're using now.

Even for the PC modding camp, the kludge with connecting the fan between 12 and 5V it's still tragically stupid, it's so easy to have something crapping out in the fan and shorting 12V with 5V and puff goes in smoke the gaming rig, but that's OK, they need to learn as well  >:D.

 Cheers, DC1MC
 

Offline DavidA

  • Contributor
  • Posts: 20
  • Country: nz
a cheap one will do for starters

Can you give me any suggestions of which models to look at? Buying local new means $200+ for basic single-channel adjustable DC @ ~5A (Jaycar is the only option and their markup is as high as 5000% on some items), so I would consider importing something if I can be fairly sure it's a good and reliable choice. I will also need to get an idea of what to look for in a bench top power supply.

I wasn't able to find a general "bench top power supply" thread here (might have missed it though).

EDIT: can also get new "wanptek" and "korad" brands (I've never heard of them) for <$200 on local trade/exchange website. I'm guessing these are just cheap Chinese made ones imported by someone. I could get them cheaper direct from Ali Express I suspect.
« Last Edit: December 26, 2017, 07:34:53 am by DavidA »
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 6944
  • Country: us
Implementing USB HID and CDC is pretty trivial and well understood.  There are no drivers to create as long as the device complies with the standard.  Microsoft includes the drivers as does Linux.

There are USB isolators.  I picked up a couple but I haven't tried them.

There is nothing wrong with using wall warts.  I did it for decades.  It's pretty easy to find a 5V 2A wart anywhere they sell Raspberry PIs.  9V and 12V are also pretty easy to find.  One obvious downside:  No current limiting.  Sometimes this matters.

Power supplies just has to be the most discussed topic around here.  Dave did a video about a PS that caught fire but he also discussed the fix (now implemented)

Here's the supply review:


See also videos 1035 and 1036 for the fire and fix

Bottom line is a workable PS for $20.


 

Offline janoc

  • Super Contributor
  • ***
  • Posts: 3032
  • Country: fr
I think two guys were working on it, some while ago, Bob and Dave, if I remember correctly, I think they wanted to call it Ethernet or Etherum or something, like this crypto coins, anyway I don't thing that with such a ridiculous name they ever finish it, and now we are stuck with the USB  :'(, very sad.

The problem with Ethernet is that it doesn't solve what USB has been designed to solve - namely both replacing the legacy (RS-232, Centronics style printer ports, etc.) interfaces and also to provide power to peripherals, so that every little widget and gizmo doesn't need its own wall wart (neither RS-232 or printer ports provided power).

Ethernet by itself is unable to do it, due to the fact that it is isolated. And the moment you start messing with the various power-over-ethernet schemes, you are back to square one with all those grounding issues.

Furthermore, Ethernet is fairly slow, even by USB standards, and lacks support for things like time determinism (the isochronous transfer type USB has). That would have made it difficult to use for e.g. audio and (later) video without large buffers and associated latencies.

So yes, by using Ethernet the manufacturers would have solved the isolation problem (which wasn't seen as a problem in the first place as it is extremely rare for a normal user to run into it) and complicated all the other issues they were trying to address.

If you want an IEEE standard that is actually closer to what USB has been trying to do, it is IEEE 1394 - aka FireWire. 
« Last Edit: December 26, 2017, 07:23:47 pm by janoc »
 

Offline Rolo

  • Regular Contributor
  • *
  • Posts: 206
  • Country: nl
One of these could be of some help. It works to isolate your computer's usb from your project. I will not give the max usb spec current and not the full usb 2.0 speed I think. But It does the job for usb bootloaders on dev boards.
You still have the grounded BNC on your scope to watch out for.
 

Offline janoc

  • Super Contributor
  • ***
  • Posts: 3032
  • Country: fr
Generally, what helps to keep issues in check for a hobbyist - always, always work with your DUT powered from a completely floating supply - wall wart, lab supply, usb power bank, batteries. If you are using mains powered equipment - e.g. a PC or an oscilloscope, power it all from the same outlet to ensure there aren't any voltage differences (and thus stray currents) that could blow something up. Then even if you are using USB to connect it to PC or an earthed oscilloscope it won't cause problems.

Avoid using "industrial" supplies such as PC ATX ones. They are cheap but they will also give you a lot of trouble unless you know exactly what you are doing. A laptop power brick and one of those lab supply modules from eBay/AliExpress are a very good option probably on par with many of the cheap lab supplies available from the same places if you don't want to spend money for a proper lab supply (not that they are expensive!). 

And don't tinker with mains or mains earth referenced equipment until you "grow into" it.  That means don't try to build or repair switching power supplies in home audio/video gear, TVs etc until you are sure you know how to handle this safely and have the proper equipment - isolation transformer (not a variac!), differential probe for your scope, etc. - as required. Otherwise you are asking for a trip to a hospital or worse.

« Last Edit: December 27, 2017, 02:43:01 pm by janoc »
 

Offline Bratster

  • Regular Contributor
  • *
  • Posts: 246
  • Country: us
One thing to watch out for if you're using a laptop power brick and one of those little switching power supply modules is if you have a laptop power brick with a 3 pin ac power connector for the input side it is most likely has the output negative at Earth ground so you are back in the same boat as using an ATX power supply. Allbeit with current limiting this time.
Also need to watch out for those little modules a lot of times have the current sensing shunt in the negative side so that's another trap to fall into.

You need to make sure that you're using a laptop power supply with a 2 pin AC input.

Sent from my Nexus 6 using Tapatalk
« Last Edit: December 27, 2017, 09:43:12 pm by Bratster »
 

Offline Gyro

  • Super Contributor
  • ***
  • Posts: 5191
  • Country: gb
Hmm that's a tricky one. With 2 pin AC input laptop supplies you get the leakage current associated with the Y-Caps. This leakage, very low current obviously but by floating to around half mains voltage can damage CMOS inputs etc. if them make contact with the scope ground first (rather than your DC rail ground).

I normally recommend using a 3 pin adapter to ensure that these primary filter leakage currents are routed back to mains Earth ground. Unfortunately this doesn't help you achieve a floating output.
Chris

"Victor Meldrew, the Crimson Avenger!"
 

Offline janoc

  • Super Contributor
  • ***
  • Posts: 3032
  • Country: fr
Good point about the laptop power bricks. Didn't think about that one.

Probably worth poking an ohmmeter there to check whether there is actually continuity between any pin of the mains plug and the output first (if for nothing else then also for safety reasons because there are plenty of dodgy wall warts and similar around).
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf