This project creates an automatic night light that activates an LED when the ambient light level falls below a set threshold.
The system uses a photoresistor to detect ambient light levels and compares these readings against a predefined threshold value (500). When darkness is detected, the LED turns on automatically. The microcontroller continuously reads the light sensor, displays values via Serial communication, and updates the LED state accordingly. The 100ms delay between readings provides stability by preventing the system from reacting to momentary light fluctuations while maintaining responsive operation.
Parts List
- Arduino board
- Photoresistor (light-dependent resistor)
- LED
- 220Ξ© resistor (for LED)
- 10kΞ© resistor (for photoresistor voltage divider)
- Breadboard
- Jumper wires
Assembly Instructions
- Connect the photoresistor to analog pin A0:
- Attach one leg of the photoresistor to 5V
- Connect the other leg to both the 10kΞ© resistor and analog pin A0
- Connect the other end of the 10kΞ© resistor to ground
- Connect the LED to digital pin 7:
- Connect the anode (longer leg) of the LED to digital pin 7
- Connect the cathode (shorter leg) to the 220Ξ© resistor
- Connect the other end of the resistor to ground
- Double-check all connections before powering the board
