Step by step design of a simple LDR circuit.

This circuit was prompted by the following thread

http://forum.allaboutcircuits.com/showthread.php?t=88409

in which the OP wanted to know how to choose the resistor values by design instead of by happening (i.e., trial and error).

I figured it might be useful as a general example, and so put up this blog post instead of just posting within the thread.

Let's start with the following circuit as our topology and pick reasonable Rb and Rc values.

1574647303367.png


2N3904 Datasheet

The first thing to note is that if the goal is that the LED turns on/off about when the the LDR is at 80kΩ that we can't just design the circuit to place the transistor in hard saturation at this point, because the LED might turn on well before this point (i.e., at significantly lower LDR resistance). So, instead, we will assume that the transistor will remain in the active region but pick a minimum value for β, noting that if the transistor does saturate at some point due to the actual β being higher, that will be fine.

When the transistor is in saturation, we will assume a Vce of essentially 0V, meaning that Rc will have about 3V across it. For 10mA, that means a value of Rc equal to 300Ω. Since there will be some voltage across the transistor, we will use a 270Ω resistor instead on the basis that it's probably better to have a little more current in this case than be current-starved (but is probably not too critical one way or the other).

Second, we will design the circuit around the notion of having it be midway between on and off at the target resistance. Thus, we will shoot for an LED current of 5mA when the LDR resistance is 80kΩ.

We will assume that β=100, so we need a base current of 50μA. The Vbe voltage will be somewhere close to 0.7V, so we will work with that value.

At 0.7V, the current in the LDR, namely Id, will be 8.75μA. The voltage across Rb will be 4.3V and we need a current in it of 58.75μA, resulting in a nominal value of 73kΩ. We could use a standard E24 value of 75kΩ or go with one of the surrounding E12 values of either 68kΩ or 82kΩ. Since the LED will probably be visibly "on" well before even 5mA of current, it is probably reasonable to go with the 82kΩ value, so let's use that.

Thus

Rb = 82kΩ
Rc = 270Ω

Now let's examine the box we have painted ourselves into. Let's first assume that the actual transistor has β=300. At what LDR value does the LED current rise above 10% of the 10mA target? Well, that boils down to finding when the base current reaches 3.3μA. With Rb=82kΩ, we will have a pretty much constant current in it of about 52μA, so we need to shunt basically all of it through the LDR, which would require it to be below about 0.7V/50μA=14kΩ.

Thus we can see that we might have a pretty soft turn-on point, which may be good enough. But it might make it very adisable to use a potentiometer in place of (or in conjunction with) Rb. A reasonable choice might be a 68kΩ fixed resistor in series with a 50kΩ pot.

The basic cause for the soft, poorly-defined turn-on point is that the needed base current is considerably more than the LDR current at the desired turn-on point. We either need the LDR current to change much more quickly, so that we can change the base current more rapidly as we near this point, or to reduce the base current considerably to get it down comparable to, if not below, the LDR current at the turn-on point.

An easy way to do this is with two transistors configured at a Darlington pair as shown in the following figure (there are other options, of course).

1574647311309.png


If β=100, then the base current required for the full 10mA of LED current is only 1μA. Since the voltage across the LDR when the LED is on will now be about two base-emitter drops, it will be about 1.4V. The voltage across Rb will then be about 3.6V but we only need a current in it of the LDR current, which is 1.4V/80kΩ=17.5μA plus the 1μA base current, or 18.5μA. The needed resistor value would then be 195kΩ. Since the actual base current will probably be less, the choice of Rc=200kΩ or even 220kΩ would probably be good.

By making Ib close to negligible, we accomplish a couple of things. First, our choice for Rb can be reduced a very simple relationship. At the turn-on point we need the voltage divider formed by Rb and Rd to yield the nominal base-emitter voltage of the Darlington pair, thus:

\(
V_{CC} \cdot \frac{R_d}{R_d+R_b} \ = \ 2 \cdot V_{be}
Rb \ = \ R_d \, \left( \, \frac{V_{CC}}{2V_{be}} \, - \, 1 \, \right)
\)

So for a turn-on at 80kΩ, we need Rb to be 206kΩ. Since we know that there will be some base current, a choice of 200kΩ is probably good.

But, furthermore, we get a very crisp turnon very close to the desired target value of the LDR. The uncertainly is due primarily to the uncertainty in the actual value of the Vbe compared to Vcc. Let's consider Vbe=0.6V and 0.8V with Rb=200kΩ. This is a very generous allowance and even so the Rd at which the LED turns on would be between 63kΩ and 95kΩ.

One final thing we need to do is revisit Rc, since we need to support a minimum voltage at Vc to keep Q2 working. This voltage, in hard saturation, could get down as low as about 0.8V, so let's use 1V for our calculations. This puts 2V across Rc so we would need a 200Ω resistor. We would probably find that either 180Ω or 220Ω would work fine.

Blog entry information

Author
WBahn
Views
5,494
Last update

More entries in General

More entries from WBahn

Share this entry

Top