I am fairly new with arduino and especially the small electronic hardware. Now I want to control around 6 LEDS per pin, but the signal from the arduino is so weak you don't even see them shine...
What can I do to amplify the signal or current/voltage?
What I intend to do: I want to control the LED brightness with a ultrasonic distance sensor.
Jimbo's example shows the leds connected in parallel. If you have only 5V supply available then that is probably your only option. However, if you have a higher voltage like 9V or 12V, then you have the option of connecting some of the leds in series. This is more efficient, especially if you are connecting many leds to many arduino pins. You still need those transistors more than ever because they can switch more current and higher voltages that would damage the Arduino if you connected the leds directly to the pins.
Here is a very usefull page that will calculate the best option for serial/parrallel connecting your leds, and calculate the series resistors for you.
Sorry, made a mistake in the previous post. It is possible to connect the LED to the normal pins as well right, when only using a digitalwrite function. The white LEDS don't have to be controlled
LarryD:
Yes, you can then just turn them on/off under your program control. 20ma (directly) per pin max.
But then the same issue, one led uses 20 mA, and I have to turn 4 to 6 LEDS on/off / control them.
I made a mistake in my previous post, so here it is again:
I have 3 groups of LEDS:
2 blue groups of 4 LEDS each, 8 or 9 total (uneven)
1 white group of 5 LEDS
I want to control the blue ones with the arduino , and connect their brightness with a distance sensor. (The closer an object, the brighter the LED)
The LEDS work great on batteries, now only the arduino part.
I have bought a BD139 transistor which, according to internet, would solve all the problems. But it doesn't amplify the signal, I think that the incoming voltage or current is too low.
I also have two P2N2222A E10 transistors.
How can I amplify the signal from the PWM pins of the arduino uno to controll the leds?
PaulRB:
Jimbo's example shows the leds connected in parallel. If you have only 5V supply available then that is probably your only option. However, if you have a higher voltage like 9V or 12V, then you have the option of connecting some of the leds in series. This is more efficient, especially if you are connecting many leds to many arduino pins. You still need those transistors more than ever because they can switch more current and higher voltages that would damage the Arduino if you connected the leds directly to the pins.
Here is a very usefull page that will calculate the best option for serial/parrallel connecting your leds, and calculate the series resistors for you.
Paul
On that website I found out that my minimal mA output of the arduino has to be 100 mA to light all the white leds, and even a minimum of 160 mA for the blue ones. How to get that done?
What is the output of the p2n222a transistor? I really don't understand the datasheets :s and for the BD139, I think the required input is higher than the arduino delivers... Or am I wrong?
dragonvlame:
What is the output of the p2n222a transistor?
You can use a p2n222a to sink up to 600mA. The transistor will give about 50 to 100 times current gain, so for 6 leds at 20mA each, i.e. 120mA, the base current coming from the Arduino would need to be around 1~3mA.
dragonvlame:
and for the BD139, I think the required input is higher than the arduino delivers... Or am I wrong?
The BD139 can go up to 1.5A (1,500mA) and is overkill for controlling your leds. What you read in the data sheet is the maximum base current (0.5A), not the minimum.
In your schematic, is it correct that the collector, nr 3 of the transistor, is connected to first the resistor and then to the ground/ - side of the LED?
dragonvlame:
In your schematic, is it correct that the collector, nr 3 of the transistor, is connected to first the resistor and then to the ground/ - side of the LED?
If you're asking if the order of led/resistor vs resistor/led is important, it's not.
The collect(3) is connected to all the bottoms of the resistors.
The top of a resistor is connected to the cathode of the LED.
The anode of the LED is connected to +5V
Well, the problem is that I already made the led string before wanting to control it...
That's also why I have the next issue: As seen in my first scheme, I have the resistors at the negative side of the LED. Because, normally, the grounds come together in one place, we've made the LEDstring so that all the ground, of all the groups (blue 1, 2 and white) are connected. Because the transistor works on the resistor side of the LED, I cannot control the seperate groups anymore (different wires on positive side, but same wire for the ground). Is there any way around it or can I not fix this :)?