# LED Dimmer only using NPN BJT and potentiometer

Does this circuit looks ok? I'm trying to make a RGB lamp with knob controls. The LED has a maximum current of 20mA. I've successfully created a working prototype of below circuit.

I'm not from electronics background (hence for me priority wise simplicity of circuit > its efficiency). I tried creating PWM using 555 but was not getting the desired result.

Combining all the answers and suggestions, does the below circuit make sense?

simulate this circuit – Schematic created using CircuitLab

• Try this version: put R1+LED into the emiter side and collector to Vcc.
– G36
Jun 24 '18 at 15:06
• It depends on your sensitivity expectations, if not ok , say why Jun 24 '18 at 15:06
• @nirmeets: Note that when you use the CircuitLab button on the editor toolbar that you don't need an account and that editable and copyable schematics are saved inline with your post. No need for screengrabs with the grid behind them. Jun 24 '18 at 15:36
• @Transistor: noted but these circuits were created earlier while I was implementing them Jun 24 '18 at 15:38
• I am curious as to why the PWM approach did not work. Jun 24 '18 at 16:43

## 4 Answers

Why bother with the BJT at all? With a maximum current of 20 mA, and assuming a minimum voltage drop across the LED of 1.8V, the power dissipated by the potentiometer can't possibly be more than:

$$20\:\mathrm{mA} \cdot (5 - 1.8)\:\mathrm V = 0.064\:\mathrm W$$

This is well within the capabilities of all but the most tiny potentiometers. Check the datasheet to be sure, but anything big enough for a knob should be able to handle much more than this.

simulate this circuit – Schematic created using CircuitLab

The combination of R2 and R3 serve to approximate an exponential taper pot, since our perception of brightness is logarithmic. Otherwise you end up with a control that appears near full brightness over most of the range of R2. You may need to experiment with different values of R3 to get the best response, especially in an RGB module where each color has a different forward voltage.

R1 exists just to put a minimum resistance in series with D1 so the current can't get too high when R2 is turned all the way to minimum resistance. Many pots don't go all the way to zero, so you may need to make R1 smaller to get full brightness.

• Omitting BJT make sense but initially I planned using it with Raspberry pi 3. I just wonder if my potentiometer be able to support current for 3 leds Jun 24 '18 at 17:37
• @nirmeets I added to address the concern of overloading the pot. You'd have to explain how you intend to use this with a Raspberry Pi to address that concern. Jun 24 '18 at 18:48
• Thanks mate for the edit. Since I'm developing some other project using the pi, I don't want to use pi anymore for this project. Jun 24 '18 at 18:54

It won't be very stable- the color and brightness will change as the transistor warms up.

Here is a bit better circuit that is about as simple (uses a single quad op-amp LM324):

simulate this circuit – Schematic created using CircuitLab

The voltage at the top end of the pots is about 450mV, so the maximum LED current is 0.45/18 = 25mA. Adjust R4 to suit your requirements. The 130 ohms is added since this circuit can supply enough current to burn out the LED and/or transistor. That could happen if the bottom end of R2 became disconnected, for example. It's sort-of optional, but probably worth putting in. If the LED brightness flattens at the high setting you may have to reduce it.

You could also simplify it by combining all 3 R1's into a single 33K resistor (so 1 fewer part than your circuit).

R1 and R2 provide a voltage to the non-inverting op-amp input of 0 to 450mV, depending on pot setting. The op-amp drives the transistor to draw current through the LED to reproduce that voltage across R4, so the current through the LED can be set from close to zero to about 25mA with the values shown.

• I’ll give it a try Jun 24 '18 at 15:37

Cripes. I may as well add another shot for you to try out. It's closer to what you already have. But combined with the other approaches handed to you here, it offers you some options to try out.

This one is based on solving two simultaneous equations I won't bother writing down here (but see below.) And it may also not do badly in spite of the fact that a warming BJT has a varying $V_\text{BE}$ (I took some of that into account.)

simulate this circuit – Schematic created using CircuitLab

$R_4$ sets the maximum current to perhaps slightly more than about $20\:\text{mA}$. I'm using the same $10\:\text{k}\Omega$ value for your potentiometer as $R_1$. The other two resistors are used to help make the circuit go from a very low current in the LED (near, but never exactly, zero) and then up to that maximum just mentioned above.

The main reason I offer this one is that it uses just the one BJT you already are using, uses the same potentiometer you are already using, and I'm guessing you can find those resistor values.

Should be easy to test out with all three LED types you mentioned.

Just another addition to many. If you find that an LED is still "visible" with the potentiometer turned all the way off, then lower the value of $R_3$ to the next lower standard value.

For those interested in the equations, they are:

\begin{align*} V_\text{CC}\cdot\frac{R_3}{R_1+R_2+R_3}&=V_{\text{BE}_\text{OFF}}+R_4\cdot I_\text{OFF}\label{a}\tag{OFF}\\\\ V_\text{CC}\cdot\frac{R_1+R_3}{R_1+R_2+R_3}&=V_{\text{BE}_\text{ON}}+R_4\cdot I_\text{MAX}\label{b}\tag{ON} \end{align*}

Setting $V_{\text{BE}_\text{OFF}}=400\:\text{mV}$, $V_{\text{BE}_\text{ON}}=750\:\text{mV}$, $I_\text{OFF}=0\:\text{mA}$, and $I_\text{MAX}=20\:\text{mA}$, and then solving for $R_2$ and $R_3$ I got: $R_2\approx 15.7\:\text{k}\Omega$ and $R_3\approx 2.2\:\text{k}\Omega$. It was easy to then set $R_2= 15\:\text{k}\Omega$ and to decide to set $R_3$ to the next lower value of $R_3=1.8\:\text{k}\Omega$.

All these circuits are highly inefficient and will give low life to batteries and LEDs. Rather use a PWM scheme that drives them at constant voltage and current but variable duty cycle (from 0 to nearly 100%). There are many circuits on the net for that, one can be based on the 555 timer. One, I don’t take credit for it, you can find here http://rookieelectronics.com/555-timer-projects-led-dimmer

• How does just pulsing the LED make it more efficient? Jun 25 '18 at 13:07