www.clarvis.co.uk
Design & Technology Resources
1
2
3
4
8
7
6
5
-V
+V
-
+
+V
0V
+V
0V
+V
-V
0V
+V
0V
-V
+
-
Non-inverting
Input
Inverting
Input
+9V
-9V
Output
Inverting Input
greater than
Non-inverting input

Output = -V
Non-inverting Input
greater than
Inverting input

Output = +V
The diagram below shows how a comparator with a single supply voltage can be used to detect a light level. It works by comparing the output voltages of two potential dividers - one which includes an LDR.
4.5V
7V
9V
9V
9V
9V
0V
When it is light

The LDR has a high resistance therefore the voltage on the non-inverting inputis high (eg 7V)

The voltage on the inverting input is equal to 4.5V because of the potential divider (R3 and R4)

The Non-inverting input voltage is greater than the inverting input voltage therefore the output of the comparator is 9V.

The anode of the green LED is positive and the cathode is 0V so the green LED turns on.
4.5V
2V
0V
9V
0V
0V
0V
When it is dark

The LDR has a low resistance therefore the voltage on the non-inverting input is low (eg 2V)

The voltage on the inverting input is equal to 4.5V because of the potential divider (R3 and R4)

The inverting input voltage is greater than the non-inverting input voltage therefore the output of the comparator is 0V.

The anode of the red LED is positive and the cathode is at 0V
Examination Tip

In an exam you could be asked to modify the circuit so the red light comes on when it is light and the green light comes on when it is dark. There are two ways of doing this...

Swap the inverting and non-inverting inputs over

Or

Swap the positions of R1 and the LDR
The diagram below shows how the above circuits can be modified to light a lamp when it becomes dark. The transistor is needed because the op-amp can only provide a small amount of current from its output.
Operational Amplifiers
Op-Amp Power Supplies
Comparators
Practical Comparator Circuits
A Dark Activated Lamp