Arduino Projects    |   Raspberry Pi  |     Electronic Circuits   |   Electronics Reference Design Library  |   AVR    |    PIC    |    8051    |    Electronic Projects

Automatic light/dark indicator


Himanshu Choudhary


Automatic light/dark activated systems have very common utilities in day to day life. For example, street lighting at night, morning alarm, automatic emergency light, dark activated buzzers and so on. The project explained here can be used in several such systems. This circuit has a sensor component which works in response to the ambient light condition. The output of this sensor is compared with a set reference value and whenever the light condition changes from dark to light or light to dark, the output goes high.


In this project, the surrounding illumination is observed by a light dependent resistor (LDR) which acts as a sensor for the circuit. The voltage drop across this LDR corresponds to a particular intensity of light. This value can be taken at the inverting input of a comparator of LM339 (at pin6). The resistor R3 (1k), along with LDR, forms a potential divider at this input. The non-inverting input (pin7) is connected to a variable resistor (preset) which is used to set the reference voltage of the comparator.




A comparator works on the principle that its output remains high as long as the non-inverting input is at higher level than that at its inverting input. Here, the output (pin1) is connected to an LED. This concept can be utilized in two configurations (night activation and day activation, respectively) by changing the positions of R3 and LDR as shown the circuit diagrams. The reference voltage is set to correspond to a light intensity between day and night. A preset VR1 (100k) is used which is set to a value of 10k. The resistance of LDR varies between 1k and 1M when it is bright and dark, respectively.


In the first case, the LED will glow when LDR is completely dark, i.e., very less light falls on it. In such a condition, the resistance of LDR is higher than that offered by the preset. This causes a lower potential at pin6 than that at pin7 and so the output goes high thus lighting the LED. The second case is exact opposite to this. This time pin6 goes lower than pin7 when the LDR receives bright light.


Circuit Diagram


Resistor Image

Resistor is a passive component used to control current in a circuit. Its resistance is given by the ratio of voltage applied across its terminals to the current passing through it. Thus a particular value of resistor, for fixed voltage, limits the current through it. They are omnipresent in electronic circuits.

LEDs | Light Emitting Diode
Light emitting diodes (LEDs) are semiconductor light sources. The light emitted...
LDR | Light Dependent Resistor

An LDR (Light dependent resistor), as its name suggests, offers resistance in response to the ambient light. The resistance decreases as the intensity of incident light increases, and vice versa. In the absence of light, LDR exhibits a resistance of the order of mega-ohms which decreases to few hundred ohms in the presence of light. It can act as a sensor, since a varying voltage drop can be obtained...

Presets | Variable Resistors
A preset is a three legged electronic component which can be made to offer varying resistance in a circuit. The resistance is varied by adjusting the rotary control over it. The adjustment can be done by using a small screw driver or...
LM339 | Comparator IC
LM339 IC

LM339 is a comparator IC with four inbuilt comparators. A comparator is a simple circuit that moves signals between the analog and digital worlds. It compares two input voltage levels and gives digital output to indicate the larger one. The two input pins are termed as inverting (V-) and n...

Browse 4m+ Electronic Products

Pick the right product for your next design project with "Mouser Store". Mouser Electronics brings broadest range of semiconductors and electronic components from over 500 industry leading suppliers. 
Mouser specializes in the rapid introduction of new products and technologies for design engineers and buyers that includes semiconductors, interconnects, passives, and electro-mechanical components. Providing the best possible service with the flexibility of not requiring a minimum order and same-day shipping, Mouser has it all.
When you need the right part right now, think of Mouser
Thank you
Team EG



Learn about the latest applications and industry trends with tutorials and white paper design resources on vertical markets.

Energy Harvesting
MEMS Technology
OpenSource Hardware
RF Wireless
Wireless Charging


You are here