# Light intensity sensor using LM358 IC

This is part of the starter blog for IC Basics. Check out here to see all of them!

In this project are going to use the LM358 IC and an LDR to scale the intensity of light. First we need to know a bit of theory.

## How it works

#### LM358 and Comparator

The LM358 is actually an op-amp (operational amplifier) which we will be using as a voltage comparator. A comparator circuit compares two voltage values and outputs 1 or 0 to indicate which one of them is larger. Here 1/0 is relative, i.e, it can be 5/0 or 9/0 depending on the circuit.

The LM358 IC has two independent comparators and we will be using only one of them. This is the pin diagram of LM358 and the other figure shows the comparators.

Each comparator has two inputs –

• Inverting input (denoted by the -ve sign)
• Non-inverting input (denoted by the +ve sign)

When the voltage at the non-inverting input is greater than voltage at inverting input, the output of the comparator is HIGH (5v in case of the circuit below). And when the voltage at non-inverting input is less than that of the inverting input, the output of the comparator is LOW (0 in case of the circuit below).

#### LDR( light dependent resistor )

An LDR is a variable resistor whose resistance varies depending on the intensity of light falling on it.

The resistance of an LDR is very high, of the order of Mega Ω in darkness and falls down to few Kilo Ω in presence of light. This feature is used in the below circuit to scale the intensity of light.

Lets get started!

## What you need

You will need the following parts.

1. 10k resistor – 1pc
2. 500Ω (around) – 1pc
3. 10k variable resistor – 1pc
4. LDR – 1pc
5. LM358 IC – 1pc
6. LED – 1pc

Following is an image of the parts.

## What to do

Lets get to the circuit.

Wire the above circuit in the breadboard.

1. Now, shine light on the LDR from a specific distance.
2. Slowly vary the knob of the variable resistor till the output LED glows.
3. This point will set the value of the variable resistor.

Now any light with intensity less than this will give LOW output and with intensity higher than this will give HIGH output.

Vary the knob for different intensities of light and play with the circuit. Enjoy!

## What next

These circuits are very useful in comparing analog values and converting them to a digital output. You can check out *making an IR sensor* where a very similar concept is used.

If you are done with this project, you can check out the following

Feel free to ask any queries in the comment section below.

Light intensity sensor using LM358 IC