# Circuit to control LED Brightness vs Ambient Light

Discussion in 'Electronic Design' started by Carey Fisher - NCS, Jan 31, 2004.

1. ### Carey Fisher - NCSGuest

on the ambient light falling on a control panel where the LEDs are mounted?
This is for an automotive application and I want the LEDs on the front panel
to dim in darkness... I'm sure you get the point. I don't know the exact
values I need for the dimmed LED current or the exact values of the ambient
light - I just need a circuit topology for a starting point.

I'm thinking a CdS photocell as part of a voltage divider driving a MOSFET
(2N7000) or BJT which sets the output voltage of an LM317 (or similar)
voltage regulator by controlling the LM317's Iadj.. Then resistors from the
LM317 to the LEDs.

Am I on the right track?

Thanks,

2. ### John PopelishGuest

LED light output is very close to proportional to the current through
it. The current through a photo diode that is reverse biased is very
close ot proportional to the illumination. A circuit that multiplies
the current of the photo diode by a constant multiple and drives the
LED with that current will keep the light out of the LED proportional
to the light level. Add a small current to this to keep the LED from
going completely out in total darkness.

A current mirror with gain might be the simplest approximation of
this.

Something like:

+12 +12
| |
- pd V LEDs
^ -
| |
+--+ |
| | |
\| | |/
|-+-----|
e/| |\e
| |
R1 R2
| |
0v 0v

This is the basic current mirror. You adjust the current gain by the
ratio of R1 and R2. The actual ration depends on the size of the
photo diode you use.

Put a third resistor in series with the photo diode to limit the
maximum current and one from the collector of the right resistor to
zero volts to provide the minimum brightness in darkness.

You can use several LEDs in series as long as a couple volts remain
across the right transistor. Parallel more of the right half of the
circuit to the common base line for more LEDs.

3. ### Carey FisherGuest

John, Wow! That looks pretty simple yet clever - I'm gonna try it.
Thanks!!!

4. ### DJGuest

Or get really cunning and pulse the LED, using it as a photodiode during the off
time. I estimate you could do it with only 10 times more circuitry than a
current mirror . Hmmm ... as an ASIC solution that could work.

5. ### DJGuest

The idea is elegant in principle. In practice I imagine the photodiode will have
way too little current. You'll need a gain of hundreds, or thousand. A photo
transistor might work better that a diode. And/of the mirror transistors may
need to be darlingtons (which is no sweat if you have a reasonably large supply
voltage).

6. ### John PopelishGuest

If you use a photo diode made for fiber optics, I agree but if you use
a larger area diode the photo current can be quite a bit higher,
especially in full daylight.

Digikey sells this one with a 3 by 3 mm area ( .1 ma at 100 foot
candles) for a buck:
http://rocky.digikey.com/WebLib/Photonic Detectors/Web Data/pdbc158.pdf

and this one with a 29 square mm area (.4 ma at 100 foot candles) for
\$4:
http://www.photonicdetectors.com/pdf/pdbc140.pdf

I think these are getting close to working well with the above
circuit, though I would use a high gain transistor for the right side.

7. ### Fred BloggsGuest

You could use series feedback to buffer it like so:

Please view in a fixed-width font such as
Courier.

Vcc
|
+------------+-----------+
| | |
| / |
| 10K |
| / |
| --- \ e
I | / \ | |/
r | --- +---------| pnp
| | | |\
V | | c
| | |
| | ---
| | \ / ~~
+-----+ | ---
| | | |
c | c ---
\| | |/ \ / ~~
npn |---+----| npn ---
/| |\ |
e e ---
| | \ / ~~
| | ---
| | |
| | ---
| | \ / ~~
| | ---
/ | |
GxR +-----------+
/ |
\ / <------
| R Gx I
| / r
| \
| |
+------------+
|
---

8. ### Fred BloggsGuest

Incorporating your MAX/MIN LED current limits can be done like so:

