2
\$\begingroup\$

I have a USB keyboard. As I work many times in the darkness, I put some LEDs into the keyboard case. I connected two pairs of yellow standard LEDs serially to the USB power lines (Vcc and ground, pin 1 and 4).

  ┌───⊳|───⊳|───┐
⊕─┤             ├─⊖
  └───⊳|───⊳|───┘

enter image description here

Now when I plugin the keyboard the four yellow LEDs turn on for a second, begin to flicker and then turn off. The keyboard works, though.

Standard LEDs need about 20 mA, if driven at the correct voltage (2.5 V might be a bit to much, that means they possibly need more than 20 mA). So for two pairs of serially connected LEDs that would only be 40 mA (or maybe a bit more due to overvoltage — at least I am sure that they need more than 1,67 V, because if I connect three LEDs serially to the USB, they don’t light up).

Why does that happen? Does the keyboard possibly tell the computer that it doesn’t need so much current/voltage and then the computer cuts it down?

Update

I have just soldered two cables to a USB powered USB hub and plugged them together with a similar four LED array into a breadboard. And what happened: The LEDs shine and stay lit up for ever. Then I connected my modified keyboard with its four new LEDs. The four LEDs in the breadboard stay lit, but the ones in the keyboard turn off again after a second. The keyboard works. I am using it to type this. How is that possible?

I have measured current and voltage for the LEDs on the breadboard: The USB hub provides a voltage of exactly 4.2 V! A current of 19 mA runs through the breadboard LEDs. A little bit low for two LEDs in parallel, but I don’t need a resistor.

\$\endgroup\$

2 Answers 2

5
\$\begingroup\$

Before USB enumerates the minimum current available is 100mA, you can find more information in the question How to get more than 100mA from a USB port? Because it's unlikely that the keyboard would require above 100mA I suspect it wouldn't be requesting more than 100mA so that will be the technical limit on how much you can draw when combined with the keyboard.

Without measuring the current used by the keyboard there's no sure way to know, but I'd hazard a guess at around 20mA. Although a USB compliant device shouldn't draw more than 100mA before it's been requested many PC USB controllers don't actually check / enforce that and often drawing 500mA doesn't cause a problem, even though it's not recommended.

I suspect your main problem is connecting the LEDs without a current limit resistor, that's almost always a bad idea because they like to driven by a current source rather than voltage. A yellow LED normally has a forward voltage drop of 2.1V so you'll have 4.2V for each pair of LEDs. Insert a 47 ohm resistor in series with each pair to limit the current to 20mA and I think it should solve your problem.

If you'd like to experiment with different LEDs and amounts of current there are a number of on-line LED calculators available. For example here's a LED series/parallel array wizard and the same site has a LED calculator for single LEDs.

\$\endgroup\$
0
3
\$\begingroup\$

Sorry I am just an idiot. I wanted to measure the voltage on the keyboard. Then I noticed something: I have soldered the LED array to a very big pin, that I thought it would be the ground (from my experience the ground is mostly found on that big pins. But it was D+, a data wire. I have then resoldered this wire to the real, very small ground. Now it works. The LEDs stay lit.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.