Controlling 6 Strips of 16LEDS each with transistors and Arduino?

Hello everybody,

I’m very new to arduino and to electronic in general. I started few months ago with help of this forum and internet, so please forgive me any obvious mistakes. Any help will be welcome.

I’m trying to switch 1 to 6 strips of 16 LEDs accordingly to a sensor.

So far, I managed to switch 1 to 6 LEDs (1 LED per strip) accordingly to a sensor.
I also managed to power 1 and 2 strips of 16 white LEDs each using an external 9V Power supply.
Then I learned about using a transistors as an electronic switch, that I successfully applied to control 1 LED.

The problem that I encounter is controlling the 16LEDs strip with my transistor. So far it lights up all the LEDs slightly and “vibrate” the light, creating a visual noise.
I tried to change the resistor (R10) going to the transistor Base as that’s the one I’m less sure about, but without success:
4.7K was working for one LED, not for 16
I tried a lower resistor to bring more current in 2.2K,
then I tried to do some obscure calculations that gave me 5.6K… All of the 3 tests gave me the same negative, dimmed and noisy light result.

Transistor is BC337-25 (NPN).
Leds are 5mm white, I don’t have datasheet for them.

Any advices?

(Once I’m able to controle one strip of 16 LEDs with my Srduino, I’m planning to plug each strip of 16 LEDs on separate Pins to controle then.)

i think R10 is too high.... try using 100 ohm for R10....

Thanks for your suggestion Toxman. I just tried but it is without success unfortunately.

No difference except maybe the leds lighting up a bit brighter maybe. Still dimmed, vibrating, and not following the instruction of my Arduino.

The resistor can be much lower. Try 220 Ohms.

I just tried 220 Ohms and similar result. I noticed that when looking in front of the dimmed LEDs they seem to get a tiny peak of intensity every second, which could match with the Arduino changing the Pin5 to High and Low.

Here is a little video: You can't really see the peak, but you can see it's not switching on and off, but "vibrating". The LEDs look far brighter in the video than in real.

I'm starting to think that R10 is just one part of the problem.

I just plugged back the single LED controlled nicely with the transistor to double check.

Here is the video of what I would like to happen with the 16 LEDs instead of the single green one:

I switched on the circuit, so the weird dimmed blinking happened as usual. Then I unplugged the Pin, which switch off the LEDs as expected, but then I plugged it to an other unused Pin. The LEDs switched on with the dimmed blinking again.

It's like any pins, regardless if I'm sending Low, High or even nothing, send the same parasite current to the base of the transistor.

Did you set the Arduino pin as OUTPUT?

Yes, I used the same code than for the successful test with 1 LED.

const int driverPin = 5;

void setup()
    pinMode (driverPin, OUTPUT);

void loop()
    digitalWrite (driverPin, HIGH);
    delay (1000);
    digitalWrite (driverPin, LOW);
    delay (1000);

What happens if you connect the base of the transistor to ground/+5V (via the resistor)?

It does the same bad vibrating light as with any of the normal pins :cold_sweat:

Did you follow something like this?? I know this is for RGB strips, but it's the same concept. (However, these strips have the resistors built in.) Just trying to eliminate variables...

I didn't know this diagram, interesting. It's quite similar to my set up except I use a different transistor BC337-25 to controle one strip of LED.

I just did one test to isolate the problem. I was checking if the transistor maybe can't support 16 LEDs so I plugged only 1 — same problem.

So the only difference with my successful test is the external power supply. It is working when the LED (via transistor) is powered by the microcontroller, Arduino 5V+ and Arduino ground. It is not working when the LED (via transistor) is connected to my external Power supply (needed for 16 LEDs).

I tried providing something closer to the Arduino 5V with the power supply, 4.5V — same as 9V.

That look like a progress but I still don't understand why.

White LEDs have Vf in the 3.3V range BC337 has Vce of 0.7V when saturated. (9V - 2 x 3.3V - 0.7V)/150 = 11.33mA/"string" * 8 = 90mA thru the transistor.

To get the transistor to saturate, you need 1mA, so lets figure 5 to make sure. (5V - Vbe-sat)/R = 5mA, so (5V - 0.7)/5mA = R = 860 ohm With R10 = 220 that should definitely put it into saturation.

Are you sure the transistor is connnected properly? Looking at the flat face, Collector is the left pin, goes to LED resistors, Base is middle pin, goes to Arduino resistor, Emitter is the right pin, goes to Gnd and the 9V -.

Not having the battery- connected to Arduino Gnd would cause problems too.

page 2, top left

CrossRoads: Not having the battery- connected to Arduino Gnd would cause problems too.

CrossRoads, you nailed it!

The Emitter have to be connected to Arduino Ground AND 9V-

Many thanks to everybody, it helped a lot.