ArdyNT
Full Member level 2
- Joined
- Nov 6, 2012
- Messages
- 126
- Helped
- 7
- Reputation
- 14
- Reaction score
- 7
- Trophy points
- 1,298
- Activity points
- 2,304
Need Help: Displaying AVR ADC value in LUX on the LCD
The following equation is derived from the datasheet of photo-resistor:
It clearly shows the relation between RESISTANCE and LUX, NOT relation between ADC and LUX
My problem is how do I use this equation in my code so I can change the 10bit ADC value of my avr into LUX.
I got confuse since the ADC value is not equal to the resistance, right?
Here is part of my code (codevisionavr):
Thanks..
The following equation is derived from the datasheet of photo-resistor:
E[lux] = 10000 / (R[kΩ]*10)^(4/3)
It clearly shows the relation between RESISTANCE and LUX, NOT relation between ADC and LUX
My problem is how do I use this equation in my code so I can change the 10bit ADC value of my avr into LUX.
I got confuse since the ADC value is not equal to the resistance, right?
Here is part of my code (codevisionavr):
Code:
while (1)
{
ldr1=read_adc(0); // [I][COLOR="#00FF00"]I need it to be LUX, help me to modify it[/COLOR][/I]
lcd_gotoxy(0,0);
sprintf(buf,"L1:%d%d%d%d",ldr1/1000,(ldr1%1000)/100,(ldr1%1000%100)/10,ldr1%1000%100%10);
lcd_puts(buf);
ldr2=read_adc(1);
lcd_gotoxy(9,0);
sprintf(buf,"L2:%d%d%d%d",ldr2/1000,(ldr2%1000)/100,(ldr2%1000%100)/10,ldr2%1000%100%10);
lcd_puts(buf);
}
Thanks..
Last edited: