ad space

Light and Darkness sensor Circuit with LM393

Here it is explained how a light and darkness sensor circuit can be build with LDR(Light Dependent Resistor) and LM393 comparator operational amplifier. There are two circuit implementation for light sensor and two circuit implementation for darkness sensor, a total of four which are presented here. Each sensor has two circuit implementation due to the fact that we can use operational amplifier in inverting and non-inverting configuration. LM393 LDR sensor circuit can be used for variety of application such as automated lighting of bulbs, intrusion detection, Light Dependent Resistor (LDR) Light Detector Alarm with Arduino etc. So this is one of basic and useful circuits which can be helpful in variety of application.

LDR LM393 sensor

What is the difference between light sensor and dark sensor circuit? 

A light sensor circuit is one which indicates detection of  light source with intensity greater than a preset(pre-defined) light intensity. Suppose there is normal standard light in a room(the preset light intensity), and then the light intensity in the room increases because of increased light sources. A light sensor or light sensor circuit detects. We can using light sensor circuit turn on a LED or ring alarm to indicate the increase in light intensity.

A dark sensor circuit is one which indicates light intensity less than a preset light(or re-defined). Again, suppose there is some standard light in a room and suddenly the light is turned off or lower than the preset light intensity. A dark sensor is then one that indicates the decrease the decrease of light intensity in the room.

The operation of the light and darkness sensor circuit with LDR and LM393 comparator is illustrated in the following video.

 


The light and dark sensor circuit is based on light sensitive sensor called LDR(Light Dependent Resistor). LDR detects amount of light shining on it and changes its resistance according to amount of light falling on it. In other words it is a variable resistor dependent on light intensity. Using it with a voltage comparator circuit we can output high or low depending upon the resistance of the LDR, hence the light intensity. LM393 is a voltage comparator IC which can be used for this purpose. Other operational amplifier like LM311, LM741, LM328, LM324, TL072 etc can also be used.

The LM393 is a popular comparator IC. It is a dual comparator meaning it has two independent comparator inside it. But here we just need to use one of them. To use as a comparator here we use voltage divider network at the two inputs of the LM393 and output either high or low. This high or low output voltage can be used to turn on or off switches connected to lamp, LED, motors whatever. For the demonstration purpose we will use a LED to indicate light intensity greater than desired which is light sensor circuit and indicate light intensity lower than the desired light intensity which is used for darkness indicator circuit.

There are two ways we can construct the circuit. One is by using non-inverting comparator and one is using inverting comparator. Thus light sensor circuit and darkness sensor circuit can be constructed with non-inverting and inverting comparator. As such we can have four circuit implementation and the circuit diagram for the implementations are shown and explained below.

LM393 LDR light sensor

LDR light sensor with non-inverting LM393 comparator

When the input sensor is connected to the non-inverting comparator then it is called non-inverting comparator. Thus here the voltage divider circuit with LDR sensor and resistor is connected to the non-inverting input of LM393 op-amp. At the inverting input, reference voltage which sets the threshold for the light intensity to compare with is connected which is done using a 10kOhm potentiometer. The circuit diagram of light sensor with non-inverting LM393 comparator is shown below.

non-inverting LM393 light sensor
As can be seen in the animated circuit diagram above, when the light intensity increases the LED will turn on. When the light intensity increases, the resistance of the LDR decreases. This decrease in resistance decreases the voltage across it. When the voltage across the LDR decreases, the non-inverting input voltage decreases. When the potentiometer is at the middle the inverting input voltage is 2.5V. So when the non-inverting decreases be
 

LDR light sensor with inverting LM393 comparator

 The circuit diagram for light sensor with inverting LM393 comparator and LDR is shown below.

inverting LM393 light sensor

As can be seen when the light source comes near the LDR sensor the LED is turned on, hence it is a light sensor circuit. When the light comes near the LDR, the voltage drop across it decreases because the LDR resistance decreases with increasing light intensity. This is in accordance to Ohm's Law that voltage is directly proportional to resistance. Due to this voltage drop across LDR, the voltage at the inverting terminal increases. When the voltage at the input of comparator is such that the voltage at the inverting is higher than the non-inverting input which is 2.5V if the POT middle pin is at the center then the comparator output is low. The low output at the comparator output pin causes the LED to turn on as current starts to flow from +5V Vcc to the output pin of the comparator. 

Hence here, if Rldr decreases, Vldr decreases, Vin starts to increases and when Vin > Vni then Vout is low and LED is turned on.

For comparison purpose, the light sensor circuit diagram with inverting and non-inverting LM393 op-amp side by side is shown below.


LM393 LDR darkness sensor

LDR darkness sensor circuit with inverting LM393 comparator

The circuit schematic for darkness sensor circuit using LDR and LM393 inverting comparator is shwn below.

non-inverting LM393 darkness sensor

In this initially when there is enough light, the non-inverting input voltage, Vni, is above the the reference inverting input voltage, Vin=2.5V. Hence the output of the comparator is high and the LED is off. As the light intensity detected by the LDR gets lesser, that is when it gets darker, the resistance across it increases. As the LDR resistance is increased, the voltage drop across it increases. This decreases the voltage at the input of the non-inverting terminal of the op-amp. When the voltage is decreases and becomes lower than the reference voltage at the inverting terminal, that is when the non-inverting voltage is lesser than 2.5V, the output of the comparator becomes low and the LED is turned on.

LDR darkness sensor circuit with inverting comparator

 The following shows circuit drawing for darkness sensor with LDR and LM393 comparator.

inverting LM393 darkness sensor

This darkness sensor circuit works in the following way. Initially, the voltage at output voltage is low and the LED is off. The output voltage is high because the voltage at the inverting terminal is lesser than that at the non-inverting terminal(2.5V). When the darkness is increased, the LDR resistance increases and so the inverting input voltage starts to increase. When the inverting voltage gets eventually higher than the non-inverting the output is low and the LED is turned on.

So here we have illustrated how light and darkness sensor circuit can be build using LDR and LM393 op-amp. Instead of using ordinary light source we can also use laser which has been demonstrated in the tutorial Laser Diode & LDR based alarm system using Arduino. The LM393 comparator is used and essential in many diverse application such as wireless system electronics and instrumentation. One such use of the LM393 comparator is shown in Inductance meter with Arduino and LM393 tutorial.

Post a Comment

Previous Post Next Post