I am working on some project for which I need to turn off a motor whenever it's dark. I looked around and found some light/dark sensing circuits. However, most of these circuits use an LED that switches on whenever is light or dark, depending upon application. I was wondering if someone could help me to modify the circuit(resistor values) to replace the LED with a motor, as shown in the figure below.

Light/Dark Sensing Circuit with Motor

It would be helpful if you can show the respective calculations :)


3 Answers 3


I need to turn off a motor whenever it's dark

The problem with your circuit is that it doesn't switch on or off the motor as a certain level of darkness/light is reached. Instead it gradually slows down the motor as the light fades and the reverse as the light increases.

Ideally you should use a comparator to produce a digital on/off output when the LDR reaches a certain resistance. This can be made programmable by using a potentiometer that sets a threshold voltage for the comparator.

After the comparator you'll use something like an N channel MOSFET to activate the motor. Something like this: -

enter image description here

The above is designed to switch on and off a motor pump when certain water temperature is reached - see the sensor LM335 - this can be replaced (pot and all) with an LDR. You don't need both channels of sensing so I'd just get rid of one of them and leave the pot intact to set the threshold.

This is the link to the page where the circuit diagram lives.


You don't want the motor to be gradually turned off and on over some range of light level. That would be bad for the motor, probably no good for whatever the motor is driving, and cause a lot of dissipation in the transistor switching the motor.

You need hyestersis, which provides "snap action". It will also make the turn off point a little darker than the turn on point. That keeps the system from jerking around the motor when the light is right at the threshold, which will have some inevitable noise on it.

Here is a circuit that should work:

In this example, I arbitrarily picked 20 kΩ for the LDR value at the darkness threshold you want the motor to switch on/off. Adjust R2 a bit to move the threshold.

Q2 and Q1 just amplify the lightness signal about the Q2 B-E threshold. Each of them inverts, so the output of Q1 will be the same polarity as the lightness signal on the base of Q2. R5 passes a little of this signal from output to input, which is how this circuit has hysteresis. The resulting 0-12 V digital signal is applied to the gate of Q3, which then switches the motor either solidly on or solidly off.

  • \$\begingroup\$ You do need to add a dropping resistor on the motor, since he specifies 7.2V @~170 mA. This will, of course, decrease startup torque, but there's not much that can be done about it at this level of complexity. \$\endgroup\$ Sep 22, 2015 at 16:25
  • \$\begingroup\$ @What: The spec I see says 7.2 to 12 V, so there should be no need to drop the voltage. \$\endgroup\$ Sep 22, 2015 at 17:35
  • \$\begingroup\$ @OlinLathrop: Is there an alternate to IRFML8244trpbf? I was looking at this IC's data sheet and noticed that it has leads designed for surface mount. Would I be able to use it on a bread board? \$\endgroup\$
    – Esan
    Sep 24, 2015 at 0:46
  • \$\begingroup\$ @Ehsa: You can always solder wires to the leads. But really, surface mount is how just about all parts come now, have have for the last 15 years at least. SMD parts take less space, give you a much wider range of options, AND are easier to solder. \$\endgroup\$ Sep 24, 2015 at 10:43

R2 is the former LED resitor an you don't need it anymore. The transitor is prety small for such power, so you might add a second one in darlington pair. The rest of the circuit can remain as it was.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.