powering a USB powered device

What I have is a set of USB powered woot.com Woot-Off rotating lights that I bought to use as an attention-getting indicator for projects. They plug in to a single USB port and there are two rotating beacons. The data lines are not used, only power.

I broke out a USB extension cable’s wires to measure that this device draws 103 mA. So, that’s too much for an output pin to power directly.

I’m trying out a “Common BJT Transistor - NPN 2N3904” from here: http://www.sparkfun.com/commerce/product_info.php?products_id=521

I have the transistor wired like this:

C - 5V pin on Arduino
B - Arduino pin 5.
E - positive pin on my USB power jack* the lights are plugged into

*USB power jack is the female end of a usb extension cable soldered to header pins so I can use it with a breadboard. Negative pin is wired to ground. The light device is plugged into the jack.

When I set pin 5 HIGH and the device disconnected, I’m only seeing 4.5 V at the emitter, instead of 5 V which I kind of expected. (I measured 4.0 V when the lights are connected.) As a result, the rotating lights work somewhat inconsistently and I’m sure they aren’t happy being slightly underpowered.

Am I using this transistor correctly?

From what I’ve read I thought the transistor would essentially act as a switch. What can I do differently to supply this output device with 5V, 103 mA? As a test, running my Arduino from external power vs. USB power doesn’t improve the situation.

Thanks in advance!

Am I using this transistor correctly?

No, you should have the load (the lamp) in the collector circuit and the emitter of the transistor should be grounded. You should also add a resistor of about 1k Ohms in series with the base connection:

Collector: negative side of load
Base: via 1k Ohms to Arduino Pin 5
Emitter: Ground.

Positive side of load: 5V.

That worked perfectly.

Just so I’ll understand what I’m doing in the future, is it the fact that I was sourcing current with the transistor instead of sinking?

And what role does that 1k resistor play in my mistake?

Thanks!

To saturate (turn on fully) an NPN transistor, you need to pass several mA through the base to the emitter. In order to do this, you need to exceed the turnon voltage for the base-emitter junction, since it acts like a diode. This is typically 0.6 or so volts. Before the voltage difference between the base and emitter reaches 0.6 volts, the transistor is not on at all.

If you put the emitter “above” the load you’re trying to control, it becomes very difficult for your Arduino to get the 0.6V difference between the base terminal and the emitter terminal. You have to overcome the forward voltages of your load LEDs and the dropping resistor, all of which is already looking for 5 volts, plus the turnon voltage of the transistor base, and you have to put a few mA through the whole thing. The Arduino only outputs 5 volts, making this pretty difficult.

Now, putting the emitter directly to ground means that you can get plenty of voltage difference between the base and emitter. You use a resistor to limit the current through the base-emitter junction because it might be possible to damage the transistor or Arduino output pin if too much current flows.

I get it!

I really appreciate the fix as well as the lesson. I’ll be posting my project to Exhibition as soon as I get pictures.