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 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: - YouTube
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 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 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.