A circuit that works as a Light Controlled Switch uses the LM311 integrated circuit along with a Light Dependent Resistor (LDR).
This circuit is simple but very useful because it reacts to changes in light levels around it.
You can find this kind of circuit in many places, like automatic lights, street lamps and security systems.
The main idea behind this circuit is a voltage comparator that is built around the LM311 IC.
In this design, the LDR detects the light and the LM311 comparator turns on a relay, which can control other electrical devices and a transistor BC547 to control external loads.
It runs on a 12V DC power supply and you can also use a 12V battery for power.
Circuit Working:
Parts List:
Component | Specification | Quantity | Remarks |
---|---|---|---|
Resistors (1/4W) | |||
10k | 2 | ||
1k | 1 | ||
2.2k | 1 | ||
Preset | 47k | 1 | |
Sensors | |||
LDR | – | 1 | |
Semiconductors | |||
IC | LM311 | 1 | |
Transistor | BC547 | 1 | |
Diode | 1N4007 | 1 | |
LED | 5mm, 20mA | 1 | |
Other Components | |||
Relay | 12V SPST | 1 |
The LM311 comparator is the main part of this circuit, and it is really important for comparing two different voltage levels.
At pin 2 called the Non-Inverting Input (+) a reference voltage is set up using a preset VR1 along with a resistor R1.
On the other hand pin 3 known as the Inverting Input (-) gets its voltage from a light-dependent resistor LDR and a resistor R2 that work together as a voltage divider.
When the light is bright the LDRs resistance goes down, which makes the voltage at pin 3 go up.
If the voltage at pin 3 is higher than at pin 2 the output at pin 7 of the comparator goes LOW, which turns off the transistor and the relay.
But when the light gets dimmer the LDRs resistance increases causing the voltage at Pin 3 to drop.
If the voltage at pin 3 is lower than at pin 2 the output at pin 7 switches to HIGH turning on the transistor Q1 and the relay.
Also, the LED1 lights up to show that the relay is working.
To protect against any voltage spikes from the relay coil a diode D1 is added to the circuit for safety.
Formulas with Calculations:
Below are the formulas with calculations for Light Controlled Switch Circuit using IC LM311 and LDR
Voltage at Inverting Input (Pin 3 of LM311):
The voltage at pin 3 is determined by the voltage divider formed by the LDR and resistor R2:
Formula: V3 = (R2 / (LDR + R2)) × V_supply
Example Calculation:
Assume LDR resistance in darkness is 50kΩ:
V3 = (10k / (50k + 10k)) × 12V
V3 = (10k / 60k) × 12V
V3 = 2V
If the LDR resistance in bright light drops to 5kΩ:
V3 = (10k / (5k + 10k)) × 12V
V3 = (10k / 15k) × 12V
V3 = 8V
Reference Voltage at Non-Inverting Input (Pin 2 of LM311):
The reference voltage is set using the preset VR1 and resistor R1.
Formula: V2 = (R1 / (VR1 + R1)) × V_supply
Example Calculation:
If VR1 is set to 47kΩ: V2 = (10k / (47k + 10k)) × 12V
V2 = (10k / 57k) × 12V
V2 = 2.1V
If VR1 is set to 20kΩ: V2 = (10k / (20k + 10k)) × 12V
V2 = (10k / 30k) × 12V
V2 = 4V
If VR1 is set to 10kΩ: V2 = (10k / (10k + 10k)) × 12V
V2 = (10k / 20k) × 12V
V2 = 6V
Comparator Output Logic:
If V3 > V2 the output at pin 7 is LOW keeping the transistor OFF and relay OFF.
If V3 < V2 the output at pin 7 is HIGH turning the transistor ON and activating the relay.
Example:
If V3 = 8V (bright light) and V2 = 2.1V relay remains OFF.
If V3 = 2V (darkness) and V2 = 2.1V relay turns ON.
Transistor Base Current Calculation (Q1 – BC547):
The transistor is used to drive the relay.
The base current is given by:
Formula: I_B = (V_output – V_BE) / R3
where:
- V_output of LM311 output voltage is 12V
- V_BE is base emitter voltage of BC547 which is around 0.7V
- R3 is 1k in the circuit
Example Calculation:
I_B = (12V – 0.7V) / 1k
I_B = 11.3V / 1000
I_B = 11.3mA
Relay Coil Current Calculation:
The relay coil current is given by:
Formula: I_Relay = V_supply / R_Relay
Assuming a 12V relay with a coil resistance of 400Ω: I_Relay = 12V / 400Ω
I_Relay = 30mA
Diode Protection Calculation:
The diode 1N4007 protects against back EMF from the relay coil.
V_diode > V_supply
Since the supply is 12V the 1N4007 rated for 1000V is more than sufficient.
How to Build:
To build a Light Controlled Switch Circuit using IC LM311 and LDR following steps are required for connection of the circuit:
- Assemble all the components as mentioned in the above circuit diagram.
- Connect pin 1 of IC LM311 to GND of the circuit
- Connect pin 2 of IC1 to the Non-Inverting Input between resistor R1 and resistor R2.
- Connect pin 3 of IC1 to Inverting Input between VR1 preset and LDR.
- Connect pin 4 of IC1 to GND of the circuit.
- Connect pin 5 to pin 6 of IC1
- Connect pin 7 of IC1 to base of transistor Q1 through resistor R3
- Connect pin 8 of IC1 to positive terminal of the circuit.
- Connect collector of transistor Q1 to positive supply through diode D1.
- Connect emitter of transistor Q1 to GND.
- Connect one end of COIL pin of 12V relay to positive supply and other end of COIL pin between diode D1 and collector of transistor Q1
- Connect anode of LED1 to positive supply and cathode of LED1 to one end of resistor R4 and other end of resistor R4 connect between diode D1 and collector of transistor Q1
Conclusion:
This Light Controlled Switch Circuit using IC LM311 and LDR is a simple and efficient way to control devices depending on how much light is around.
The IC LM311 comparator ensures accurate switching and the BC547 transistor helps the relay work well.
You can adjust the sensitivity with the preset, which makes it useful for different things like automatic night lights, security alarms and systems that save energy.