Resistors for 2N3904 Transistors and LED Strips

Greetings all. Been stalking the forums here extensively recently but this is my first time posting.

Even though I've been working on hobby projects for a while and definitely understand the importance of resistors, I'm wondering if they're absolutely necessary in this case.

The project is a giant countdown clock, controlled by an Arduino UNO. I'm using all of the digital output pins to drive two custom seven-segment displays, constructed with 12v warm white LED strips.

I'm using 2N3904 NPN transistors for each of the pins. Each pin is connected to the (+) base of the transistors, whose (-) collectors are connected to ground and (-) emitters are connected to the negative leads of the strips. The positive leads of the strips are connected to the 12v power supply.

The 12v power supply is regulated before it makes its way to the Arduino using a 7805. When I use this, and my code, I'm able to make a big impressive countdown clock.

Here's the big question, and I'm sorry if it sounds noobish. Do I really need the resistors between the Arduino output and the transistor base?

During my first iteration of the project, I tried without them and it seemed to work just fine. In many people's documentation regarding these transistors and LED strips with the Arduino, 1 Kohm resistors were mentioned and used. I used them and it dimmed my display (expected) but more than I was hoping.

I found others using 220 ohm resistors which brightens the display but still not matching the level of the unresisted setup. And then I found someone else claiming they weren't needed because the resistors in the strip did all of the necessary work, and the output of the digital Arduino pins is only about 40 mA anyway at max (this transistor is rated for 200mA).

So, I tried the approach without resistors and I was able to run the clock for hours without noticing any ill effects. I figured if the transistors burned out during this experiment, I could easily replace them (they were cheap) but I never needed to do that. Will these transistors (or something else) eventually burn out due to the lack of resistors between the Arduino and the transistors' base or should I be fine?

So, I tried the approach without resistors and I was able to run the clock for hours without noticing any ill effects.

Sounds like you know what to do, but refuse to do it.

A lot of newbies look at diodes and transistors and think they are current limiting devices like an incandescent lamp or a motor or a relay. I think this happens because everyone has set these components before and has never needed to use resistors before to get them to work properly. However, many devices like transistors, LEDs and other diodes, etc. are not current limiting devices and will draw as much current as you send them. If the current source is large enough, they will burn out, sometimes in milliseconds.

It seems to me you understand this, but are not acknowledging the point 100%. I've been there and done this before. The Arduino is actually saving your ass (and mine in the past) by being something of a current limiting device itself. It has to be limiting current because otherwise it would "send everything" to the base of that transistor as the emitter is basically shorted to ground through the non-current limiting LEDs. I can't find documentation for the ATMega328P's output drivers this moment, but obviously there are some internal resistors limiting current for you.

The issue is that you are probably exceeding limits on these pins. How about run one of these output-to-base connections through a microammeter (your multimeter) and see if you are really staying under the 40mA limit. Are you? Have you ever done this experiment before? It's worth doing just to know how to do that if you never have.

As for the dimming problem while using resistors, it sounds like your transistor has low gain. Why not try an NPN darlington or a FET?

http://www.taydaelectronics.com/mpsa12-darlington-transistor-npn.html

You should be able to slap a 1K resistor on the base of this transistor and source only 500uA base current, and have the transistors stay wide open with the Arduino sourcing very little current and staying well under limits.

frankenroc:
I’m using 2N3904 NPN transistors for each of the pins. Each pin is connected to the (+) base of the transistors, whose (-) collectors are connected to ground and (-) emitters are connected to the negative leads of the strips. The positive leads of the strips are connected to the 12v power supply.

Also, I notice this. You say collector to ground, emitter to the strip (which is LOAD below). This is the proper way to use an NPN as a low side switch:

It seems to me that if your description is right you have switched the emitter and collector around. Have you?

Npn_switch.png

Here's the big question, and I'm sorry if it sounds noobish. Do I really need the resistors between the Arduino output and the transistor base?

YES! Without the resistor the base-emitter junction (when wired correctly as shown by Joe) effectively puts a forward-biased diode from the Arduino output to ground. You will get excessive current and possibly damage the Arduino.

I found others using 220 ohm resistors which brightens the display but still not matching the level of the unresisted setup. And then I found someone else claiming they weren't needed because the resistors in the strip did all of the necessary work, and the output of the digital Arduino pins is only about 40 mA anyway at max (this transistor is rated for 200mA).

When wired & operating correctly, a the transistor should be saturated (switched fully-on) so the current is limited/controlled by the LED strip (not by the transistor), and a (small) change in resistance should make no difference in brightness.

First off, thank you all for the replies.

Joe, I think you found the error. This is my first time using an NPN to use an Arduino signal to power an LED strip, so the first thing I found that worked utilized a BC547 transistor. All I had available were some 2N3904s, but I did a little research and found that the logic should be the same. So I tried it, but apparently didn't account for the fact that the BC547's and the 2N3904's pins were reversed!

Somehow it worked still unresisted, but dimmed when I used the resistor. Turned one transistor around, added the resistor, and tested small scale and my "before and after" seem just as bright. This mirrors Doug's comment that (when wired CORRECTLY) a small resistor shouldn't impact the brightness, but I guess the Arduino was preventing any long-term damage.

I will test again full scale but so far I'm optimistic. I'll update you all at that point.

frankenroc: Here's the big question, and I'm sorry if it sounds noobish. Do I really need the resistors between the Arduino output and the transistor base?

Yes, they stop more than 40mA coming out of the Arduino pin.

5 mA will saturate most transistors and that's a 1K resistor. 220 is really too small.

frankenroc: Each pin is connected to the (+) base of the transistors, whose (-) collectors are connected to ground and (-) emitters are connected to the negative leads of the strips. The positive leads of the strips are connected to the 12v power supply.

If that's true then you have the transistor backwards.

The project is a giant countdown clock

I think you'll have much better results sinking current from the LED strips using a TPIC6B595 per digit. These are low resistance open-drain MOSFETs coupled with a shift register. The LED strips are groups of 3 LEDs with current limit resistor, so you don't need to add more. Frees up your IO pins, and a simple set of SPI.transfer()s send the info to be displayed. A PWM pint to the OE/ can be used for brightness control as well.

// time for an update?
digitalWrite (ssPin, LOW);
SPI.transfer(digit0);  // discrete variables,
SPI.transfer(digit1);  // or (digit[1])  data from an array
SPI.transfer(digit2); // or (fontArray[digit[2]]) a font lookup from an array
SPI.transfer(digit3);
digitalWrite (ssPin, HIGH); // time is updated on this edge

This board, with Arduino functionality built in, can control up to 12 digits like that. Connect an FTDI Basic or equivalent to program it, perhaps an RTC module if you're keeping your own time, remove the FTDI and you're all set. Maybe add a couple of buttons for time setting features. http://www.crossroadsfencing.com/BobuinoRev17/

CrossRoads,

This one started as just a countdown in seconds (think New Years) and is my first venture into such a project, but I would like to add the added wow factor with fading utilizing the PWM.

My next project will be a full clock so I'll definitely take your suggestion to heart for that one, even if I don't get to for this one.

So either way, thanks for the info!