Please view in a fixed-width font such as Courier.

Vcc
|
+------------+-----------+-------+
| | | |
| / | |
| 10K | |
| / | |
| --- \ e |
I | / \ | |/ /
r | --- +---------| pnp RL
| | | |\ /
V | | c \
| | | |
+-----+ | +-------+
| | | |
c | c ---
\| | |/ \ / ~~
npn |---+----| npn ---
/| |\ | Select R so that:
e e ---
| | \ / ~~ Vcc-nVLED
| +----+ --- R = ---------
| | | | ILED,max
/ / | ---
GxR R | \ / ~~ Vcc-nVLED
/ / | --- Then RL= --------- - R
\ \ | | ILED,min
| | +------+
+------------+
| <------
--- Gx I
r

Very nice.

10. ### DJGuest

Oops, I forgot you could get large area photodiodes. I used one myself once in
an important design, but it was obviously far too long ago!

dj

11. ### Fred BloggsGuest

Fred Bloggs wrote:
[..snip...]

One last revision for flexibility- force Q2 into saturation and kill the
gain at ILED,max:

Please view in a fixed-width font such as Courier.

Vcc
|
+------------+-----------+-------+
| | | |
| / | |
| 100K | |
| / | |
| --- \ e |
I | / \ | |/ Q3 /
r | --- +---------| pnp RL
| | | |\ /
V | / c \
| Rc | |
+-----+ / +-------+
| | \ |
| | | |
c Q1 | c ---
\| | |/ Q2 \ / ~~
npn |---+----| npn ---
/| |\ | Select R so that:
e e ---
| | \ / ~~ Vcc-nVLED
| +----+ --- R = ---------
| | | | ILED,max
/ / | ---
GxR R | \ / ~~ Vcc-nVLED
/ / | --- Then RL= --------- - R
\ \ | | ILED,min
| | +------+
+------------+
| <------ Vcc-1.5-ILED,max x R
--- Gx I Rc= --------------------
r ILED,max/beta,Q3,min

12. ### Robert C MonsenGuest

+--------------+--------- VCC
| .-.
| | |
| | | R3
| '-'
| |
| .-----.
| /\ | LEDs|
--- / '-----'
/ \ +----------+
--- | |
| | |
| b |/ c |
+------------| |
| |> e |
| | |
| | |
| | |
.-. .-. .-.
| |R2 | |R1 | |R4
| | | | | |
'-' '-' '-'
| | |
| | |
| | |
+--------------+----------+
|
===
GND
created by Andy´s ASCII-Circuit v1.24.140803 Beta www.tech-chat.de

Assume LEDs total forward voltage is Vf. Also, the photodiode is probably
something near 0 in the dark, and 400uA in full light. Pick R2 so that Vb is
1.7 at 400uA. Notice that Imax/ß is being drawn by the base at full, so take
that into account (note that also limits the maximum LED current with this
configuration.) So, for 400uA, if Imax is 10mA, we have 300uA left, so

Use a 10k pot, and trim it to 1.7 with full exposure if you aren't sure.

If you want it to go from Imin to Imax, then choose R1 so that its at 1V
when the current is Imax - Imin. For 1mA to 10mA, thats around 100. Then,
pick R3 so that it limits the current to Imax by saturating the transistor
at that current:

R3 = (Vcc - Vf)/Imax - R1.

If we choose Vcc to be 12, and Vf to be 5.1V (ie, 3 LEDs at 1.7 each) then
we have R3 = 590, say 560.

R4 is put there to allow a minimum current through when the transistor is
off. Thus,

R4 = (Vcc - Vf)/Imin - R3

for our values, its 6.3k, say 6.8k.

Regards,
Bob Monsen

13. ### Fred BloggsGuest

That works well enough- I don't what the current mirror buys except
linearity.

14. ### Ian BucknerGuest

I wondered about that - it would fix one problem, which is light
leakage
from the LEDs into the photodiode.

Regards
Ian