Exercise 7 - Automatic Night Lamp
An automatic night lamp is basically a lamp that will automatically turn on when it sense darkness in the environment. In this example, we will be using a photoresistor to demonstrate how to convert the ambient level into a lamp’s brightness.
A photoresistor or photocell or a light dependent resistor (LDR) is a component that has a variable resistance with the light intensity that falls upon it. The brighter the light is, the lower the resistance will be. The photoresistor is commonly used to turn on a light and also used to control the shutter speed on a camera.
In the circuit below, a voltage divider is formed by a 10K resistor and the photoresistor. When light shines on the photoresistor, the resistance of the photoresistor become lower, thus the voltage drop across the photoresistor will be lower. When the photoresistor is being covered and away from light, the resistance of the photresistor will become higher and caused the voltage drop across it to be higher. By knowing the voltage drop across the photoresistor, we can obtain the relative light level value converted from the voltage read across the photoresistor.
- Connect the 10K resistor to 5V and 30A.
- Connect the photoresistor to 30E and 30F.
- Connect the 330Ω resistor to PIN9 and 32J.
- Connect the anode (longer pin) of the LED to 32I and the other pin to 33I.
- Connect a jumper to GND and 30J.
- Connect a jumper to GND and 33J.
- Connect a jumper to A0 and 30C.