Here is a automated night lamp circuit which switches on when the sorrounding is dark.It was based on using a simple photocell for detecting the light intensity. The photocell has a specific character of giving low resistance around ten ohms in full light and in darkness it will rise to hundred ohms.The IC uA741 was used as comparator here.
WORKING OF NIGHT LAMP CIRCUIT:
Lets see how this circuit works.At darkness the resistance of photocell increases and so the voltage at the inverting input of IC1 will be less than the reference voltage at the non inverting input. So this turns the IC1 to go into positive saturation state and hence it switches the transistor ON to activate the relay.A lamp is connected to the relay therby making it glow when relay is activated.
What does R4 do ?
It serves as feedback resistor