Posted by January 18, 2016
There are some photo sensors that convert light intensity to a frequency (a square wave). I do not know how to change that frequency to a value using ADC in Atmega16. As far as I know, ADC converts a voltage to a digital value not frequency, or I may be wrong

On Sunday, January 17, 2016 11:24 AM, "h...@yahoo.com [avrclub]" wrote:

I have used a photosensor (that must be a photo diode),  however it needs intense light to show a number on the LCD, and it is also not sensitive to light intensity
I pulled up the photoresistor,  it is very sensitive to changes of light intensity. I solved the problem of non linearity as I wrote a code to fit a regression line to various light intensities.
Posted by January 17, 2016

I have used a photosensor (that must be a photo diode), however it needs intense light to show a number on the LCD, and it is also not sensitive to light intensity

I pulled up the photoresistor, it is very sensitive to changes of light intensity. I solved the problem of non linearity as I wrote a code to fit a regression line to various light intensities.

still
the problem is the measurements from photoresistor (and thus ADC) which are not the same for a light intensity.
Posted by January 17, 2016
Photoresistors are notoriously inaccurate. Their repeatability is usually very bad. Depending on what you are trying to accomplish, this may or may not be a problem. If you need better, there are many inexpensive light sensors https://www.adafruit.com/products/2748 available. Here is one https://www.adafruit.com/products/1980 with a digital output.
Posted by January 15, 2016
hi,the photo resistance can't be connected  to ADC input without a current applied to it (use a pull up resistance or a constant current source)  and calculate the Ph. res. value from your ADC output the Ph. Res., Ph. Transistor are not linears, the photo diode is linear and work as a current source proportional to the light intensityto make a good chip current source you can use LM317 with a res. from Output to Adjust Pins, Then I = 1.25 / R.
take the output of current source from Adjust pin.
you must load the LM317 with 5mA or more by adding a resistor form output to GND.  for example : if you connect a 10K from Out to Adj , the current is 1.25 / 10 = 125 uA. If your Ph. Res voltage is 0 to 5 V, the LM317 Out is 1.25 to 6.25, connect a  250 (or 220) Ohm from Output to GND to get 5 mA

On Friday, January 15, 2016 11:04 PM, "h...@yahoo.com [avrclub]" wrote:

Hi All, I have used a photo-resistor and ADC (analogue to digital converter) of atmega16a to measure intensity of light. the photo-resistor is connected to the PINA.0, a capacitor is used too.
It works well but at the same light intensity, the measurements  (that are read from a LCD) are not the same, even a few second after the first measurement. I guess the photo-resistor has a kind of tolerance (error). I am wondering if there is any way to solve this problem?