I have this circuit which purpose is to control the brightness of an LED through serial. (see the attachment for schematic)
So here is the calculations.
The TIP120 has a DC current gain of 1000, and the LED needs 350 mA at full power.
That gives 350mA/1000 = 0.35 mA at the base, am I correct?
The TIP120 has a forward voltage of 2.5V as far as I can see from the datasheet, so if I want 0.35 mA at the base, I have to use a 7K resistor. Arduino output 5V - forward voltage = 2.5V
(2.5V/0,00035A)=7142 ohm.
Are the calculations correct?
So I tried to test circuit, and it didn't worked properly. If I send 0 at the serial port, the LED would become a little bit dimmer, barely visible, and if I send 255 at the serial port, the LED would become a little bit brighter.
No, you do not use the gain - that is the parameter of interest when
using the device as a signal amplifier. As a switch you want enough
base current to saturate the device. A 1k resistor might be about right.
BUT more importantly your circuit cannot work, its not a switching
configuration at all.
You need a common-emitter configuration, NOT emitter-follower. With
an NPN device that means the switching is done on the low side of the
load.
HOWEVER you are switching the whole DC-DC converter at PWM
speeds which is a very bad idea, since it has significant capacitance
built in.
You need to switch the LOAD, not the power supply for the load.
So, assuming the DC-DC converter has constant current output (ie designed
for LEDs), move the transistor to the output of the converter, emitter to ground,
collector to load.
[ What is the part number / datasheet for the DC-DC converter? ]
MarkT:
So, assuming the DC-DC converter has constant current output (ie designed for LEDs), move the transistor to the output of the converter, emitter to ground, collector to load.
And of course, if it is a constant-current driver, that is not going to work either!
So the gain parameter is only interesting if I am using it as an amplifier am I right? And why do I need a resistor, and should it not be as small as possible, like 220 ohm, then I would waste less power?
Boye:
And why do I need a resistor, and should it not be as small as possible, like 220 ohm, then I would waste less power?
The resistor controls how much current goes into the gate and out the emitter. The useful work is the current going through the collector and out the emitter, so you want to use as large a resistor on the gate as you can to eliminate the wasteful current coming in the gate -- but not too large that you don't turn the transistor fully on.
Regarding using that DC/DC converter I'd suggest trying to get a wire onto pin 5 of the LM2596 (the rightmost pin) and use that as a "DIM" pin. You need to grab your soldering iron and lift that leg off the board then solder a wire onto it. Digital low (or floating) turns the output on and digital high (>2V) turns it off. But beware that it doesn't have a sharp on/off time; there's enough granularity for dimming but it has a noticeably slow off time (1/4 sec?). But that might be the 470R resistor and 5mm LED I'm using on the output that slows it down.
But all in all this is a bad way to be doing things. You have to get that output voltage just right to avoid burning out the LED. But, you got me curious if it could be done so take it as you will.
You have to get that output voltage just right to avoid burning out the LED.
And that voltage will have to change depending on the temperature of the LED, the ambient temperature, and the age of the LED. In short it is best to set the voltage dependent on the measured current, which is what a constant current supply does all by its self.
So if this is a bad way to control the led, how should I do it?
The end project is going to be 4 12v led panels hooked up to a car battery and controlled with an Arduino through IR.
You can connect several LEDs in series up to a total forward volt drop of about 2V lower than your supply.
For each series chain like this you need a constant current supply.
One way to make a constant current supply is shown in the attached circuit. But there are many other ways to make them.
That panel absolutely does consist of multiple LEDs. You can see when running on low voltage, when the lights just start to come on, you'll see that there are like 16 or 24 LEDs in there - something like that. They're well under 1W per LED, unlike the common LED panels (the square ones that go up to 150W+ ), which have 1 LED per spec'ed watt, and that's why you see the improved efficiency and higher price (those are an unusually good price for COB panels like that) - LED efficiency falls off as a function of the current per unit area due to carrier recombination at high current.
Also why COB LEDs are so expensive - more dies per watt
Om sorry for the incorrect data.
The test was done with a 350mA led, which the original question was about, but the end result should be, so I can control 4 of 10w led panels in pairs of two with PWM.