How to light led to indicate usb port has a plug in it.

Thread Starter

Matt Avery

Joined Jun 3, 2015
4
I'm looking for a way to light a 3.0v-3.4v 20mA LED to indicate when a usb 2.0 port has a plug in it. The light should only be on when a device is plugged in. My usb 5v line is about 3.2 to 3.3 amps with an Xbox 360 Controller connected. I tried wiring the led and resistor in series with the 5v usb port. The LED lit but the plugged in device did not work. I'm guessing the LED was only allowing 20mA to the device (Xbox 360 Controller) which was not enough for it.
 

tjohnson

Joined Dec 23, 2014
611
You need to wire the LED in parallel. Series wiring divides voltage, so the Xbox doesn't work when wired in series with the LED because it only gets 1.6-2.0V. Parallel wiring divides current, which would allow the LED to get 20mA and the Xbox to get approximately the same amount of current it was using before. Make sure that the resistor you use is the appropriate value.
 

Thread Starter

Matt Avery

Joined Jun 3, 2015
4
You need to wire the LED in parallel. Series wiring divides voltage, so the Xbox doesn't work when wired in series with the LED because it only gets 1.6-2.0V. Parallel wiring divides current, which would allow the LED to get 20mA and the Xbox to get approximately the same amount of current it was using before. Make sure that the resistor you use is the appropriate value.
thank you for the reply. Wouldn't the led be on all the time then in parallel? I only want the led to light when something is plugged in. The device completes the 5v usb line.
 

tjohnson

Joined Dec 23, 2014
611
thank you for the reply. Wouldn't the led be on all the time then in parallel? I only want the led to light when something is plugged in. The device completes the 5v usb line.
Do you mean that you only want the LED to be lit momentarily when the Xbox is plugged in, or that you want it to stay lit the entire time the device is plugged in?
 

Thread Starter

Matt Avery

Joined Jun 3, 2015
4
Do you mean that you only want the LED to be lit momentarily when the Xbox is plugged in, or that you want it to stay lit the entire time the device is plugged in?
It needs to be lit the entire time the device is plugged in. I've built a PC in a Xbox 360 case and want the usb ports to light up "the ring" when the controllers are plugged in just like the real thing. Microsoft did it with software. I'd like to do it electrically.
 

tjohnson

Joined Dec 23, 2014
611

Thread Starter

Matt Avery

Joined Jun 3, 2015
4
Almost. And thank you so much for your help. Those leds would remain on whether something was plugged in or not. I need led #1 to light up only to indicate when a controller is plugged in to usb #1 (on the top right). If nothing is plugged in it should be off. Transistor_5.jpg
 

tjohnson

Joined Dec 23, 2014
611
Almost. And thank you so much for your help. Those leds would remain on whether something was plugged in or not. I need led #1 to light up only to indicate when a controller is plugged in to usb #1 (on the top right). If nothing is plugged in it should be off. View attachment 86680
Unfortunately, I don't think there's a simple way to implement what you want. It looks like your question has been answered on StackExchange.
 
Last edited:

wayneh

Joined Sep 9, 2010
18,104
I know how I'd do it: Use a comparator (LM393, for example) to sense the tiny voltage increase on the ground return line that will occur when something is plugged into the USB power pins. The output of the comparator can sink ~5mA when it goes low, and this is enough for an indicator LED. If you need more current, you'll need an external transistor (MOSFET) under control of the comparator.

If you cannot detect a small voltage increase at the ground line, you can add a shunt resistor with <0.1Ω. It will have only a tiny effect on the power to the load, but will give you a few millivolts of voltage drop and that will be plenty for the comparator to see.
 
Top