﻿ How to Build a Dark-activated Motor Circuit

# How to Build a Dark-activated Motor Circuit

In this project, we will go over how to build a dark-activated motor circuit.

This is a circuit in which a motor will turn on and spin when it is dark in the ambient environment.

As soon as there ambient darkness is sensed by the circuit, the motor will automatically turn on and remain on as long as the darkness remains.

The component that allows for the light sensing in this circuit is a photoresistor. The photoresistor detects light levels and its resistance changes based on the amount of light it picks up. We can exploit this varying resistance that the photoresistor gives off to know whether there is darkness in the surroundings or whether it is bright.

We will use the LM741 chip in this circuit as a comparator to make decisions. It was just explained how a photoresistor changes its resistance drastically based on the ambient lighting in an environment. Exposed to darkness, a photoresistor has a tremendous amount of resistance. Depending on the specific photoresistor in use, its resistance can be anywhere from over 100KΩ to well over 2MΩ. When exposed to bright light, a photoresistor's resistance drops drastically. Again, based on the photoresistor, it may be to 5KΩ or below or to about 30KΩ. For any photoresistor, you can pretty much be sure that the resistance will fall to about 30KΩ when exposed to bright light. This is an important principle to know because we will create a voltage divider of a photoresistor and a fixed resistor, in which the voltage divided up between the 2 components will change due to ambient lighting. In darkness, the photoresistor will have a very high resistance. If you know ohm's law, more voltage is allocated to components with a higher resistance value (V= IR). Therefore, when this voltage divider is connected to a comparator, the voltage divider will produce a very high voltage. When the photoresistor is exposed to bright light, will have a low resistance. Therefore, less voltage will fall across it. So when it is hooked up to a comparator, the voltage divider circuit will produce a voltage less than the reference voltage. This will make more sense when you see the actual circuit.

So now you see how we can get varying voltage levels due to the varying resistance that a photoresistor gives off, based on the lighting in a room.

So how does the circuit actually make decisions due to the varying voltage levels?

And the answer is through a comparator.

A comparator is a electronic chip that can compare voltages between 2 inputs and whose output varies depending on which input has a greater voltage.

Look at the LM741 chip which we will use below:

The LM741 basically has 2 inputs, input A, the inverting terminal (marked with a negative), and input B, the noninverting terminal (marked with the +).

If the voltage present on input A (the inverting terminal) is greater than the voltage present on input B (the noninverting terminal), then the output will be whatever is present on the V+ terminal of the LM741. This will be a positive voltage.

If the voltage present on input B (the noninverting terminal) is greater than the voltage present on input A (the inverting terminal), then the output will be whatever voltage is present on the V- terminal of the LM741. The V- is usually tied to ground or to a negative voltage.

So assuming that the V+ terminal of the LM741 has a positive voltage (say 5V) and the V- terminal is tied to ground, when the photoresistor is exposed to darkness, a very large voltage from the power supply gets allocated to it to the photoresistor. Thus, the voltage on the inverting terminal is much larger than on the noninverting terminal. Thus, the output will be pulled up to the voltage on V+. And, therefore, the load, which in this case is a DC motor, connected to the output terminal of the LM741, will be powered on.

If the photoresistor is exposed to bright light, its resistance drops signifcantly and so does its voltage. Thus, input B will have a greater voltage than input A, and the output of the LM741 will be drawn low, to ground. Thus, the motor will not turn on.

And this is the basis of our circuit.

In order to know how to build this circuit, you must know the pinout of an LM741, in order to connect the pins properly. Below is the pinout of the LM741 op amp chip.

If you would like to understand all the pin connections of the LM741 op amp, see LM741 Op Amp- Pinout Connections. This article explains all of the 8 pins of the LM741 and what each one does.

For this circuit, though, we will only be connecting to 5 of the pins of the LM741.

As most ICs need, we must power the chip. Therefore, we must connect positive voltage to the V+ terminal of the LM741 and connect either negative voltage to the V- terminal or connect it to ground. The supply voltage for the LM741 for the power voltage terminals can be as high as ± 22V. This means we can feed a voltage as high as +22V into V+ and as low as -22V to V-.

Besides for power, the 2 inputs that we will use to compare voltages are the inverting terminal and the noninverting terminal. These 2 terminals serve as inputs so that we can compare the voltages to determine which is higher.

The last pin we will use of the LM741 is the output pin. Here is where we connect the load that we want to power, in this case, it is a DC motor. When the voltage on the inverting terminal is greater than on the noninverting terminal, the output is high and the load will be powered on, if the supply voltage is sufficient to power on. If the voltage on the noninverting terminal is greater than in the inverting terminal, the output is low and will be at the voltage level as V-.

### Components Needed

• Photoresistor
• 33KΩ Resistor
• 20KΩ Resistor
• 10KΩ Resistor
• 1N4001 diode
• LM741 op amp
• DC Motor
• 2N3904 NPN Transistor
• 3 AA batteries or DC Power Supply

A lot of these components can be varied somewhat. If your photoresistor's light resistance is about 20-30KΩ, then you definitely must use a resistance greater than 30kΩ. You must use a fixed resistor greater than the light resistance of the photoresistor to form the voltage divider. The resistor doesn't have to be 33KΩ. You can use a larger valued resistor, such as 40KΩ. It isn't precise.

The same is true also for the potentiometer. It isn't the value of the resistance of the potentiometer which is important, but the voltage that is produced, when the potentiometer is calibrated to the right voltage. We want the voltage of the potentiometer to be greater than the voltage that the voltage divider produces when exposed to bright light but less than the voltage that the voltage divider produces when exposed to darkness.

### Dark-activated Motor Circuit Schematic

Below is the full schematic diagram of the circuit which we are building.

As you can see, the op amp is powered by 3.5 volts. The V+ terminal is connected to 3.5V and the V- terminal is connected to ground. The 2 inputs are the inverting and noninverting terminals. The voltage divider is connected to the inverting terminal. This voltage will change depending on the ambient lighting. We adjust the potentiometer connected to the noninverting terminal to the point where the DC motor is off during bright light exposure and on during darkness exposure. This is the calibration that is required.

We connect a transistor to the output of the LM741 to provide current amplification, so that there is enough current to turn on and drive a DC motor. A DC motor requires quite a substantial amount of current in order to operate, much more than an LED. In fact, a typical LED requires about 15-20mA in order to run. A DC motor, on the other hand, requires about 75mA, more than 3 times the amount of current. The LM741 doesn't give off this amount of current, so in order to get more current, we must add a transistor. We place the DC motor on the collector terminal of the transistor and connect the emitter to ground. Doing this allows us to drive the DC motor on the output of the LM741.

A diode is placed in parallel, in reverse, to the DC motor. Motors and relays can produce a very high back EMF voltage when they are turned off due to energy they store in the coils. This excess voltage can damage the switching transistor. The diode shorts this back EMF out so that the transistor and other electronic components in the circuit don't get damaged.

And this is how a dark-activated motor circuit can work.

This is a useful circuit when you ever want to spin something when it is dark. An example may be a fan that you want on as soon as the lights go off. Basically any type of device that spins (that runs on a motor) can be activated by darkness in this way.

To see how this dark-activated motor circuit operates in real life, see the video below.

Related Resources