Probing usb powered circuit. Should I be scared? - Page 1
Forum section: electronics / beginners

author: Moriambar
author_rank: Unknown
timestamp: October 18, 2018, 01:30:49 pm
content: Hi there.I've just been gifted my first oscilloscope, so I'm not an expert on anything in that respect.I have to troubleshoot a circuit which is powered through an arduino nano connected via usb to my mac. I was trying to use the ground pin as a reference for the probe, but then I saw this:https://youtu.be/xaELqAo4kkQand now I'm scared... Should I remove the power from my laptop before probing and use just the batteries? Or is it safe to use the gnd of the arduino as a ref?Thanks

author: Kremmen
author_rank: Super Contributor
timestamp: October 18, 2018, 01:35:55 pm
content: OK to use the Arduino GND since the circuit is galvanically isolated from mains.

author: Moriambar
author_rank: Unknown
timestamp: October 18, 2018, 01:37:39 pm
content: Quote from: Kremmen on October 18, 2018, 01:35:55 pmOh ok, thanks. I did not know that the usbs/arduino are galvanically isolated.Cheers

author: glarsson
author_rank: Frequent Contributor
timestamp: October 18, 2018, 01:46:10 pm
content: You don't know if the USB supply is isolated.A small phone charger style USB power supply most likely is, but a USB connector on a stationary PC connected to a grounded power outlet probably isn't.Don't assume, meassures first.

author: Moriambar
author_rank: Unknown
timestamp: October 18, 2018, 01:53:05 pm
content: Quote from: glarsson on October 18, 2018, 01:46:10 pmOk, I'll measure it!

author: tooki
author_rank: Super Contributor
timestamp: October 18, 2018, 04:08:10 pm
content: Quote from: Kremmen on October 18, 2018, 01:35:55 pmAn absolutely wrong assumption. Computer USB sockets are almost universally grounded through to earth ground. The only major exception, really, is laptops that don't have an earth ground connection. (In the case of Mac laptops, they are grounded if using the 3-prong cord.)

author: Moriambar
author_rank: Unknown
timestamp: October 18, 2018, 06:11:12 pm
content: Quote from: tooki on October 18, 2018, 04:08:10 pmWell I measured my mac laptop, and with the 3 pronged chord I get that usb GND is ~1k to mains earth. So I guess I will have to use the two pronged one when powering circuits that I have to test with the scope, I guess…Thanks.

author: Zero999
author_rank: Super Contributor
timestamp: October 19, 2018, 10:34:27 am
content: Quote from: Moriambar on October 18, 2018, 06:11:12 pm1k to mains earth will be no problem for most applications. With a 5V supply, the highest leakage current will be 5mA, which won't damage anything.

author: Mr. Scram
author_rank: Super Contributor
timestamp: October 19, 2018, 10:39:33 am
content: As a rule of thumb I wouldn't power circuits under test from computers you care about. Sooner or later you'll blow at least one USB port from it, and possibly worse.

author: tooki
author_rank: Super Contributor
timestamp: October 19, 2018, 10:45:22 am
content: Quote from: Moriambar on October 18, 2018, 06:11:12 pmLiterally the only thing to watch out for if the USB is grounded is to only ever connect the scope ground to the Arduino ground (which is the normal situation anyway). Done it many times with my Mac desktop, which is where my Arduino development is done. Sometimes there was various noise, which was cured by firmly tying the grounds together, and by having the scope ground as short as possible (i.e. standard good practice).

author: Moriambar
author_rank: Unknown
timestamp: October 19, 2018, 11:02:38 am
content: Quote from: tooki on October 19, 2018, 10:45:22 amSo let me get this straight: you are saying that it is safe (both for the scope and the mac) to tie the grounds together (even with the current that will be ensured by the ~1k resistance), and that the only mistake I can make is to tie the scope ground to anything else than the arduino ground, right?I'm sorry if I sound a bit confused: I am; both being a beginner and a non-native speaker is hindering me.Thanks

author: Moriambar
author_rank: Unknown
timestamp: October 19, 2018, 11:05:00 am
content: Quote from: Mr. Scram on October 19, 2018, 10:39:33 amwell the problem is that I only have that one computer and the circuit is programmed and powered by that... Apart from galvanically isolating the laptop from mains, and the alternative to unplug/restart the circuit powered from somewhere else (which will make me lose the computer-arduino serial communication) is there anything else you think I can do to use scope&laptop together?Cheers!

