# Arduino photo resistor readings question

#### sstavrou

Joined Jun 14, 2017
3
Hi all, I'm new to all this so I got some noob questions

so in a voltage divider with a photoresistor:

1 what difference would a 300Ω resistor have in my analog readings in contrast with a say 10kΩ resistor?
2 would my readings theoretically range from 0 to 1023 regardless of the resistor used?
3 why is 1023 the limit?

#### dl324

Joined Mar 30, 2015
12,920
Welcome to AAC!
1 what difference would a 300Ω resistor have in my analog readings in contrast with a say 10kΩ resistor?
That depends on the resistance of the photoresistor.
2 would my readings theoretically range from 0 to 1023 regardless of the resistor used?
Depends on the voltage across the resistors, the light impinging on the photo resistor, and the resolution of the DAC.
3 why is 1023 the limit?

EDIT: Meant ADC in two places above, not DAC.

Last edited:

#### shteii01

Joined Feb 19, 2010
4,644
3. 2^10=1024
first digit is 0
last digit is 1023

#### sstavrou

Joined Jun 14, 2017
3
I'm not using a DAC. I am using the analog pin of Arduino to analog-read the photoresistor linked with a 320Ω resistor with a 5v source

1 my question is not focusing on the particular numbers I'm wondering how the resistors affect my readings.
For example, would a higher resistance make my analog reading more sensitive/accurate to the LDR changes? should I pick high/low resistance for this task and why? or it doesn't really make any difference?

3 yes 2^10=1024 but how did this 2^10 occur? why is it not 2^8=256? or something else

forgive my ignorance and thx again

#### Mahomed Khomo

Joined Jun 14, 2017
4
I'm not using a DAC. I am using the analog pin of Arduino to analog-read the photoresistor linked with a 320Ω resistor with a 5v source

1 my question is not focusing on the particular numbers I'm wondering how the resistors affect my readings.
For example, would a higher resistance make my analog reading more sensitive/accurate to the LDR changes? should I pick high/low resistance for this task and why? or it doesn't really make any difference?
yes your resistor value determines the sensitivity of the sensor, I would personally recommend a pot for this, ofcos you will only use two legs not three, this will allow you to set your sensor sensitivity easily depending on the day or time of the or so

I have never used an arduino before but on STM32 cortex-MO I can choose which resolution I want ( 8bit ,10bit, 12bit or 16bit) so I don't know if this is the case with arduino

#### sstavrou

Joined Jun 14, 2017
3
yes i just realised that the answer is in analogread method of arduino which has a 10 bit atd converter hence the 1024 values. and yes it seems that you can alter the range within the 10 bit limit i think.

thx all, made a bit sense now!

Last edited:

#### shteii01

Joined Feb 19, 2010
4,644
3 yes 2^10=1024 but how did this 2^10 occur? why is it not 2^8=256? or something else
Management told engineer to design ADC that uses 10 bits. That is why you have 10 bit ADC. Engineers design whatever managers tell them to design.

#### be80be

Joined Jul 5, 2008
2,051
LDR is say 10 k you tap at center of 330 going to ground not much going to happen till the LDR goes close to the 330 value a 1 k or bigger would be better I use 1K to 10K

#### MrChips

Joined Oct 2, 2009
23,932
Try this simulation on a spread sheet.

Firstly, take your photo resistor and measure the resistance when it is dark. Measure the resistance when it is exposed to your maximum light source. Now you have two readings, Rmax and Rmin.

Plug these into a spread sheet column with 100 values from Rmin to Rmax.

Compute the output voltage of the voltage divider using whatever resistance value you choose for the other resistor of the divider.

Now try different values of the resistor and then choose the one you think is most suitable.

#### DickCappels

Joined Aug 21, 2008
7,549
I don't think this was explicitly stated in this thread: The largest value that the ADC in an Arduino can produce directly is 1023.