# How to switch LEDs without using relays

I thought of making a 12 LED light with input power of 48v and 20 mA. Is there any circuit using only transistors to act as a switch running on the above inputs. I intend to use the above circuit with LDR which should activate the above 12 LEDs when it is dark.

Kindly help with the circuit diagram. I am already using the above circuit with a switch and now, out of curiosity, I intend to use it in my bedroom for lighting purpose.

• Just to be clear, it sounds like you're suggesting an analog control for the lamp, so that it fades on and off as the room brightens or darkens. Is that what you're going for? – Stephen Collings Oct 8 '12 at 18:00

It can easily be done with just a transistor, like this:

If your LEDs are common indicator LEDs (which the 20 mA suggests) they may drop for instance 2 V. Then 12 of them in series is 24 V, the remaining 24 V will be across the series resistor R. For 20 mA R can be calculated as

$R = \dfrac{V_+ - V_{LEDs}}{20 mA} = \dfrac{48 V - 24 V}{20 mA} = 1.2 k\Omega$

A simple solution like this has the disadvantage that it's not efficient because the supply voltage doesn't match the required 24 V. You'll lose half of the total 1 W, i.e. 500 mW in the series resistor, so take a 1 W type for that.
Also make sure your transistor has a high enough $V_{CE}$ specified. The BC546B can have 65 V, so that's OK, and it also has an $h_{FE}$ of minimum 200, so you won't need too much base current.

If you're vexed by the low 50 % efficiency then there's a solution for this, but you'll need more than a transistor. A switching LED driver can very efficiently take care of the 24 V difference between power supply and LED voltage.

The LED driver doesn't require many external parts, but it isn't cheap. This one is the cheapest I found at Digikey and it's 2.50 dollar in 1s. But it has a great efficiency of up to 95 %, which means you lose only 25 mW instead of 500 mW.

To add to Stevens answer and give a basic circuit, here is one using LEDs with a Vf of ~2V, based around an N-channel MOSFET:

This is based on a typical LDR resistance range of 12kΩ (light) to 200kΩ (dark). If your LDR covers a different range you will have to alter the resistance values. You may want to add a cap (e.g. >1uF) between gate and ground to filter any noise present and ensure LEDs don't flicker.

R4 and R5 form a voltage divider to bring the 48V down to a bit less than 9.6V (as R4 is in parallel with R2 + R3) at the top of R2. Most MOSFETs don't like too high a voltage on their gate (MOSFET shown actually has 20V Vgs max), so keeping it under 10V is a good idea. Also make sure the MOSFET you use is rated for above 48V drain to source breakdown voltage (this one is rated at 75V). One more thing, given the highish voltage, you must be careful to ensure none of the components dissipate more power than they should.
Then R2 and the LDR form a divider to control the gate voltage. The gate threshold (turn on) voltage of this the IRFP2907 is between 2V(min) and 4V(max), so we want the gate voltage to pass through 4V about halfway through the LDR range.

So a rough calculation, assuming ~9V at the top of R2, and 100kΩ for LDR halfway:

(100kΩ / (4.5V / 9V)) - 100kΩ = 100kΩ needed for R2
To check -> 9V * (100k / (100k + 100k) = 4.5V

Using these values, here is a simulation of the LED current over the LDR resistance range:

The LEDs switch on when the LDR reaches around 90kΩ, which is close enough. You could use a pot for R2 if you want to have the ability to adjust at what light level the LEDs turn on.

• The misery with FETs is that their parameters, mainly Vgs vary so widely. For this one it's only 2:1, but I've seen 3:1 too. I think you should add the calculation for the 2 V FET as well. This is not like a worst case digital input, where you supply 5 V, which is OK for either limit value, this is an analog circuit. – stevenvh Oct 10 '12 at 20:10
• @Steven - yes, I agree, although the voltage does range over ~5V and it's not so analog (unless you want a gradual dimming in which case adding an opamp would be a better idea) The main reason I picked the FET was that if the only supply voltage is 48V it makes it a bit awkward and more power hungry with a BJT (trying to keep it as simple as possible) I'll add some more shortly though, probably add the BJT version too. – Oli Glaser Oct 10 '12 at 21:51