author: Mr. Scram
author_rank: Super Contributor
timestamp: October 19, 2018, 12:26:52 pm
content: Quote from: Moriambar on October 19, 2018, 11:05:00 amYou could isolate the connection between the device and laptop. There are devices you place between the DUT and your laptop which allow you to isolate the connection. Another option would be to use a USB hub or card that acts as a sacrificial device in case things go wrong, although it isn't guaranteed that it will take the hit alone.

author: sokoloff
author_rank: Super Contributor
timestamp: October 19, 2018, 12:30:48 pm
content: I would recommend specifically apoweredUSB hub. Over the course of several years, I blew one USB port on a MacBook by drawing too much power from it. (In this case, it wasn’t a short, but was simply drawing far too much power from the port. A powered hub would have protected me there I’m fairly sure.)

author: Mr. Scram
author_rank: Super Contributor
timestamp: October 19, 2018, 12:34:48 pm
content: Quote from: sokoloff on October 19, 2018, 12:30:48 pmA powered hub would offer you better chances, but without verifying the exact construction there's no saying what would actually happen.

author: Moriambar
author_rank: Unknown
timestamp: October 19, 2018, 12:42:01 pm
content: Oh lord, there seems to be no end to this, what have I done?

author: GeoffreyF
author_rank: Regular Contributor
timestamp: October 19, 2018, 01:01:15 pm
content: Always check the grounds to assure they are at the same potential. At the least your scope measurement will not be accurate if there is even a small amount of current flowing through the ground or a difference in ground potentials.Technicians supporting rock concerts also check this before a performance. In a mild case, there is a hum which ruins the performance. If the potential difference is enough it can kill. An example would be a microphone amplifier connected on one side of the stage and a guitar amplifier on the other. The grounds are far enough apart that there can be an even lethal potential difference. Nowadays, most use wireless transmitters which removes the problem.I once saw this problem in a friends kitchen. The metal case of the refrigerator had that false texture which represents current flow. Someone had done an amazingly bad job of connecting the mains socket for the fridge and it was not properly grounded. I fixed it and fortunately nobody was hurt before that."The art of electronics" by Paul Horowitz and Winfield Hill discusses this from a measurement and safety point of view. I recommend the book for many reasons but one of them is that.

author: Moriambar
author_rank: Unknown
timestamp: October 19, 2018, 01:04:34 pm
content: Quote from: GeoffreyF on October 19, 2018, 01:01:15 pmOk, I'll try and measure...QuoteI have the book (although I have not read it cover to cover, just skimmed about some parts that interested me), can you please point me to where they discuss this? It sounds interesting

author: ebastler
author_rank: Super Contributor
timestamp: October 19, 2018, 01:26:47 pm
content: Quote from: Moriambar on October 19, 2018, 12:42:01 pmThis thread is no longer yours...Actually, the thread is doing fine.Everybody is actually still discussing the original topic!

author: Moriambar
author_rank: Unknown
timestamp: October 19, 2018, 01:34:56 pm
content: Quote from: ebastler on October 19, 2018, 01:26:47 pmI meant that I thought to ask a simple question and to get a boring universal answer... Instead this interesting discussion has come along, and I hope to learn the most from it

author: tooki
author_rank: Super Contributor
timestamp: October 19, 2018, 02:34:40 pm
content: Quote from: Moriambar on October 19, 2018, 11:02:38 amYes. Tying the grounds together actually reduces the chances of problems. I routinely tie together scope ground and Arduino ground when scoping Arduino circuits.I'm sure many more mistakes are theoretically possible, but yes, the main one is just to remember that the scope ground is earth ground (and thus Arduino ground, USB ground, etc), so don't connect the scope ground to anywhere else in the circuit but ground.Of course, this is all assuming you are working with normal low voltage stuff. Don't even think of probing mains or other high voltage stuff until you're much, much more experienced and know how to do it properly. (I would not consider myself to be properly educated on how to do that.)Finally, if you are powering your circuit (such as an Arduino) from a battery or isolated power supply (like most DC power supplies are), and USB is not connected (or the Macbook is not plugged in), then your circuit is "floating" and you can put the scope ground anywhere you like.Quote from: Moriambar on October 19, 2018, 11:02:38 amIt can be confusing for beginners regardless. And your English is excellent! So don't worry.Part of the confusion is that the discussion has forked in two directions: one is the scope ground question, the other is protecting the computer's USB socket from damage.Quote from: Moriambar on October 19, 2018, 11:05:00 amWhat I do, like many people, is to use an AC adapter (or lab power supply) to provide 7-12V DC to the Arduino's DC input jack. (9V is typical, but lower will let the Arduino's voltage regulator run cooler.) When you do this, the Arduino automatically stops pulling power from USB — but still retains the data connection.The suggestion others have made, of using a powered USB hub in between, is an effective and simple way to protect the computer's USB ports in case you make a mistake. So it's certainly not a bad idea at all!

author: tooki
author_rank: Super Contributor
timestamp: October 19, 2018, 02:39:38 pm
content: Quote from: sokoloff on October 19, 2018, 12:30:48 pmOut of curiosity, do you know how much current you drew?? Macs made since 2007 can provide 1A (or more) per USB port, above the 500mA maximum of standard USB. (Of course, this is only supposed to be drawn after power negotiation.) Both overcurrent and dead shorting them should cause the port to go into overcurrent protection and turn off, with a message to that effect on screen.Thinking aloud: wouldn't it also work to make a USB protector of sorts, that simply adds an inline fuse that would blow in a fault condition?

author: GeoffreyF
author_rank: Regular Contributor
timestamp: October 19, 2018, 02:58:14 pm
content: Grounding is covered in section 8.16 of the third editionChapter 9 also has a lot of useful information."Practical Electronics for Inventors" by Paul Scherz and Simon Monk is also good (and perhaps better for this discussion)2.10 talks about Grounds2.22 talks about Mains powerFigure 2.90 is really great for this discussion.Going back for finding these references, I am reminded that there is much overlap between the two books but Practical Electronics starts at a somewhat more basic level in some aspects. The art of electronics is more for people who are looking to create projects that support college and graduate school experiments while practical electronics is more oriented towards people who want to invent something for it's own sake or as a business opportunity.Geoff

author: Moriambar
author_rank: Unknown
timestamp: October 19, 2018, 03:22:27 pm
content: Quote from: tooki on October 19, 2018, 02:34:40 pmDid measure a 0.076V stable difference between the usb ground and the usb gnd. I connected the scope gnd to it and nothing blew up. Great!QuoteYes, the only project I have that goes up over 5V is a motor one featuring a 12V DC motor, so I think I'll be safe. And, although I understand about "putting the grounding anywhere when you're floating", I feel like for now it's best for me to grow a habit to use the normal gnd, and maybe be extra careful and change it only when needed and floatingQuoteThanks. Yes, both issues are important here…QuoteWell I did not know this. Great! I have a PSU albeit old and crusty (but it was free!) and I can use that one! ThanksQuoteOne can never bee too safe. Thanks a lot, now all is way clearer.

author: Moriambar
author_rank: Unknown
timestamp: October 19, 2018, 03:23:09 pm
content: Quote from: GeoffreyF on October 19, 2018, 02:58:14 pmGreat thanks, also for the book recommendation!

author: sokoloff
author_rank: Super Contributor
timestamp: October 19, 2018, 05:27:06 pm
content: Quote from: tooki on October 19, 2018, 02:39:38 pmIf I had to guess, a little over 2 Amps. I had a circuit that was able to be powered from USB or from a single LiIon, but didn't have good protections to be able to be plugged in both ways. The LiIon could supply 10 Amps; the circuit could draw 3-4 Amps (depending on the configuration of the LEDs); I would test and update the code with patterns that lit very few LEDs or used very low global brightness settings. A bug in the code let too many LEDs be turned on at high brightness which seems to have blown the USB port. Based on other measurements I did with the bench power supply and meters, I'm pretty sure it blew at 2 Amps +/- 20%.

author: tooki
author_rank: Super Contributor
timestamp: October 19, 2018, 08:24:56 pm
content: Quote from: sokoloff on October 19, 2018, 05:27:06 pmHmm. I have serious doubts that 2.4A would cause damage, especially not on later models.Apple's own article on thisis contradictory (and incomplete), in that it says Apple devices can request 1100mA (i.e. 600mA extra), and then later shows a screenshot of an iPhone being given 1600mA extra current (2.1A total). For sure, I wouldn't expect 2.4A draw from a 2.1A port to cause damage, it should just trip the overcurrent protection.(Edit: I just checked with my MacBook Air, which is a mid-2012 and thus belongs to the first generation of Macs with USB 3 ports, and it does indeed show my iPhone as being able to draw 500+1600mA. So we know for sure that all Macs with USB 3 are capable of 2.1A, and we also know that all Macs introduced from 2007 are capable of 1.1A.)Is it conceivable that the liIon somehow back-fed current into the USB port? Or maybe the instantaneous current was too high, e.g. with PWM?

