The value of the resistor R determines the range maximum and minimum values of the output voltage Vo. For best results you need Vo to have a large range and this is achieved if R is much larger than the sensor’s minimum resistance but much smaller than its maximum resistance.
Use a multimeter to find the minimum and maximum values of the sensor’s resistance there is no need to be precise – approximate values will do. Then use the formula to choose a value for resistor R:
R = square root of (Rmin × Rmax)
Rmin = sensor's minimum resistance
Rmax = sensor's maximum resistance
Choose a standard value for R which is close to the calculated value.
For example if your LDR has Rmin = 100 and Rmax = 1M: R = square root of (100 × 1M) = 10k.
Swapping The Resistor And Sensor
The resistor and sensor can be the swapped over to invert the action of the voltage divider. For example an LDR has a high resistance when the dark and a low resistance when brightly lit:
LDR at top(near +Vs) makes Vo high in bright light
LDR at bottom(near 0V) makes Vo high in the dark
Vo high in bright light
Vo high in dark