USB power

richaron

Golden Member
Mar 27, 2012
1,357
329
136
Hi all, just a question to satiate my curiosity. I have a simple USB light:

USB light when plugged/unplugged initially turns on. From both computers and wall adapters. So I plug it in and the light instantly turn on. Good.

USB light when already plugged into wall adapter remains off as i flick the switch at the wall (I tried a couple of different adapters). It works when I hit the power button* of course. Bad for my hack of putting an adapter on a timer.

Question: What's the difference between plugging/unplugging a cable and switching(/unswitching) an AC adapter?

As I understand it, the basic USB power is a dumb system, no protocols/negotiation as opposed to "Quick Charge" and the like. Thus I expected the USB light to be simple. The *power button on the light is purely electronic, it feels like a short throw rubber dome with no mechanical difference between on/off states.

I can only guess there is some sort of ramp up in the voltage as the transformer/rectifyer starts up, and due to a quirk of the light it behaves differently. But can anyone expand on this idea, or correct me? If not, all good.

Cheers.
 

Red Squirrel

No Lifer
May 24, 2003
70,592
13,807
126
www.anyf.ca
From my understanding the 5v rail always supplies 5v at a fixed max current rating depending on the motherboard (500ma is standard), however there is a protocol to alter this power, such as requesting higher current. Actually, it looks like you can even change the voltage, this is new to me TBH: https://en.wikipedia.org/wiki/USB#USB_Power_Delivery

I don't imagine all motherboards support this though.
 

freeskier93

Senior member
Apr 17, 2015
487
19
81
Power delivery over USB isn't "dumb". I'm going to assume the light conforms to USB 2.0 specifications, which means the light cannot draw more than 100mA on initial plug in. If it needs more than that the device has to negotiate the 500mA maximum.
 

richaron

Golden Member
Mar 27, 2012
1,357
329
136
Thanks for the input guys, I was always under the impression a USB (2.0+) device could draw 500mA (@5V) without negotiation. The light itself is 1.7W.

These points are all kinda academic though, since I can't see how they address the issue I'm having... The light is sufficiently powered in any case.

Or are you suggesting the AC adaptors have mic's and the act of power negotiation causes the difference in initial on/off states?
 

MrTeal

Diamond Member
Dec 7, 2003
3,919
2,708
136
I think I misread, are you saying you plugged the light into an adapter that is already plugged in and on, and it function correctly, but if the light and adapter are plugged in but the switch is off the light won't turn on if you turn on the switch?
 
Last edited:

richaron

Golden Member
Mar 27, 2012
1,357
329
136
1) Light always "functions". I can use the light's inbuilt power button to turn on/off. On all USB ports I've tried.

The question is the different behavior.

2) Plug into a "hot" port the light defaults to "on" (i.e. PC already on, or AC adapter already switched on).

3) Plug into a "cold" port, then turn on port, the light defaults to "off" (i.e. AC adapter turned off, light plugged in, then adapter turned on).

Once again, the light always works when plugged into a powered USB port. The difference is whether the default state is on or off, and I'm wondering why (and if there's anything I can do to hack it).

Hope that clarifies a bit.
 

jillybean420

Junior Member
Dec 28, 2015
4
0
0
Like said above, USB doesn't give a lot of power (500ma) - but some motherboards now come with high voltage USB 3.0 ports on the back, but I don't know in many situations where that helps... I think normal ports deliver 5V anyway?
 

Mr Evil

Senior member
Jul 24, 2015
464
187
116
mrevil.asvachin.com
I think it's likely that the reason is the one you have already guessed.
...I can only guess there is some sort of ramp up in the voltage as the transformer/rectifyer starts up, and due to a quirk of the light it behaves differently...
It could be that there is a race condition in the hardware; whether the light switches on or not depends on the order in which two parts of the circuit turn on. If power is applied instantly by plugging it in to the computer while it's already on, those two parts of the circuit get turned on simultaneously. If the PC is turned on later instead, the slower ramp in voltage might prevent one part of the circuit from starting to work until a few milliseconds later.

Or it could be something else. There's no way to be sure without examining the hardware (and maybe firmware, depending on how "smart" the light is).
 

richaron

Golden Member
Mar 27, 2012
1,357
329
136
I think it's likely that the reason is the one you have already guessed.

