Reply by "Had...@yahoo.com [avrclub]"●January 18, 20162016-01-18
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:
Hi there, Thanks Imad for your help.
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.
stillthe problem is the measurements from photoresistor (and thus ADC) which are
not the same for a light intensity. #yiv1649854948 #yiv1649854948 --
#yiv1649854948ygrp-mkp {border:1px solid #d8d8d8;font-family:Arial;margin:10px
0;padding:0 10px;}#yiv1649854948 #yiv1649854948ygrp-mkp hr {border:1px solid
#d8d8d8;}#yiv1649854948 #yiv1649854948ygrp-mkp #yiv1649854948hd
{color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px
0;}#yiv1649854948 #yiv1649854948ygrp-mkp #yiv1649854948ads
{margin-bottom:10px;}#yiv1649854948 #yiv1649854948ygrp-mkp .yiv1649854948ad
{padding:0 0;}#yiv1649854948 #yiv1649854948ygrp-mkp .yiv1649854948ad p
{margin:0;}#yiv1649854948 #yiv1649854948ygrp-mkp .yiv1649854948ad a
{color:#0000ff;text-decoration:none;}#yiv1649854948 #yiv1649854948ygrp-sponsor
#yiv1649854948ygrp-lc {font-family:Arial;}#yiv1649854948
#yiv1649854948ygrp-sponsor #yiv1649854948ygrp-lc #yiv1649854948hd {margin:10px
0px;font-weight:700;font-size:78%;line-height:122%;}#yiv1649854948
#yiv1649854948ygrp-sponsor #yiv1649854948ygrp-lc .yiv1649854948ad
{margin-bottom:10px;padding:0 0;}#yiv1649854948 #yiv1649854948actions
{font-family:Verdana;font-size:11px;padding:10px 0;}#yiv1649854948
#yiv1649854948activity
{background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}#yiv1649854948
#yiv1649854948activity span {font-weight:700;}#yiv1649854948
#yiv1649854948activity span:first-child
{text-transform:uppercase;}#yiv1649854948 #yiv1649854948activity span a
{color:#5085b6;text-decoration:none;}#yiv1649854948 #yiv1649854948activity span
span {color:#ff7900;}#yiv1649854948 #yiv1649854948activity span
.yiv1649854948underline {text-decoration:underline;}#yiv1649854948
.yiv1649854948attach
{clear:both;display:table;font-family:Arial;font-size:12px;padding:10px
0;width:400px;}#yiv1649854948 .yiv1649854948attach div a
{text-decoration:none;}#yiv1649854948 .yiv1649854948attach img
{border:none;padding-right:5px;}#yiv1649854948 .yiv1649854948attach label
{display:block;margin-bottom:5px;}#yiv1649854948 .yiv1649854948attach label a
{text-decoration:none;}#yiv1649854948 blockquote {margin:0 0 0
4px;}#yiv1649854948 .yiv1649854948bold
{font-family:Arial;font-size:13px;font-weight:700;}#yiv1649854948
.yiv1649854948bold a {text-decoration:none;}#yiv1649854948 dd.yiv1649854948last
p a {font-family:Verdana;font-weight:700;}#yiv1649854948 dd.yiv1649854948last p
span {margin-right:10px;font-family:Verdana;font-weight:700;}#yiv1649854948
dd.yiv1649854948last p span.yiv1649854948yshortcuts
{margin-right:0;}#yiv1649854948 div.yiv1649854948attach-table div div a
{text-decoration:none;}#yiv1649854948 div.yiv1649854948attach-table
{width:400px;}#yiv1649854948 div.yiv1649854948file-title a, #yiv1649854948
div.yiv1649854948file-title a:active, #yiv1649854948 div.yiv1649854948file-title
a:hover, #yiv1649854948 div.yiv1649854948file-title a:visited
{text-decoration:none;}#yiv1649854948 div.yiv1649854948photo-title a,
#yiv1649854948 div.yiv1649854948photo-title a:active, #yiv1649854948
div.yiv1649854948photo-title a:hover, #yiv1649854948
div.yiv1649854948photo-title a:visited {text-decoration:none;}#yiv1649854948
div#yiv1649854948ygrp-mlmsg #yiv1649854948ygrp-msg p a
span.yiv1649854948yshortcuts
{font-family:Verdana;font-size:10px;font-weight:normal;}#yiv1649854948
.yiv1649854948green {color:#628c2a;}#yiv1649854948 .yiv1649854948MsoNormal
{margin:0 0 0 0;}#yiv1649854948 o {font-size:0;}#yiv1649854948
#yiv1649854948photos div {float:left;width:72px;}#yiv1649854948
#yiv1649854948photos div div {border:1px solid
#666666;height:62px;overflow:hidden;width:62px;}#yiv1649854948
#yiv1649854948photos div label
{color:#666666;font-size:10px;overflow:hidden;text-align:center;white-space:nowrap;width:64px;}#yiv1649854948
#yiv1649854948reco-category {font-size:77%;}#yiv1649854948
#yiv1649854948reco-desc {font-size:77%;}#yiv1649854948 .yiv1649854948replbq
{margin:4px;}#yiv1649854948 #yiv1649854948ygrp-actbar div a:first-child
{margin-right:2px;padding-right:5px;}#yiv1649854948 #yiv1649854948ygrp-mlmsg
{font-size:13px;font-family:Arial, helvetica, clean, sans-serif;}#yiv1649854948
#yiv1649854948ygrp-mlmsg table {font-size:inherit;font:100%;}#yiv1649854948
#yiv1649854948ygrp-mlmsg select, #yiv1649854948 input, #yiv1649854948 textarea
{font:99% Arial, Helvetica, clean, sans-serif;}#yiv1649854948
#yiv1649854948ygrp-mlmsg pre, #yiv1649854948 code {font:115%
monospace;}#yiv1649854948 #yiv1649854948ygrp-mlmsg *
{line-height:1.22em;}#yiv1649854948 #yiv1649854948ygrp-mlmsg #yiv1649854948logo
{padding-bottom:10px;}#yiv1649854948 #yiv1649854948ygrp-msg p a
{font-family:Verdana;}#yiv1649854948 #yiv1649854948ygrp-msg
p#yiv1649854948attach-count span {color:#1E66AE;font-weight:700;}#yiv1649854948
#yiv1649854948ygrp-reco #yiv1649854948reco-head
{color:#ff7900;font-weight:700;}#yiv1649854948 #yiv1649854948ygrp-reco
{margin-bottom:20px;padding:0px;}#yiv1649854948 #yiv1649854948ygrp-sponsor
#yiv1649854948ov li a {font-size:130%;text-decoration:none;}#yiv1649854948
#yiv1649854948ygrp-sponsor #yiv1649854948ov li
{font-size:77%;list-style-type:square;padding:6px 0;}#yiv1649854948
#yiv1649854948ygrp-sponsor #yiv1649854948ov ul {margin:0;padding:0 0 0
8px;}#yiv1649854948 #yiv1649854948ygrp-text {font-family:Georgia;}#yiv1649854948
#yiv1649854948ygrp-text p {margin:0 0 1em 0;}#yiv1649854948
#yiv1649854948ygrp-text tt {font-size:120%;}#yiv1649854948
#yiv1649854948ygrp-vital ul li:last-child {border-right:none
!important;}#yiv1649854948
Reply by "hpo...@yahoo.com [avrclub]"●January 17, 20162016-01-17
Hi there, Thanks Imad for your help.
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.
Reply by "tim...@yahoo.com [avrclub]"●January 17, 20162016-01-17
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.
Reply by "Ima...@yahoo.com [avrclub]"●January 15, 20162016-01-15
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?
Cheers, Hadi
#yiv5519382758 #yiv5519382758 -- #yiv5519382758ygrp-mkp {border:1px solid
#d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;}#yiv5519382758
#yiv5519382758ygrp-mkp hr {border:1px solid #d8d8d8;}#yiv5519382758
#yiv5519382758ygrp-mkp #yiv5519382758hd
{color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px
0;}#yiv5519382758 #yiv5519382758ygrp-mkp #yiv5519382758ads
{margin-bottom:10px;}#yiv5519382758 #yiv5519382758ygrp-mkp .yiv5519382758ad
{padding:0 0;}#yiv5519382758 #yiv5519382758ygrp-mkp .yiv5519382758ad p
{margin:0;}#yiv5519382758 #yiv5519382758ygrp-mkp .yiv5519382758ad a
{color:#0000ff;text-decoration:none;}#yiv5519382758 #yiv5519382758ygrp-sponsor
#yiv5519382758ygrp-lc {font-family:Arial;}#yiv5519382758
#yiv5519382758ygrp-sponsor #yiv5519382758ygrp-lc #yiv5519382758hd {margin:10px
0px;font-weight:700;font-size:78%;line-height:122%;}#yiv5519382758
#yiv5519382758ygrp-sponsor #yiv5519382758ygrp-lc .yiv5519382758ad
{margin-bottom:10px;padding:0 0;}#yiv5519382758 #yiv5519382758actions
{font-family:Verdana;font-size:11px;padding:10px 0;}#yiv5519382758
#yiv5519382758activity
{background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}#yiv5519382758
#yiv5519382758activity span {font-weight:700;}#yiv5519382758
#yiv5519382758activity span:first-child
{text-transform:uppercase;}#yiv5519382758 #yiv5519382758activity span a
{color:#5085b6;text-decoration:none;}#yiv5519382758 #yiv5519382758activity span
span {color:#ff7900;}#yiv5519382758 #yiv5519382758activity span
.yiv5519382758underline {text-decoration:underline;}#yiv5519382758
.yiv5519382758attach
{clear:both;display:table;font-family:Arial;font-size:12px;padding:10px
0;width:400px;}#yiv5519382758 .yiv5519382758attach div a
{text-decoration:none;}#yiv5519382758 .yiv5519382758attach img
{border:none;padding-right:5px;}#yiv5519382758 .yiv5519382758attach label
{display:block;margin-bottom:5px;}#yiv5519382758 .yiv5519382758attach label a
{text-decoration:none;}#yiv5519382758 blockquote {margin:0 0 0
4px;}#yiv5519382758 .yiv5519382758bold
{font-family:Arial;font-size:13px;font-weight:700;}#yiv5519382758
.yiv5519382758bold a {text-decoration:none;}#yiv5519382758 dd.yiv5519382758last
p a {font-family:Verdana;font-weight:700;}#yiv5519382758 dd.yiv5519382758last p
span {margin-right:10px;font-family:Verdana;font-weight:700;}#yiv5519382758
dd.yiv5519382758last p span.yiv5519382758yshortcuts
{margin-right:0;}#yiv5519382758 div.yiv5519382758attach-table div div a
{text-decoration:none;}#yiv5519382758 div.yiv5519382758attach-table
{width:400px;}#yiv5519382758 div.yiv5519382758file-title a, #yiv5519382758
div.yiv5519382758file-title a:active, #yiv5519382758 div.yiv5519382758file-title
a:hover, #yiv5519382758 div.yiv5519382758file-title a:visited
{text-decoration:none;}#yiv5519382758 div.yiv5519382758photo-title a,
#yiv5519382758 div.yiv5519382758photo-title a:active, #yiv5519382758
div.yiv5519382758photo-title a:hover, #yiv5519382758
div.yiv5519382758photo-title a:visited {text-decoration:none;}#yiv5519382758
div#yiv5519382758ygrp-mlmsg #yiv5519382758ygrp-msg p a
span.yiv5519382758yshortcuts
{font-family:Verdana;font-size:10px;font-weight:normal;}#yiv5519382758
.yiv5519382758green {color:#628c2a;}#yiv5519382758 .yiv5519382758MsoNormal
{margin:0 0 0 0;}#yiv5519382758 o {font-size:0;}#yiv5519382758
#yiv5519382758photos div {float:left;width:72px;}#yiv5519382758
#yiv5519382758photos div div {border:1px solid
#666666;height:62px;overflow:hidden;width:62px;}#yiv5519382758
#yiv5519382758photos div label
{color:#666666;font-size:10px;overflow:hidden;text-align:center;white-space:nowrap;width:64px;}#yiv5519382758
#yiv5519382758reco-category {font-size:77%;}#yiv5519382758
#yiv5519382758reco-desc {font-size:77%;}#yiv5519382758 .yiv5519382758replbq
{margin:4px;}#yiv5519382758 #yiv5519382758ygrp-actbar div a:first-child
{margin-right:2px;padding-right:5px;}#yiv5519382758 #yiv5519382758ygrp-mlmsg
{font-size:13px;font-family:Arial, helvetica, clean, sans-serif;}#yiv5519382758
#yiv5519382758ygrp-mlmsg table {font-size:inherit;font:100%;}#yiv5519382758
#yiv5519382758ygrp-mlmsg select, #yiv5519382758 input, #yiv5519382758 textarea
{font:99% Arial, Helvetica, clean, sans-serif;}#yiv5519382758
#yiv5519382758ygrp-mlmsg pre, #yiv5519382758 code {font:115%
monospace;}#yiv5519382758 #yiv5519382758ygrp-mlmsg *
{line-height:1.22em;}#yiv5519382758 #yiv5519382758ygrp-mlmsg #yiv5519382758logo
{padding-bottom:10px;}#yiv5519382758 #yiv5519382758ygrp-msg p a
{font-family:Verdana;}#yiv5519382758 #yiv5519382758ygrp-msg
p#yiv5519382758attach-count span {color:#1E66AE;font-weight:700;}#yiv5519382758
#yiv5519382758ygrp-reco #yiv5519382758reco-head
{color:#ff7900;font-weight:700;}#yiv5519382758 #yiv5519382758ygrp-reco
{margin-bottom:20px;padding:0px;}#yiv5519382758 #yiv5519382758ygrp-sponsor
#yiv5519382758ov li a {font-size:130%;text-decoration:none;}#yiv5519382758
#yiv5519382758ygrp-sponsor #yiv5519382758ov li
{font-size:77%;list-style-type:square;padding:6px 0;}#yiv5519382758
#yiv5519382758ygrp-sponsor #yiv5519382758ov ul {margin:0;padding:0 0 0
8px;}#yiv5519382758 #yiv5519382758ygrp-text {font-family:Georgia;}#yiv5519382758
#yiv5519382758ygrp-text p {margin:0 0 1em 0;}#yiv5519382758
#yiv5519382758ygrp-text tt {font-size:120%;}#yiv5519382758
#yiv5519382758ygrp-vital ul li:last-child {border-right:none
!important;}#yiv5519382758
Reply by "hpo...@yahoo.com [avrclub]"●January 15, 20162016-01-15
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?