Measuring Light with an LDR
Build a voltage divider with an LDR and a 10 kΩ resistor and measure ambient light through an analog input.
Circuit diagram

Bu projeyi gerçekten kurmak istersen parçaları hobidevre.com'dan temin edebilirsin →
Build it for real
To build this project for real, get the parts from hobidevre.com → hobidevre.com →
More build guides: hobidevre.com/blog
Create a free account — save your progress and get more circuits →
Save your circuitYou can open the same circuit in the browser-based circuit simulator without any installation and inspect the wires and components there.
Parts list
| Component | Qty | Description |
|---|---|---|
| Arduino Uno | 1 | Control board that reads the analog input. |
| 5V reference connection | 1 | Supplies a constant voltage to the divider. |
| 10 kΩ resistor | 1 | Forms a voltage divider with the LDR. |
| LDR | 1 | Its resistance changes with light intensity. |
| Ground connection | 1 | The circuit's common 0V point. |
Breadboard layout
The Arduino is on the left, the 5V reference on the upper row, the 10 kΩ resistor and the LDR stacked in the same vertical column, and the common ground at the lower right. The row where the resistor and the LDR meet goes to the analog input.
Step-by-step build
- Place the Arduino Uno on the work area.Tip: The board's GND pin is index 0 at the lower left.
- Connect the 5V reference to the first end of the 10 kΩ resistor.Tip: Do not mix up the resistor's pin 0 and pin 1 ends.
- Connect the other end of the resistor to the first end of the LDR, and connect the same point to the analog input.Tip: Arduino pin 4 is used as the analog input.
- Connect the other end of the LDR to common ground and the Arduino GND to the same ground.Tip: Ground has a single pin; several wires can share it.
- Upload the code and watch the light value on the serial port.Tip: The reading should decrease when you bring your hand near the LDR.
How it works
A voltage divider is a circuit in which two resistors are connected in series and the output voltage is taken from the point where the resistors meet. The output voltage equals the source voltage multiplied by the ratio of the lower resistor to the total resistance. Since the LDR's resistance changes inversely with light intensity, the divider output changes with light as well. The Arduino's analog-to-digital converter divides the 0 to 5 volt range into 1024 steps; light intensity can therefore be followed as a numeric value. The fixed resistor value determines the measurement range and reading behaviour.
What you will learn
- Builds a voltage divider circuit.
- Reads values from an analog input in the 0-1023 range.
- Converts a resistance change into a voltage change.
Expected result: A number that changes with light intensity appears on the serial port; the value drops in darkness and rises in bright light.
Challenge
Light meter: Read ambient light from the analog input with the LDR.
Goal: A number that changes with light appears on the serial port.
Tips
- The two ends of the LDR are symmetrical, so orientation does not matter.
- If the reading in darkness is too low, try changing the fixed resistor value.
Frequently asked questions
How does the LDR's resistance change with light?
Its resistance decreases as more light falls on it and increases as it gets darker. This change is reflected in the voltage divider output.
Why does the analog reading vary between 0 and 1023?
The Arduino's analog-to-digital converter divides the 0-5 volt range into 1024 steps; the read number is one of those steps.
What should I do if the reading stays high even in darkness?
The fixed resistor value determines the divider range; trying a different resistor can change the reading range.
If you want to build this project in real life, you can get the parts from hobidevre.com. For more circuit ideas, visit the hobidevre.com blog.