Thread: USB Current Leakage

  1. #1
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,273

    Exclamation USB Current Leakage

    Hello,

    This seems to have happened several times now. If I use my computer for a while (a few hours) and then shut it down, around ten seconds later I see this bright (as in, white light) flash, although I'm not sure where it is originating from (I'm usually halfway out the door by then). All devices still work afterwards.

    My theory at the moment is that the scanner (CanoScan D646U) is the culprit. The thing is, it is usually unplugged from the mains, but is connected to the computer via USB. It cannot be powered by USB. I do think that it is somehow picking up residual current from the link and storing it, then when the power is cut it discharges.

    Is there a way that I can test for dangerous USB devices?

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    If it isn't plugged in, it isn't grounded properly -- maybe a bad idea to then leave that attached to a USB port. If the printer accumulates a static charge from the environment, it will ground thru the USB port because the port on the printer is grounded to everything else in the printer, and the proper ground (the plug) is disconnected. So the port on the computer acts as a ground for the unplugged printer because the computer's usb port is properly grounded via the computer's plug. The path of least resistance is out thru the usb into the computer into the wall.

    I'm no electrician, so this next part is conjecture, but: when the computer is on, the resistance in the live port closes that ground off, so the printer accumulates a charge up to whatever that resistance represents, then, as you say, discharges it after powering off. If that's true, there would be no way to prevent it -- ie, it's not that the device is "dangerous", it would be that you are using it improperly.
    Last edited by MK27; 05-02-2011 at 08:24 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  3. #3
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by SMurf View Post
    Hello,

    This seems to have happened several times now. If I use my computer for a while (a few hours) and then shut it down, around ten seconds later I see this bright (as in, white light) flash, although I'm not sure where it is originating from (I'm usually halfway out the door by then). All devices still work afterwards.

    My theory at the moment is that the scanner (CanoScan D646U) is the culprit. The thing is, it is usually unplugged from the mains, but is connected to the computer via USB. It cannot be powered by USB. I do think that it is somehow picking up residual current from the link and storing it, then when the power is cut it discharges.

    Is there a way that I can test for dangerous USB devices?
    What other devices do you have that can produce a bright white light? (all in one printer, etc.)

    Also... are you using a power bar and shutting off the AC to all your equipment when you shut down?

    There are a couple of reasons for asking this question...
    1) You might be seeing a harmless supply discharge in a scanner, all-in-one, etc.
    2) You should be aware that PC power supplies really don't like being turned on and off all the time.

    I used to repair switching power supplies like those used in PCs and most of the time the problem was with the rectifier diodes on the primary side of the power supply. When first turned on, there's quite a spike of current as the capacitors charge. The diodes are designed to take this surge occasionally (as in after a power failure) but they are not intended to endure huge current surges on a repeated basis. Eventually they will fail.

    So, turning your power bar on and off could actually be shortening the life of your power supplies rather significantly...

  4. #4
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,273
    Well I was hoping that a device that cannot be bus powered shouldn't be taking anything from a link to host without its own power supply, I don't know much electronics but it seems to me that if you've got a DC input then the USB part of the circuit should have appropriate protection against current being pushed back to the host and vice-versa. In saying that this isn't the first time I've come across a USB device that's supposed to have its own PSU doing strange things in the absence of it.

    Standards, eh? What would we do without them?

    CommonTater: Translating from your native Canuck, I take it you mean a power bar as a block of sockets that extend a single socket? Yep, I have one of those. It has six sockets and is "surge protected" (has a green LED on it).

    The usual way I turn the system off is:-
    1. Shut down Windows;
    2. Wait until the computer goes off;
    3. Turn off the "power bar" at the wall socket (British sockets have switches).

    Is there something wrong with doing this?

    P.S. The scanner is the most obvious culprit, it does have a fluorescent tube in it. The printer is on the floor in the corner, "behind" the computer from my perspective, and connected to the "power bar" along with the computer. A flash from that wouldn't light up the door on the opposite side of the room.
    Last edited by SMurf; 05-02-2011 at 03:09 PM.

  5. #5
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Yeah that's a power bar... Canuck style... Power Bars | Canadian Tire

    Yes, It can be bad to repeatedly remove and reaplly AC power to switching power supplies.

    Hmmm... lets see if I can give you a better explanation...

    Switching supplies have 2 sides... the "AC" side is a set of diodes and capacitors that are "always on", even when the supply itself is off. The "equipment" side also has diodes and capacitors that turn on and off with the computer (or whatever) but these generally operate at much lower voltages.

    The AC side of the supply is prone to very large surges of current when first turned on. Because of the higher voltages involves, these can exceed the diode's power ratings for the first fraction of a second. Doing this repeatedly can damage the diodes by slowly reducing their margin of safety, until one day, one (or more) of them fails. At this point, trying to compensate from the equipment side usually takes out the rest.

    Now this is not something that's going to happen the 3rd time you flip that wall switch, but it does shorten the life of your equipment. I can't give you hard numbers (I doubt there are any) but given the number of switching supplies I've seen with blown AC side diodes in them, I can tell you it's not just an active imagination talking.

    I would guess, based on experience, that if you are removing AC power from your equipment, say twice a day, you are cutting it's useable lifetime by a third. Compared to the tiny bit of current they draw when "off", I would say this is not an acceptable risk.
    Last edited by CommonTater; 05-02-2011 at 05:33 PM.

  6. #6
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by SMurf View Post
    I don't know much electronics but it seems to me that if you've got a DC input then the USB part of the circuit should have appropriate protection against current being pushed back to the host and vice-versa. In saying that this isn't the first time I've come across a USB device that's supposed to have its own PSU doing strange things in the absence of it.
    As I was trying to explain earlier, the "protection" you are describing is NOT POSSIBLE. As far as standards go, the USB port must be grounded to the device. If the device is then grounded properly -- ie, is plugged in -- any current pushed into the device will exit via the ground. Repeat this to yourself: "The USB must be grounded. The USB must be grounded." Get it?

    If you plug in the USB but not the PSU, of course you could accumulate a charge. The only way to prevent that would be:

    1) Don't ground the USB, which would create a hazard when the device is plugged in and being used properly.
    2) Violate the laws of physics.

    So sorry, Smurfy, complaining that this is a bad design or due to a lack of standards is like saying "man, this toaster is badly designed, I can't throw it into a bathtub safely with the power on". That is mis-use. Mis-use is an endless regress. Eventually you will be saying "Man this hammer is not safe -- look what happens when I hit myself in the head with it".

    Here's the moral: If you want to leave the USB plugged in, leave the power cord plugged in. If you don't want to leave the power plugged in, unplug the USB. Very simple. And don't complain if, after accidentally hitting yourself in the head with a hammer, you then do it again on purpose and it hurts. Your head hurts because you hit it with a hammer. Don't do that, and don't blame the hammer or anything else.
    Last edited by MK27; 05-03-2011 at 06:00 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  7. #7
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by CommonTater View Post
    I would guess, based on experience, that if you are removing AC power from your equipment, say twice a day, you are cutting it's useable lifetime by a third. Compared to the tiny bit of current they draw when "off", I would say this is not an acceptable risk.
    How "small" currents are you talking about here?
    In my experience, PSUs can draw quite a lot of power when they're off (as with any power supply of any kind).
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  8. #8
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,273
    Quote Originally Posted by MK27 View Post
    As I was trying to explain earlier, the "protection" you are describing is NOT POSSIBLE. As far as standards go, the USB port must be grounded to the device. If the device is then grounded properly -- ie, is plugged in -- any current pushed into the device will exit via the ground. Repeat this to yourself: "The USB must be grounded. The USB must be grounded." Get it?
    OK, but if the USB cable is connected to the computer and the computer is grounded, and by being connected to the computer the device is (broadly) part of the same circuit, why should the device accumulate a charge if it is specified to not work without a PSU connected? USB signalling is electrical, I know, but if it cannot work in that state, should it be doing anything?

  9. #9
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by SMurf View Post
    OK, but if the USB cable is connected to the computer and the computer is grounded, and by being connected to the computer the device is (broadly) part of the same circuit, why should the device accumulate a charge if it is specified to not work without a PSU connected? USB signalling is electrical, I know, but if it cannot work in that state, should it be doing anything?
    I would guess because when the computer is on, the USB port produces a current. In other words, when the computer is off, it will work as a ground, but when it is on, it is less likely to do so.

    Hmmm. Perhaps my theory here WRT the grounding of USB ports is flawed. Certainly, it is too simplistic and raises some questions about how it's grounded, etc. I did a bit of googling and

    USB in a NutShell - Chapter 2 - Hardware

    More intensive reading than I really feel like doing right now, but I'm sure there are some clues in there.

    Anyway, Smurfy, if you have a large device capable of acquiring a substantial static charge attached to your USB port with no other potential ground, do you think that is a good idea??? A printer has like, orders of magnitude more mass than a key drive. If I took an outboard engine, encased it in rubber, then ran a wire into the front of your box, is that something that looks safe and wise to you?

    So I dunno, maybe there is or could be some safety standard here. On the other hand, maybe there ain't...I'd err on the side of caution.
    Last edited by MK27; 05-04-2011 at 05:00 PM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  10. #10
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by Elysia View Post
    How "small" currents are you talking about here?
    In my experience, PSUs can draw quite a lot of power when they're off (as with any power supply of any kind).
    Standby current on most PC supplies is very low (150ma is typical) which considering efficiency, internal consumtion, etc, translates to about 1.5watts at the AC connector. Monitors usually draw less than a watt in "off" mode. Printers, scanners and such way less than a watt. Laptop supplies, when not charging the 'puter typically draw 1/4 watt for internal consumption.

    We're talking about pennies per month on your electric bills.

    The ones that really suck power when "off" are television sets... typically 3 to 5 watts, since they have to keep the infrared eye active for the remote control.

    Compare that to the 60 watt porch lights most people burn all night....

  11. #11
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    That seems awfully low, you know. I have measured my own equipment, which draws around 30W when off IIRC (might be more).
    This includes TV and computer. Although the computer PSU can power stuff in its off-mode too, but I honestly think you're being too optimistic here.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  12. #12
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by Elysia View Post
    That seems awfully low, you know. I have measured my own equipment, which draws around 30W when off IIRC (might be more).
    This includes TV and computer. Although the computer PSU can power stuff in its off-mode too, but I honestly think you're being too optimistic here.
    Then you have problems... TV + Computer + Printer + Monitor should be around 6 or 8 watts at the very most.

    The only things being powered when the PSU is in off mode are your network adaptor, the logic for the On button and the BIOS clock...Things that can be used to wake the computer... As I explained TVs are bad for this since they need to keep the IR chip running and often have scheduling features that require the main controller chip to be active.

    But definately 30 watts is a bit too much... unless there's something else plugged in there too... like a modem and router that are always active...
    Last edited by CommonTater; 05-05-2011 at 05:18 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How can detect memory leakage?
    By pronetin in forum C Programming
    Replies: 9
    Last Post: 10-07-2010, 06:37 AM
  2. Is there a memory leakage in this simple code snippet
    By meili100 in forum C++ Programming
    Replies: 31
    Last Post: 05-29-2008, 03:11 PM
  3. Does this code has memory leakage?
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 04-08-2008, 08:13 PM
  4. Question about the Basics of Memory Leakage
    By Shamino in forum C++ Programming
    Replies: 12
    Last Post: 09-26-2005, 09:42 AM
  5. memory leakage?
    By xagiber in forum C++ Programming
    Replies: 1
    Last Post: 02-04-2002, 02:57 PM