On Fri, Jun 23, 2006 at 11:33:41PM -0400, Spehro Pefhany wrote: > At 11:15 PM 6/23/2006 -0400, you wrote: > >I built a quick circuit to take rough light level readings. It's a > >18f458 PIC with a CdS photocell/1k resistor voltage divider connected to > >AN0. The 1k resistor goes to 5v, the CdS phtocell to ground. > > > >I noted the datasheet specifies that signal sources connected to the ADC > >pins should have an impedance of less than 2.2k. My understanding is > >that the voltage divider chain would not qualify for that in low light, > >as the CdS photocell's max resistance in darkness is around 300k. > > The Thevenin equivalent source resistance (assuming a regulated Vdd line) > is the LDR in parallel with 1K , so it will always be less than 1K. > > Rs = Rx || 1K = (Rx * 1K)/(Rx + 1K) Thanks, I think I understand it a lot better now. With a fair bit of work I was able to kludge together an equation that I think describes the final voltage vs. lux graph accurately with gnuplot. Not exactly the most linear of things, but at least I can see that my intuitive choice of 1k isn't that great a pick... If I got everything right, something more like 220ohms would still give me sensitivity at both ends, 1k ends up at a zero slope long before the CdS saturates. -- pete@petertodd.ca http://www.petertodd.ca -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist