I have build a simple voltage divider with a light resistor and a 5.6k resistor. I am reading the input on A0 on my arduino board but it is almost always at 1023, independent of light. If I cover it it might go down to 1020 but not more than that.
Do I have to use a greater resistor than 5.6k to achieve more difference in the sensor?
The light sensor is similar to this: http://www.ebay.com/itm/20x-5549CDS-Photo-Light-Dependent-Sensitive-Resistor-Photoresistor-LDR-Photocell-/281425650814?pt=LH_DefaultDomain_0&hash=item418646a47e
I think that the resistance is pending between 1k-10k.
The circuit is like this image:
Voltage divider
Where Vin is 5V from the arduino. R1 is the light sensor, R2 is 5.6k and Vout is connected to A0.
-
1Can you show a diagram of your exact circuit?Peter Bloomfield– Peter Bloomfield2015年04月22日 11:34:11 +00:00Commented Apr 22, 2015 at 11:34
-
2A pointer to the datasheet for the photo-resistor would help, too. At the very least, we'd need to know its resistances when dark and bright.JRobert– JRobert2015年04月22日 11:42:57 +00:00Commented Apr 22, 2015 at 11:42
-
25.6k sounds good. Is A0 connected between LDR and Resistor? Can you check that LDR works using an Ohm meter?user3060854– user30608542015年04月22日 12:18:17 +00:00Commented Apr 22, 2015 at 12:18
-
1A circuit is essential. A description in words in the absence of a circuit is a logical minimum if you actually want an answer. LDR should go from eg A0 to Vcc and resistor from A0 to ground or vice versa - is that what you did? Where did you get the information? Datasheet for LDR? (There are zillions of types). ...Russell McMahon– Russell McMahon2015年04月22日 14:25:43 +00:00Commented Apr 22, 2015 at 14:25
-
1Have you tested the voltages and resistances with a Multimeter?Craig– Craig2015年04月22日 15:45:00 +00:00Commented Apr 22, 2015 at 15:45
2 Answers 2
What have you selected as the analog reference? And if 'external', what is connected to the Vref pin?
For the LDR resistances of 10K and 1K, you Vout should be ~ 1.8v at 10K, and ~ 4.2v at 1K, and giving A/D readings of somewhere around 370 counts and 860 counts, respectively, with a 5v analog reference.
If your analog reference selected to the 1.1v internal reference, either LDR resistance should give you the max reading, but an LDR = 20K could give just over a volt and pretty close to the reading you're getting.
Judging by a datasheet (that I found on the web) that has a resistance of:
- 100 k to 200 k in the light
- 1 M in the dark
Given that Vout = Vin * R2 / (R1 + R2) we can work out:
Light:
Vout = 5 * 200000 / (200000 + 5600) = 4.86 V
Dark:
Vout = 5 * 1000000 / (1000000 + 5600) = 4.97 V
Do I have to use a greater resistor than 5.6k to achieve more difference in the sensor?
Yes, I would measure the resistance in the light, and choose a similar resistor for the other side of the voltage divider. So if you measure 100 k on the sensor, another 100 k will at least divide the voltage in two nicely.