# How to avoid LDR controlled light self-latching?

I am planning on using an LDR to turn on a LED light (700 lunes warm white fixtures), when the main light in the room gets turned on. But this LED light is pretty bright on its own. I think I will end up latching the circuit with the light. What's the best way to avoid this? My planned circuit, resistor values are only representative.

simulate this circuit – Schematic created using CircuitLab

The room has a 100w led residential bulb, semi reflective tiling. The lights I want to control have some unknown pwm (555 circuit to a constant current switching circuit from what I can tell).

• The only way to avoid it is to keep the LDR from seeing the LED. Also, you need to limit the gate voltage to the FET. Gate-source voltage is typically rated for 20 volts max, and you could easily drive it to 23 volts, which could destroy it. – WhatRoughBeast Dec 27 '16 at 21:40
• Is it a colored led? You could get a ldr that is less sensitive to the specific color. – MadHatter Dec 27 '16 at 21:42
• These are warm white fixtures. 700 lumins combined output. – Passerby Dec 27 '16 at 21:49
• Too bad it's a phosphor-based system with likely 100's of milliseconds of light retention. An idea using PWM and only taking measurements when the LED light is OFF probably won't work. – jonk Dec 27 '16 at 21:55
• Can you use baffles to solve it "mechanically"? A physical opaque partition between LED and LDR. – vicatcu Dec 27 '16 at 21:59

Instead of the LDR, you could use an infrared-sensitive phototransistor. The IR phototransistor will detect incandescent light, but not (most) LEDs. Fluorescent lights and household LED lights also don't put out much IR, so this won't work if you have these.

I do suggest that you add some positive feedback (hysteresis) in your circuit. As it is, the FET will find itself sometimes biased in the linear region and not operating as a low-loss ON/OFF switch. Instead, it will heat up and possibly burst into flames (depending on the load and the power source).

• The hysteresis is a good point. I addressed doing this with one more BJT here: electronics.stackexchange.com/questions/268891/… A spectrophotometer would help identify null-bands in the LED output to make your suggestion work well. Might need a thin-film filter, though. – jonk Dec 27 '16 at 22:00
• Paul, you might be more specific about the IR phototransistor - encapsulated in clear plastic is not wanted, while encapsulation in the black-dyed plastic is the proper type to get - they are insensititve to visible light. – glen_geek Dec 27 '16 at 22:00
• The regular bulb I have is a 100w equivalent led, unfortunately. – Passerby Dec 27 '16 at 22:02

The problem is that your turn on point is a bit sloppy and not controllable use a circuit like below which gives you more control and put the ldr in a tube pointing at your main room light fitting as suggested above. If you swap the + and - inputs to the op amp it can drive your mosfet directly.

• Apologies to Olin for pinching his circuit. – RoyC Dec 27 '16 at 22:50

You could always just detect when the room light switch is flipped. I know you already know how to do that much. The light switch, if in the US and semi-modern, will have access to earth ground as well as hot, switched hot (which is connected to neutral through the room light load), and likely neutral too. (Because of the new-fangled devices which may need regular access to hot, neutral, and ground for other reasons.) You could tap in at the ceiling and even be crazy enough to use these cheap $3 Wifi units to act as a web server providing status of your room light. Your auxillary LED light could then just go to that page and monitor the status, using another of the$3 Wifi units. They each need access to +3.3 VDC, though. So it's a bit Rube Goldberg. But robust, at least.

If I really wanted to use an LDR for this, I'd arrange the detector so that it is down deep into a metal tube that points at the room light. I might even bother with a lens or two (I've got boxes of them in nice slip covers.) You can get anodized aluminum optical tubes cheap enough, too. But a black pen barrel might do okay. I have a couple of 3D printers, so I'd probably just whip something up on that. Regardless, I definitely would NOT expose the LDR to the entire room lighting. I'd want to, instead, aim it as accurately as I can at the actual light for the room. A lens and baffling can help, but that may be more trouble than it is worth.

I'd then test the result to see what I get for resistance values with the light ON and OFF and with the tube positioned variously, to account for common miss-alignments that I'd like to tolerate. I'd then design a simple circuit to support an appropriate level of hysteresis based on those values. The following circuit will have two thresholds at about $300\:\textrm{k}\Omega$ and $650\:\textrm{k}\Omega$, roughly. Which should be good for a typical LDR.

simulate this circuit – Schematic created using CircuitLab

$R_3$ and $R_4$ are set for the output impedance. I think $47\:\textrm{k}\Omega$ is fine for a MOSFET gate drive. Increasing $R_1$ and $R_2$ will lower the high threshold, reducing the hysteresis. Decreasing them will raise the high threshold. Reducing $R_5$ will pull down both thresholds, but the high threshold moves down faster than the low threshold, so reducing it also tights the band, too. That's about it, really.

But you really need to take measurements, first. And that means designing the optics arrangement, too. But a simple, long tube should be fine I think. Pointing that correctly should give you excellent discrimination so that the electronic circuit can do its job, as well.

That's what I'd try, to start.