I have been trying to figure out the Vref for the voltage reading, but my results do not match the default application.
What is the PF3 output voltage and its output impedance? Am I doing somethin else wrong?
My formula are (8-bit conversion):
LDR-branch:
Rl=3300*(1+adc_value/(adc_value+0xff))
NTC-branch:
Rn=100000*(1+adc_value/(adc_value+0xff))
Both branches in parallel:
R=(Rl*Rn)/(rl+Rn)
PF3 output 3V
PF3 impedance (resistance)
Vcc=2.7V, Vout 2.3V, I=-5mA
(2.7 -2.3)/0.005 = 58 Ohm
My calculations give:
adc_valLDR adc_valNTC AREF
0 0 2.947
255 0 2.964
0 255 2.947
255 255 2.964
In the BF application code:
... // Find Vref for (i=0; i<=22; i++) { // mt if (ADCresult <= LIGHT_ADC[i]) if (ADCresult <= pgm_read_word(&LIGHT_ADC[i])) { break; } } if(!i) // if it's very bright Vref = 2.815; else if(i > 21) Vref = 2.942; // if it's totally dark else // mt: Vref = LIGHT_VOLTAGE[i]; // mt using helper from pgmspacehlp.h - new code Vref = pgm_read_float_hlp(&LIGHT_VOLTAGE[i]);
I also tried some other interpretations of the output voltages and output impedances of PF3, but didn´t get very close. The default application has much wider variation of the AREF-voltage than I can get.
[edit]:
I know the default application is concerned only with LDR and considers the effect of NTC to AREF-voltage as negligible, but my LDR calculations still don´t match.