It could be that there is a race condition in the hardware; whether the light switches on or not depends on the order in which two parts of the circuit turn on. If power is applied instantly by plugging it in to the computer while it's already on, those two parts of the circuit get turned on simultaneously. If the PC is turned on later instead, the slower ramp in voltage might prevent one part of the circuit from starting to work until a few milliseconds later.

Or it could be something else. There's no way to be sure without examining the hardware (and maybe firmware, depending on how "smart" the light is).

As far as I can tell the light has no "smarts" apart from an on/off switch. For the record it's an AquaLighter Pico from this Ukranian crew making good stuff. I'm setting up a tiny planted aquarium and thought it'd be cool to have as much as possible @ 5V. But I also want the light to be on a timer.

Thanks for your reply, you've given me a reasonable sounding explanation and a little piece of mind. I'm gonna work on the theory the AC -> DC system must be "hot" (even under no load? I guess it worked before...) and try putting a timer on the DC side. Somehow.

Or I'll get another light. Go consumerism.
 

razel

Platinum Member
May 14, 2002
2,337
93
101
Your light is more likely sensing the data lines off the USB port. You can actually just short the data lines to force it to be a 'power only' USB port. Using a piece of aluminum foil to short the middle two pins inside the USB plug was a common 'fix' for Garmin GPS to force them to charge in all USB ports.

By the way, more recently, I noticed some smartphones seem to want the data lines disconnected rather than shorted to force them to draw as much power as it can before voltages drop, so you can try that as well. Instead of foil, just cut out a small piece of paper in the right shape to short the middle two pins.
 

freeskier93

Senior member
Apr 17, 2015
487
19
81
As far as I can tell the light has no "smarts" apart from an on/off switch. For the record it's an AquaLighter Pico from this Ukranian crew making good stuff. I'm setting up a tiny planted aquarium and thought it'd be cool to have as much as possible @ 5V. But I also want the light to be on a timer.

Thanks for your reply, you've given me a reasonable sounding explanation and a little piece of mind. I'm gonna work on the theory the AC -> DC system must be "hot" (even under no load? I guess it worked before...) and try putting a timer on the DC side. Somehow.

Or I'll get another light. Go consumerism.

A little late, but that light is 1.7 watts. At 5V that's 340mA of current, which exceeds the 100mA initial limit. This means the light has some kind of active chip (like an FTDI chip) that will enumerate itself to the USB host controller and negotiation the full 500mA of current. These chips then have some kind of power enable line that controls a MOSFET or some kind of switch that turns the light on.

This works fine and dandy when connected to a computer with a USB host controller, but it presents a problem when connecting to an AC wall adapter because there's no data. One solution is a simple user switch that over rides the chip to turn the light on. Another solution is use a chip that can detect dedicated charging devices, but this may not work with all adapters.

I still can't tell you why exactly the light is behaving how it is, but point is there's a lot more going on under the hood that could easily lead to unexpected behavior.
 

freeskier93

Senior member
Apr 17, 2015
487
19
81
As far as I can tell the light has no "smarts" apart from an on/off switch. For the record it's an AquaLighter Pico from this Ukranian crew making good stuff. I'm setting up a tiny planted aquarium and thought it'd be cool to have as much as possible @ 5V. But I also want the light to be on a timer.

Thanks for your reply, you've given me a reasonable sounding explanation and a little piece of mind. I'm gonna work on the theory the AC -> DC system must be "hot" (even under no load? I guess it worked before...) and try putting a timer on the DC side. Somehow.

Or I'll get another light. Go consumerism.

A little late, but that light is 1.7 watts. At 5V that's 340mA of current, which exceeds the 100mA initial limit. This means the light has some kind of active chip (like an FTDI chip) that will enumerate itself to the USB host controller and negotiation the full 500mA of current. These chips then have some kind of power enable line that controls a MOSFET or some kind of switch that turns the light on.

This works fine and dandy when connected to a computer with a USB host controller, but it presents a problem when connecting to an AC wall adapter because there's no data. One solution is a simple user switch that over rides the chip to turn the light on. Another solution is use a chip that can detect dedicated charging devices, but this may not work with all adapters.

I still can't tell you why exactly the light is behaving how it is, but point is there's a lot more going on under the hood that could easily lead to unexpected behavior.