author: sokoloff
author_rank: Super Contributor
timestamp: October 19, 2018, 08:29:29 pm
content: Li-Ion was not connected (and is “downstream” of the Arduino regulator in any case.To be honest, it happened just last week and I haven’t fully power cycled the MacBook to see if it will come back. The port still has power, but doesn’t “see” any devices connected there. I’ll update this thread just out of closure when I do a full reboot and test.

author: tooki
author_rank: Super Contributor
timestamp: October 19, 2018, 08:30:58 pm
content: Oh! In that case, also be sure to do an SMC reset, if power cycling alone doesn't fix it. Others have reported that this brought their USB ports back to life.(See also my added edit to my reply above.)

author: tooki
author_rank: Super Contributor
timestamp: October 19, 2018, 08:43:13 pm
content: Quote from: Moriambar on October 19, 2018, 03:22:27 pmThose are just stray currents, and connecting the grounds is how you equalize them.But FYI, even much higher voltages are possible — it is, for example, absolutely normal for an ungrounded switch-mode power supply to show as much as 1/2 the AC mains voltage between either + or - and ground!! (This is what causes the tingle you can feel on many devices.) But the current is spectacularly low, so connecting one side (typically the negative) to ground is the fix! I guess my point is that measuring a voltage from earth ground to somewhere else isn'tnecessarilya sign of a malfunction. If you're not sure, of course, you already know where to ask!Quote from: Moriambar on October 19, 2018, 03:22:27 pmYes, absolutely!!!!Also, 99.99% of the time, a circuit's ground will be the negative. But the rare positive-ground circuits do exist (mostly in a handful of vehicle electrical systems, and in many power supply circuits, like the cheap 0-30V linear lab power supplies you get on eBay). So if you're unsure, just use your multimeter to determine whether it's a positive or negative ground before connecting the scope. Of course, this only matters if your circuit isn't floating.Quote from: Moriambar on October 19, 2018, 03:22:27 pmYep, as long as the voltage is in the right range, and the PSU has enough current for your circuit, use it!!

author: Moriambar
author_rank: Unknown
timestamp: October 19, 2018, 09:18:26 pm
content: Great thanks!

author: sokoloff
author_rank: Super Contributor
timestamp: October 20, 2018, 02:19:52 pm
content: Quote from: sokoloff on October 19, 2018, 08:29:29 pmOK, so thankfully this was a false alarm.A full power-cycle reboot restored the port's functionality. (Didn't even need the SMC reset.)

author: vk6zgo
author_rank: Super Contributor
timestamp: October 20, 2018, 04:34:53 pm
content: Quote from: Moriambar on October 18, 2018, 01:53:05 pmFor Pete's Sake!If there is a ground on the USB connector, & a 3 pin plug on the computer, it is connected to the building "Ground" (Protective Earth or PE), just as the Oscilloscope is.These points are at the same potential & current cannot flow between them.If you have a PC or Mac with a 2 pin plug, the external metal may take up a voltage halfway between Active & Neutral, but the current available from this will not be sufficient to damage your 'scope if you connect the probe ground clip to it.The only way you can cause damage, will be to place the 'scope ground clip on a point which is not "ground" as far as the device is concerned.In that case, you would probably kill the USB circuitry inside the computer, but will not damage the Oscilloscope.The original situation that brings up these warnings is when someone wants to look at the Mains supply, & inadvertently places the 'scope probe ground clip on the Active line.This, because of the PE system which connects Neutral & Earth (ground) at the point where the power enters the building, will place a dead short circuit across the Mains supply, drawing a lot of current, until the Mains fuse, Circuit breaker, or, if you have one, RCD drops out.Note that "getting it the right way round" & putting the ground clip on Neutral is, also, quite rightly, frowned upon, as you have made a second Neutral/Earth link.If there is something drawing a lot of current close to the power socket you are looking at, due to resistive losses in the wiring, there may be a substantial difference in voltage between Neutral there, & Neutral where it connects to Earth at the power entry to the house.This may also be able to cause enough current to damage your 'scope, especially modern DSOs where the ground connection is via A PCB track.Another situation that could do the same thing is with a fairly high current DC power supply with one side connected to ground.Put the probe ground clip on the non grounded connection, & again, damage may occur.In your case, there is no direct connection to the Mains, & the USB board cannot supply enough current to cook your 'scope.

author: Moriambar
author_rank: Unknown
timestamp: October 20, 2018, 04:38:58 pm
content: Thanks.