Math Bridge: LDR Divider Codes

← Back to Lab: Light and Proximity Sensors
Math BridgeSensorsStruggle-friendly runway

How LDR resistance becomes an ADC code

One thread from a voltage divider to the chapter's bright, midpoint, and near-dark codes.

Phoebe, the physics guidePhoebe guides
The one targetTurn LDR resistance into a 12-bit ADC code.
The chapter case3.3 V, 10 kΩ fixed, 1 kΩ to 1 MΩ LDR.
What it buys youPredict useful thresholds before calibrating them.

A field team faces an unresolved physical question: How LDR resistance becomes an ADC code They must answer it before changing ldr resistance in kilohms on the real device. Predict the direction first.

See the relationship before changing it

The figure reads from left to right. The blue card is ldr resistance in kilohms. The middle card applies this page's relationship. The green card is ideal adc code. Walk the arrows once: set the input, apply the rule, then read the result with its unit.

The retained audit below checks several chapter fixtures. This added model holds every other chapter fixture fixed, so the numeric fixture does not switch without explanation.

LDR resistance in kilohms changes ideal adc code An input card leads through the page relationship to the ideal adc code result. SET INPUT ONE CONTROL APPLY RULE predict calculate check units READ RESULT
Walk the arrows. Increasing the LDR resistance lowers both series current and the fixed resistor's voltage share.

Derive the baseline in four named moves

  1. 1

    Name the input. The chapter baseline for ldr resistance in kilohms is 10.

  2. 2

    Name the relationship. Vout=VCC Rfixed/(RLDR+Rfixed); code=4095 Vout/VCC

  3. 3

    Substitute the chapter fixture. Set ldr resistance in kilohms to 10. The page ledger gives ideal adc code as 2048.

  4. 4

    Read the result. Keep the stated output unit beside the value. Use it only inside the technical boundary on this page.

Predict, then change ldr resistance in kilohms

Try Predict the direction of ideal adc code. Move one control, calculate, then check your prediction.

10
Chapter baseline
Ideal ADC code

Observe Increasing the LDR resistance lowers both series current and the fixed resistor's voltage share. Reset the control to 10 and compare ideal adc code.

Explain Only ldr resistance in kilohms moves here. The other chapter fixtures remain fixed.

Check yourself

What should you do before trusting a moved-control result?
Answer: Predict its direction, apply the shown relationship, keep the units, and reset to the worked baseline.
What does this small model leave out?
Answer: Only ldr resistance in kilohms moves. Field effects named in the page's technical boundary stay fixed.

1. Start with the current path

The LDR and the fixed resistor form one series path from 3.3 V to ground. The ADC watches the voltage across the fixed resistor.

Phoebe: The same current flows through both resistors. The larger resistor claims the larger share of the supply voltage.

2. Build the divider rule

1

Add the series resistanceRtotal=RLDR+Rfixed.

2

Find currentI=VCC/Rtotal.

3

Take the fixed-resistor dropVout=IRfixed=VCC Rfixed/(RLDR+Rfixed).

3. Convert voltage to a code

A 12-bit converter has codes 0 through 4095. The ideal code is the same fraction of 4095 as Vout is of 3.3 V.

code=4095×Vout/3.3

The hardware returns an integer, so the ideal value is rounded to the nearest available code.

4. Try the LDR resistance

Vout=VCC Rfixed/(RLDR+Rfixed); code=4095 Vout/VCC

TryMove the LDR from bright-light resistance toward the chapter's darker cases.

Divider output
Ideal ADC code
Divider current

ObserveAt 10 kΩ, equal resistors split 3.3 V in half: 1.65 V, ideal code 2048, and 0.165 mA.

ExplainIncreasing the LDR resistance lowers both series current and the fixed resistor's voltage share.

Technical boundaries.

This ideal divider

ADC input loading
Needs separate evidence
resistor tolerance
Needs separate evidence
LDR spectral response
Needs separate evidence
self-heating
Needs separate evidence
supply/reference error
Needs separate evidence
nonlinear calibration
Needs separate evidence
target colour
Needs separate evidence
angle
Needs separate evidence
sunlight
Needs separate evidence
optics
Needs separate evidence
two-way geometry
Needs separate evidence

Use field evidence or a deeper model before release.

5. Work bright and midpoint

RLDR=1 kΩ → Vout=3.00 V → code 3723
RLDR=10 kΩ → Vout=1.65 V → code 2048

The midpoint is easy to reason about: equal resistors share the supply equally.

6. Work darkness, then stop claiming universality

RLDR=1 MΩ → Vout=0.0327 V → code 41

The chapter's 50 cm proximity threshold is a measured decision boundary. Inverse-square spreading predicts 4.00× one-way irradiance at 25 cm, but it does not make one universal ADC threshold for every target and room.

7. Check yourself

Why is Vout 1.65 V when both resistors are 10 kΩ?
Answer: Equal series resistors split the 3.3 V supply equally.
Which way does the ADC code move as this LDR resistance rises?
Answer: Down, because the fixed resistor receives a smaller fraction of the supply.
Does the inverse-square rule produce a universal 50 cm threshold?
Answer: No. Target reflectance, angle, ambient light, and optics still require measured calibration.
Honesty boundary.

These are the chapter inputs, worked results, and named teaching assumptions.

3.3 V supply
Voltage or voltage-step value
10 kΩ fixed resistor
Resistance or impedance value
12-bit 0–4095 ADC
Digital resolution or converter setting
1 kΩ/3.00 V/code 3723
Voltage or voltage-step value
10 kΩ/1.65 V/code 2048
Voltage or voltage-step value
1 MΩ/0.0327 V/code 41
Voltage or voltage-step value
50 cm threshold
Distance, wavelength, or size
4.00× 25 cm ratio come from the chapter
Distance, wavelength, or size

This page does not turn a pedagogical divider into a calibrated lux or distance meter.