# Best resistor value in series with LDR sensors

I am designing sensors array for the Line following Robot, based on LDRs Resistors and transmitter LEDs, the value of LDRs Resistors in series is changing with the position of the array on the black Line, so I can measure the Deviation angle value from the voltage divider through R1 to control the tow Motors.

The value of LDR Resistors changing from 92 Kohm to 110 kohm, I put a resistor R1 in series with the LDRs, the ADC pin (A0) in arduino uno is connected to the voltage divider through R1.

Question: How I can choose the value of R1 to get the best sensitivity on A0 pin? I tried 10k ohm but I get a small changes just [4.5,4.58] volt and that's not working I need more sensitivity. How can I choose R1 to get the best sensitivity on A0 pin?

simulate this circuit – Schematic created using CircuitLab

## 2 Answers

As with many things, but unusually obvious here, calculus comes to the rescue. Your senstitivity is $$\frac{\partial V_{out}}{\partial R_{LDR} }$$ You need to find the expression for $$\frac{\partial^2 V_{out}}{\partial R_{LDR} \partial R_1}$$ as a function of the resistance of the LDR and R1, set that equal to zero, and find the value of R1 when that derivative is zero.

Formally, you should take the second derivative and make sure its a maximum and not a minimum, and test your endpoints for absolutes, but in this case I'm reasonably sure that won't be necessary.

My gut feels like R1 should be 400 ohms, but my gut's been wrong before and will be again. (@Wouter-van-ooijen seems to think it will be an absolute at one of the endpoints. Interested to see what the right answer is)

Note that this in no way spreads your range of Vout over the dynamic range of your ADC. You may well need to do some signal conditioning beyond that circuit.

Oops, just noticed that the LDRS aren't 100 ohms like in the picture. The answer should be that R1 should be set at the total value of the four LDRs, which is right in line with Wouter. This will interfere with the adc, and you should buffer.

To get the largest voltage swing for the values you mention, R1 should be ~ 100 kOhm. But note that this makes the impedance of the Vout ~ 50 KOhm. For PIC UCs a maximum resistance of 10k is recommended, I don't know this figure for your UC *uno = Atmega328P?) so you'll have to check.

Also, I am not sure why you place the LDRs in series, but that's another question.

• you mean we can get more voltage swing if we put he LDRs in parrallel? Sep 30 '15 at 12:28
• That depends on how the ilumination changes. Series is OK when they are all illuminated, except for one which might be in the dark. Parallel is better in the oppisite case, all dark but one might be illuminated. Sep 30 '15 at 14:45