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.Would something like this work with a separate led power source? I'm REALLY new at this.
3 Answers
The first thing to realize is that you have misapplied your ammeter. You must insert such in series with a circuit by first breaking it, never in parallel. Were USB ports not typically current limited, in shorting VBus to ground through your meter, you would have blown your meter or its protection fuse or the host device's main board.
Next, realistically, it will be hard to detect this by electrical means except in software on the USB host chip. Devices with functional USB peripheral interfaces (ie, not, mini-drone battery chargers) have a pullup resistor on the D+ or D- line, however detecting that with circuitry not intimately cooperating with the USB host controller will be tricky. Were you able to modify the software on the host controller, it would be easy - the information is already obtained while getting ready to enumerate the peripheral, and it would be trivial to drive some available output to light an LED as a result.
One possible electrical option would be to insert a very small shunt resistance in the USB VBus line, and monitor the voltage drop across this with an op-amp. It is conceivably possible that an existing PTC resettable fuse could even function as the sense resistor, since even when cold it probably has a small resistance, but this will vary a lot with rating, and may be only a fraction of an ohm. That would mean you would need a well designed and carefully connected circuit to sense a low-current peripheral.
But for a DIY graft-on minimally modifying the existing circuitry, I think your best bet might be optical or conceivably mechanical. Perhaps you can rig an IR LED and phototransistor looking through the existing cutouts in the USB socket to detect beam blockage resulting when a plug is inserted.
-
\$\begingroup\$ Thank you for the reply. And you are correct, I misapplied my meter. I'm intrigued by the optical route you mentioned. \$\endgroup\$ Commented Jun 3, 2015 at 19:35
How much current does your USB device consume?
One method would be to insert a Hall-Effect current sensor in series with the +5V line going to the USB port. The output of the current sensor is a linear voltage that is proportional to the current flowing through the current sensor.
One such part is the Allegro ACS714LLCTR-05B-T - this sensor is rated for a maximum of 5 Amps. The internal resistance of the sensor is about 1.2 milli-Ohms and will have no effect on anything that you have plugged into your USB port.
You will need to decide on the current threshold that you want to detect. The actual detection can be done with a comparitor or a microcontroller with a/d converter.
i think traditional method is using low resistance but high wattage resistor , so it wont cause power loss but create noticeable difference enough to cause used sensory componnts to trigger... ie place a resistr/shun in series on line and use voltage differece on resistor as signal that informs if port is in use ...