Starting Electronics needs your help! Please make a donation to help cover our hosting and other costs. Click the donate button to send a donation of any amount.

Tutorial 20: Automatic Light

Created on: 6 August 2012

In this electronic circuit, when the ambient light level drops below a certain level, the LED switches on automatically.

Can't see the video? View on YouTube →


Know how to use an 8-pin DIP IC, e.g. from tutorial 5. Read about operational amplifiers (op-amps).


In addition to a breadboard, wire links, 9V battery and battery clip, you will need:

Qty Part Designator Notes Type
2 100k resistors (brown - black - yellow) R2, R7 1/4W 5% or better Resistors
1 56k resistor (green - blue - orange) R1
1 33k resistor (orange - orange - orange) R6
1 10k resistor (brown - black - orange) R5
1 4k7 resistor ( yellow - violet - red) R8
1 1k resistor (brown - black - red) R3
1 100uF capacitor C1 Electrolytic capacitor, 16V or more Capacitor
1 LM741 U1 LM741 op-amp IC (8 pin DIP) Semiconductors
1 PN2222 or KSP2222 Q1 NPN transistor
1 1N4148 D2 Diode
1 LED D1 E.g. 5mm white LED
1 LDR R4 LDR (Light Dependent Resistor) LDR

Books that may interest you:

C Programming with Arduino Book Ultimate Arduino MEGA 2560 Hardware Manual Ultimage Arduino Uno Hardware Manual

To make the light level at which the LED switches on adjustable, you will also need a 100k trimpot.

Circuit Diagram

Two circuit diagrams have been included. The first diagram shows the automatic light circuit using a fixed light level to automatically switch the LED on. The second circuit adds a trimpot to make the level at which the LED switches on adjustable.

Automatic Light Circuit Diagram with Fixed Trigger Threshold
Automatic Light Circuit Diagram with Fixed Trigger Threshold
Automatic Light Circuit with Adjustable Trigger Threshold
Automatic Light Circuit with Adjustable Trigger Threshold

Building the Circuit

The LM741 IC is housed in a 8-pin DIP, so normal DIP IC pin numbering applies to it. If using a bright LED, place the LED away from the LDR. A photo of the completed breadboard circuit is shown below. Click the photo for a bigger image.

The automatic light circuit on breadboard
Automatic Light Circuit on a Breadboard

Operating the Circuit

Cover the LDR to restrict light to it and the LED will switch on. If you have built the circuit with the trimpot, then adjust the trimpot so that the LED switches on at the desired light level. Do this by covering the LDR so that the desired level of light is reaching it. Now adjust the trimpot until the LED just switches on.

Keep the LED away from the LDR. If the light from the LED is bright enough and it reaches the LDR, then the circuit will switch off because there will be enough light reaching the LDR. After the circuit switches off, the light from the LED will no longer reach the LDR which will cause the circuit to switch the LED on again. The circuit will carry on "oscillating" like this until there is enough ambient light, or the light from the LED is prevented from reaching the LDR.

As an Amazon Associate I earn from qualifying purchases: