diff --git a/calibration/20180413_calibration.csv b/calibration/20180413_calibration.csv index 2a5bfb1..2dfa1f4 100644 --- a/calibration/20180413_calibration.csv +++ b/calibration/20180413_calibration.csv @@ -1,43 +1,90 @@ -low;high;Fstop;Shutter;EV -3924;2779;5.6;0.001;14.936637939 -;;;; -3778;2142;5.6;0.003125;13.2927817492 -3732;1992;5.6;0.004;12.936637939 -3833;2357;5.6;0.002;13.936637939 -3790;2188;5.6;0.0025;13.6147098441 -3747;2039;5.6;0.003125;13.2927817492 -3737;2014;5.6;0.004;12.936637939 -3575;1588;5.6;0.00625;12.2927817492 -3497;1437;5.6;0.008;11.936637939 -3441;1342;5.6;0.01;11.6147098441 -3360;1224;5.6;0.0125;11.2927817492 -3042;876;2.8;0.005;10.6147098441 -3018;849;2.8;0.005;10.6147098441 -3094;921;5.6;0.0166666667;10.8777442499 -2930;786;5.6;0.0222222222;10.4627067507 -2787;689;5.6;0.0333333333;9.8777442499 -2485;538;5.6;0.04;9.6147098441 -2318;464;2.8;0.0125;9.2927817492 -2032;367;2.8;0.02;8.6147098441 -1866;315;2.8;0.025;8.2927817492 -1524;230;2.8;0.04;7.6147098441 -1135;157;2.8;0.0769230769;6.6712933725 -1064;144;2.8;0.125;5.9708536543 -857;113;2.8;0.125;5.9708536543 -1045;142;2.8;0.1666666667;5.5558161551 -965;129;2.8;0.1666666667;5.5558161551 -673;87;2.8;0.2;5.2927817492 -514;64;2.8;0.3;4.7078192485 -381;49;2.8;0.8;3.2927817492 -405;53;2.8;0.8;3.2927817492 -340;44;2.8;1.3;2.5923420311 -282;39;2.8;1.6;2.2927817492 -288;40;2.8;2.5;1.6489255595 -267;36;2.8;3.2;1.2927817492 -266;36;2.8;4;0.9708536543 -262;36;2.8;5;0.6489255595 -245;34;2.8;6;0.3858911536 -225;32;2.8;10;-0.3510744405 -233;33;2.8;15;-0.9360369413 -219;31;2.8;20;-1.3510744405 -217;30;2.8;25;-1.6730025354 +low;high;Fstop;Shutter;EV; +4057;3730;16;0.0005;18.9657842847; +4056;3719;16;0.0005;18.9657842847; +4047;3639;16;0.000625;18.6438561898; +4053;3705;16;0.0008;18.2877123795; +4036;3534;16;0.00125;17.6438561898; +4027;3486;16;0.00125;17.6438561898; +4020;3423;16;0.002;16.9657842847; +4018;3407;16;0.002;16.9657842847; +4010;3347;16;0.0025;16.6438561898; +4009;3338;16;0.0025;16.6438561898; +3983;3149;16;0.004;15.9657842847; +3972;3070;16;0.004;15.9657842847; +3965;3033;16;0.005;15.6438561898; +3965;3022;16;0.005;15.6438561898; +3924;2779;5.6;0.001;14.936637939; +3911;2711;16;0.0090909091;14.7813597135; +3865;2493;5.6;0.0015625;14.2927817492; +3834;2354;16;0.0142857143;14.1292830169;brett +3808;2301;5.6;0.002;13.936637939; +3778;2142;5.6;0.003125;13.2927817492; +3732;1992;5.6;0.004;12.936637939; +3722;1964;5.6;0.004;12.936637939; +3833;2357;5.6;0.002;13.936637939; +3790;2188;5.6;0.0025;13.6147098441; +3747;2039;5.6;0.003125;13.2927817492; +3737;2014;5.6;0.004;12.936637939; +3575;1588;5.6;0.00625;12.2927817492; +3497;1437;5.6;0.008;11.936637939; +3441;1342;5.6;0.01;11.6147098441; +3366;1229;5.6;0.0125;11.2927817492; +3360;1224;5.6;0.0125;11.2927817492; +3246;1078;5.6;0.0181818182;10.7522133679;brett +3042;876;2.8;0.005;10.6147098441; +3018;849;2.8;0.005;10.6147098441; +3154;979;5.6;0.02;10.6147098441; +2930;786;5.6;0.0222222222;10.4627067507; +2787;689;5.6;0.0333333333;9.8777442499;falsch? +2485;538;5.6;0.04;9.6147098441;falsch? +2318;464;2.8;0.0125;9.2927817492;falsch? +2032;367;2.8;0.02;8.6147098441; +1866;315;2.8;0.025;8.2927817492; +1821;303;2.8;0.0333333333;7.8777442499; +1524;230;2.8;0.04;7.6147098441; +1521;233;2.8;0.05;7.2927817492; +1215;171;2.8;0.0769230769;6.6712933725;papier boden +1135;157;2.8;0.0769230769;6.6712933725; +857;113;2.8;0.125;5.9708536543; +897;119;2.8;0.1818181818;5.430285273;papier boden +673;87;2.8;0.2;5.2927817492; +927;123;2.8;0.2;5.2927817492;papier bett +768;100;2.8;0.25;4.9708536543; +671;86;2.8;0.3;4.7078192485; +514;64;2.8;0.3;4.7078192485; +580;74;2.8;0.35;4.4854268272; +514;67;2.8;0.5;3.9708536543; +502;65;2.8;0.6;3.7078192485; +381;49;2.8;0.8;3.2927817492;falsch? +405;53;2.8;0.8;3.2927817492; +467;60;2.8;0.8;3.2927817492; +404;53;2.8;1;2.9708536543; +379;51;2.8;1;2.9708536543; +399;52;2.8;1.1;2.8333501306; +398;52;2.8;1.15;2.7692197932; +340;44;2.8;1.3;2.5923420311; +325;43;2.8;1.6;2.2927817492; +282;39;2.8;1.6;2.2927817492; +312;44;2.8;2;1.9708536543; +288;40;2.8;2.5;1.6489255595; +267;36;2.8;3.2;1.2927817492; +277;36;2.8;4;0.9708536543; +266;36;2.8;4;0.9708536543; +241;33;2.8;5;0.6489255595; +262;36;2.8;5;0.6489255595; +249;35;2.8;5;0.6489255595; +245;34;2.8;6;0.3858911536; +228;34;2.8;6.4;0.2927817492; +238;33;2.8;7;0.1634987323; +228;33;2.8;8;-0.0291463457; +229;32;2.8;9;-0.1990713471; +225;32;2.8;10;-0.3510744405; +223;32;2.8;14;-0.8365012677; +233;33;2.8;15;-0.9360369413; +219;31;2.8;20;-1.3510744405; +212;31;2.8;20;-1.3510744405; +213;29;2.8;24;-1.6141088464; +217;30;2.8;25;-1.6730025354; +213;31;2.8;32;-2.0291463457; +212;30;2.8;36;-2.1990713471; +210;31;2.8;40;-2.3510744405; diff --git a/calibration/20180413_calibration.ods b/calibration/20180413_calibration.ods index 2c7a76a..a20c963 100644 Binary files a/calibration/20180413_calibration.ods and b/calibration/20180413_calibration.ods differ diff --git a/calibration/20180413_high_3coeffs_greater4.png b/calibration/20180413_high_3coeffs_greater4.png new file mode 100644 index 0000000..93495d2 Binary files /dev/null and b/calibration/20180413_high_3coeffs_greater4.png differ diff --git a/calibration/20180413_low_3coeffs_less4.png b/calibration/20180413_low_3coeffs_less4.png new file mode 100644 index 0000000..2d3374e Binary files /dev/null and b/calibration/20180413_low_3coeffs_less4.png differ diff --git a/calibration/calibration.py b/calibration/calibration.py index 2f14c89..cc2b06b 100644 --- a/calibration/calibration.py +++ b/calibration/calibration.py @@ -19,7 +19,7 @@ with open('20180413_calibration.csv', 'r') as csvfile: if len(xvalue)>0 and len(yvalue)>0 and not firstrow: xvalue=float(xvalue) yvalue=float(yvalue) - if yvalue<7.5: + if yvalue<=4: #print(""+str(xvalue)+" - "+str(yvalue)) xvalues.append(xvalue) yvalues.append(yvalue) @@ -32,6 +32,11 @@ with open('20180413_calibration.csv', 'r') as csvfile: ytest=np.polyval(coefs, xtest) #calculate y values with polynomial function #ytest=[coefs[3]+coefs[2]*pow(x,1)+coefs[1]*pow(x,2)+coefs[0]*pow(x,3) for x in xtest] + for i in range(200,4000,10): + yv=np.polyval(coefs, i) + print(str(i)+";"+str(yv)) + exit() + plt.scatter(xvalues,yvalues,s=0.25,c='g') #plot sample data plt.plot(xtest,ytest,c='r') #plot approximated curve plt.xlabel('LDR Value') diff --git a/calibration/highev_calculationtest.ods b/calibration/highev_calculationtest.ods new file mode 100644 index 0000000..2eea888 Binary files /dev/null and b/calibration/highev_calculationtest.ods differ diff --git a/calibration/lowev_calculationtest.ods b/calibration/lowev_calculationtest.ods new file mode 100644 index 0000000..c81389b Binary files /dev/null and b/calibration/lowev_calculationtest.ods differ diff --git a/lightmeter.ino b/lightmeter.ino index ca90d0f..44606f8 100644 --- a/lightmeter.ino +++ b/lightmeter.ino @@ -232,8 +232,6 @@ void setup() { debug_printreadings=true; } - - //display.drawPixel(10, 10, WHITE); } @@ -730,18 +728,22 @@ float getEV(){ if (meteringmode == METERINGMODE_REFLECTIVE){ //### SPOT //ev=map(analog_low,500, 3500 ,500, 1400)/100.0; //for testing - //first prototype - double highev=11.7400532 + 0.000216655133*analog_high + 0.00000111372253*pow(analog_high,2) + -0.000000000163800818 *pow(analog_high,3); - double lowev=-0.763427709 + 0.0138031137*analog_low + -0.00000576990095*pow(analog_low,2) + 0.000000000871611285*pow(analog_low,3); + //first prototype. + //double highev=11.7400532 + 0.000216655133*analog_high + 0.00000111372253*pow(analog_high,2) + -0.000000000163800818 *pow(analog_high,3); + //double lowev=-0.763427709 + 0.0138031137*analog_low + -0.00000576990095*pow(analog_low,2) + 0.000000000871611285*pow(analog_low,3); + + //calibration 20180413 + double highev=4.76455098 + 0.00961533698*analog_high - 0.00000399325586*pow(analog_high,2) + 0.000000000654378697 *pow(analog_high,3); + double lowev=-38.9534785 + 0.310426970*analog_low - 0.000769939297*pow(analog_low,2) + 0.000000639458491*pow(analog_low,3); - if (lowev>14){ + if (lowev>6){ _ev=highev; - }else if(lowev<12.5){ + }else if(lowev<4){ _ev=lowev; }else{ //mix of both - float mix=min(1.0, max(0.0,(lowev-12.5)/(14-12.5))); //0 to 1, 0-> use only lowev, 1-> use only highev + float mix=min(1.0, max(0.0,(lowev-4)/(6-4))); //0 to 1, 0-> use only lowev, 1-> use only highev _ev=lowev*(1-mix)+highev*mix; } }else if (meteringmode == METERINGMODE_INCIDENT){ //### INCIDENT