Introduction: Why waste electricity when a light can turn on only when it’s dark?
In this project, we’ll use a BBC micro:bit, Bit-Z expansion board, and an LDR (Light Dependent Resistor) to create an automatic light control system.
The LDR detects surrounding light levels, and the micro:bit will automatically turn an LED (or lamp) on at night and off during the day.
Learning Outcomes:
By completing this project, you’ll:
- Understand how an LDR senses brightness.
- Use analog sensor values in a micro:bit program.
- Control output devices (LED/light) automatically.
Components Needed:
- BBC micro:bit
- Bit-Z
- LDR Sensor Module
Circuit Connection:
On the Bit-Z board, we’ll connect:
LDR Sensor Module to P0/P1/P2
How It Works
- LDR changes its resistance depending on light.
- The micro:bit reads the analog value from the LDR.
- If the value is below the threshold, it’s dark → LED turns ON.
- If it’s above the threshold, it’s bright → LED turns OFF.
Code:

Possible Improvements:
- Add a buzzer to beep when the light changes state.
- Use a relay module to control real AC bulbs.
- Store and display light levels over time for analysis.
- Combine with an RTC module to add time-based control.
Conclusion:
With just a micro:bit, Bit-Z board, and LDR sensor, you’ve built a smart lighting system that saves electricity and responds to the environment automatically.