Академический Документы
Профессиональный Документы
Культура Документы
Working Procedures:
Fig.1. An Light dependent resistor is connected in series with a 10K fixed resistance
Data table:1
Lux (y) Vsensor (X) Lux (Y) Vsensor (x)
80 2.39 320 3.58
100 2.5 490 3.8
100 2.56 800 3.9
140 2.94 560 3.943
200 3.25 670 4.2
230 3.29 890 4.25
250 3.45 1020 4.3
Vsensor is then converted to the value of lux according to the sensitivity of Calibrated
Ldr.
= . − + − ; , =
Instrumentation:
The output voltage from the sensor is converted to a 8-bit digital number using the
internal ADC of the PIC 16F73. Vref is Vdd, and the ADC is 8 -bit. So, any input voltage from 0-
5 volt will be mapped to a digital number between 0-255. The resolution of ADC is 5/255
=19.6 mV/Count (step size of Quantization). Therefore, the digital output corresponding to
any input voltage Vin (binary) = Vin/19.6 mV.
Code:
void Display()
{
Lcd_init();
Lcd_Cmd(_LCD_CLEAR);
Lcd_cmd(_LCD_CURSOR_OFF);
if(vd!=0)
{
Lcd_out(1,1,"Intesity in lux");
Lcd_out(2,12,"Lux");
floattostr(vd,txt);
Lcd_out(2,1,txt);
}
}
void main()
{
ADCON1=0b00000000; // configure - - - - - 000
trisa=0b11111111; // All pins of port A are declared as i/p
Lcd_init();
Lcd_Cmd(_LCD_CLEAR);
Lcd_cmd(_LCD_CURSOR_OFF);
Lcd_out(1,1," LUX METER ");
while(1)
{
v = ADC_Read(0); //Digital level count, read from RA0
va=(v*4.9)/255; //analog voltage read, multiplying digital
level with resolution, Vref=4.9V
if(va>2)
{
vd=(174.4*va*va*va)-(1403*va*va)+(3862*va)-3500;
//Fitted curve, vd is lux
}
else
vd=0;
Display(); //Display Function call and return values
Delay_ms(200);
}
}
Report Submission:
Submit a printed copy of mini report (not more than 6 pages)
including all working steps, figures, tables, explanations and
equations along with the photocopy of raw files of class work and
home work attached in back.