Compare commits
2 Commits
a8def64601
...
a0f4c25a53
Author | SHA1 | Date |
---|---|---|
interfisch | a0f4c25a53 | |
interfisch | 8cf4395827 |
12
include/ec.h
12
include/ec.h
|
@ -52,14 +52,16 @@ float ec25; //ec value but temperature adjusted for 25 degC
|
||||||
|
|
||||||
float ec_tempadjust_alpa=0.02;
|
float ec_tempadjust_alpa=0.02;
|
||||||
float ec_reference_adc=6016.88; //adc reference value for the calibration resistor measurement.
|
float ec_reference_adc=6016.88; //adc reference value for the calibration resistor measurement.
|
||||||
//EC short circuit adc value: 17497 (for connection restistance testing)
|
//EC short circuit adc value: 17497, 17861.4 (for connection resistance testing)
|
||||||
//EC open circuit adc value: 738
|
//EC open circuit adc value: 738, 730, 737.27
|
||||||
|
|
||||||
//x^0*p[0] + ... + x^n*p[n]
|
//x^0*p[0] + ... + x^n*p[n]
|
||||||
//float ec_calibration_polynom[]={691.5992624638029,-1.4015367296761692,0.0008513503472324141,-2.2140576823179093e-07,2.8962580780180067e-11,-1.8577565383307114e-15,4.7162479484903865e-20};
|
//float ec_calibration_polynom[]={691.5992624638029,-1.4015367296761692,0.0008513503472324141,-2.2140576823179093e-07,2.8962580780180067e-11,-1.8577565383307114e-15,4.7162479484903865e-20};
|
||||||
float ec_calibration_polynom[]={1033.928052655456,-3.8909104921922895,0.005627541436014758,-4.103988840997024e-06,1.7231981870816133e-09,-4.433707707721975e-13,7.203892111369395e-17,-7.406549810844244e-21,4.667420606439905e-25,-1.6439457516812463e-29,2.477292190335455e-34};
|
//float ec_calibration_polynom[]={1033.928052655456,-3.8909104921922895,0.005627541436014758,-4.103988840997024e-06,1.7231981870816133e-09,-4.433707707721975e-13,7.203892111369395e-17,-7.406549810844244e-21,4.667420606439905e-25,-1.6439457516812463e-29,2.477292190335455e-34}; //20220505
|
||||||
float ec_calibration_linearize_below_adc=0; //use linear approximation below this adc value. 0=disable
|
float ec_calibration_polynom[]={-323.68589929771457,0.5836096440900665,-0.000279737392438965,5.98673062873e-08,-5.4460235093798435e-12,1.8535134644431135e-16}; //20230509
|
||||||
float ec_calibration_linear_lowADC=830; //x0
|
//float ec_calibration_polynom[]={212.6826331524675,-0.6043878865263305,0.000571551634082491,-1.827897106718841e-07,2.682337041246909e-11,-1.8368511021965982e-15,4.8269168538877025e-20}; //20230509 manuell
|
||||||
|
float ec_calibration_linearize_below_adc=6500; //use linear approximation below this adc value. 0=disable
|
||||||
|
float ec_calibration_linear_lowADC=746; //x0
|
||||||
float ec_calibration_linear_lowEC=0; //y0
|
float ec_calibration_linear_lowEC=0; //y0
|
||||||
|
|
||||||
bool ec_measurementReady();
|
bool ec_measurementReady();
|
||||||
|
|
|
@ -6,20 +6,28 @@
|
||||||
#define HCSR04_PIN_ECHO 17
|
#define HCSR04_PIN_ECHO 17
|
||||||
#define HCSR04_PIN_TRIGGER 16
|
#define HCSR04_PIN_TRIGGER 16
|
||||||
#define HCSR04_TIMEOUT 5000 //default is 100000 (uS)
|
#define HCSR04_TIMEOUT 5000 //default is 100000 (uS)
|
||||||
#define READINTERVAL_HCSR04 500
|
#define READINTERVAL_HCSR04 200
|
||||||
|
|
||||||
#define WATERLEVELMEAN_SIZE 32
|
#define WATERLEVELMEAN_SIZE 32
|
||||||
|
#define WATERLEVELMEAN_FILTER_CUTOFF 8 //max value is around WATERLEVELMEAN_SIZE/2
|
||||||
float waterlevelMean_array[WATERLEVELMEAN_SIZE];
|
float waterlevelMean_array[WATERLEVELMEAN_SIZE];
|
||||||
uint16_t waterlevelMean_array_pos=0;
|
uint16_t waterlevelMean_array_pos=0;
|
||||||
#define WATERLEVEL_UNAVAILABLE -1
|
#define WATERLEVEL_UNAVAILABLE -1
|
||||||
float waterlevel=WATERLEVEL_UNAVAILABLE;
|
float waterlevel=WATERLEVEL_UNAVAILABLE; //distance from floor to water surface [mm]
|
||||||
|
float watervolume=WATERLEVEL_UNAVAILABLE; //calculated Volume in Reservoir
|
||||||
|
|
||||||
uint16_t waterlevel_failcounter=0;
|
uint16_t waterlevel_failcounter=0;
|
||||||
#define WATERLEVEL_MAXFAILS 15 //maximum counter value
|
#define WATERLEVEL_MAXFAILS 15 //maximum counter value
|
||||||
#define WATERLEVEL_FAILTHRESHOLD 10 //if failcounter is greater or equal this value waterlevel will not be valid
|
#define WATERLEVEL_FAILTHRESHOLD 10 //if failcounter is greater or equal this value waterlevel will not be valid
|
||||||
|
|
||||||
|
//Calibration
|
||||||
|
float waterlevel_calib_offset_measured=0; //Sollwert
|
||||||
|
float waterlevel_calib_offset_sensor=178.67; //Istwert
|
||||||
|
|
||||||
float waterlevel_distanceToVolume(float distance);
|
float waterlevel_calib_reservoirArea=27*36.5; //area in cm^2
|
||||||
|
|
||||||
|
|
||||||
|
float waterlevel_heightToVolume(float distance);
|
||||||
|
|
||||||
|
|
||||||
void waterlevel_setup() {
|
void waterlevel_setup() {
|
||||||
|
@ -62,16 +70,20 @@ void waterlevel_loop(unsigned long loopmillis) {
|
||||||
|
|
||||||
|
|
||||||
if (isValueArrayOKf(waterlevelMean_array,WATERLEVELMEAN_SIZE,WATERLEVEL_UNAVAILABLE)){
|
if (isValueArrayOKf(waterlevelMean_array,WATERLEVELMEAN_SIZE,WATERLEVEL_UNAVAILABLE)){
|
||||||
float _distance=getFilteredf(waterlevelMean_array,WATERLEVELMEAN_SIZE,8);
|
//float _distance=getFilteredf(waterlevelMean_array,WATERLEVELMEAN_SIZE,WATERLEVELMEAN_FILTER_CUTOFF);
|
||||||
|
float _distance=getMaxf(waterlevelMean_array,WATERLEVELMEAN_SIZE);
|
||||||
|
|
||||||
waterlevel=waterlevel_distanceToVolume(_distance);
|
//Invert distance and offset
|
||||||
|
waterlevel=distance-(waterlevel_calib_offset_sensor+waterlevel_calib_offset_measured);
|
||||||
|
watervolume=waterlevel_heightToVolume(_distance);
|
||||||
|
|
||||||
//float _meanWaterlevel=getMeanf(waterlevelMean,WATERLEVELMEAN_SIZE);
|
//float _meanWaterlevel=getMeanf(waterlevelMean,WATERLEVELMEAN_SIZE);
|
||||||
//Serial.print("\t Dist="); Serial.print(_filteredWaterlevel); Serial.print("mm"); Serial.print("(+- "); Serial.print((getMaxf(waterlevelMean,WATERLEVELMEAN_SIZE)-getMinf(waterlevelMean,WATERLEVELMEAN_SIZE))/2.0); Serial.print(")"); Serial.print(" [mean="); Serial.print(_meanWaterlevel); Serial.print("]");
|
//Serial.print("\t Dist="); Serial.print(_filteredWaterlevel); Serial.print("mm"); Serial.print("(+- "); Serial.print((getMaxf(waterlevelMean,WATERLEVELMEAN_SIZE)-getMinf(waterlevelMean,WATERLEVELMEAN_SIZE))/2.0); Serial.print(")"); Serial.print(" [mean="); Serial.print(_meanWaterlevel); Serial.print("]");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (waterlevel_failcounter>=WATERLEVEL_FAILTHRESHOLD) { //too many failed readings
|
if (waterlevel_failcounter>=WATERLEVEL_FAILTHRESHOLD) { //too many failed readings
|
||||||
waterlevel=-1;
|
waterlevel=WATERLEVEL_UNAVAILABLE;
|
||||||
|
watervolume=WATERLEVEL_UNAVAILABLE;
|
||||||
/*if (debug) {
|
/*if (debug) {
|
||||||
Serial.print("Waterlevel Failcounter="); Serial.println(waterlevel_failcounter);
|
Serial.print("Waterlevel Failcounter="); Serial.println(waterlevel_failcounter);
|
||||||
}*/
|
}*/
|
||||||
|
@ -80,8 +92,8 @@ void waterlevel_loop(unsigned long loopmillis) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float waterlevel_distanceToVolume(float distance){
|
float waterlevel_heightToVolume(float distance){
|
||||||
return distance;
|
return waterlevel_calib_reservoirArea/100 * distance/100; //area[cm^2] in dm^2 * height in dm = dm^3= L
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -0,0 +1,32 @@
|
||||||
|
time,tempReservoir,ECadcCalib,ECadc,ECadcAdjusted
|
||||||
|
101268,21.37,6017.88,8057.05,8055.72
|
||||||
|
131325,21.44,6017.71,8031.89,8030.79
|
||||||
|
161382,21.49,6017.91,8021.16,8019.78
|
||||||
|
191439,21.54,6017.82,8007.08,8005.83
|
||||||
|
221496,21.59,6017.95,7988.33,7986.92
|
||||||
|
251553,21.63,6018.17,7974.48,7972.76
|
||||||
|
281610,21.69,6018.26,7966.37,7964.54
|
||||||
|
311667,21.75,6018.71,7956.08,7953.66
|
||||||
|
341724,21.80,6018.76,7946.59,7944.11
|
||||||
|
371781,21.84,6018.63,7940.63,7938.31
|
||||||
|
401838,21.88,6018.53,7938.66,7936.48
|
||||||
|
431895,21.94,6018.41,7951.11,7949.08
|
||||||
|
461952,22.00,6018.60,7933.68,7931.41
|
||||||
|
492009,22.01,6018.60,7924.54,7922.27
|
||||||
|
522066,22.06,6018.66,7916.94,7914.60
|
||||||
|
552123,22.12,6018.75,7911.43,7908.97
|
||||||
|
582180,22.15,6018.97,7906.98,7904.23
|
||||||
|
612237,22.19,6019.16,7904.89,7901.90
|
||||||
|
642294,22.25,6018.83,7899.79,7897.24
|
||||||
|
672351,22.27,6018.82,7898.05,7895.50
|
||||||
|
702408,22.31,6018.77,7896.98,7894.51
|
||||||
|
732465,22.37,6018.59,7890.25,7888.01
|
||||||
|
762522,22.38,6018.69,7884.41,7882.04
|
||||||
|
792579,22.44,6018.36,7880.67,7878.73
|
||||||
|
822636,22.45,6018.04,7875.55,7874.03
|
||||||
|
852693,22.50,6018.09,7872.04,7870.46
|
||||||
|
882750,22.55,6018.07,7868.66,7867.10
|
||||||
|
912807,22.56,6018.48,7865.01,7862.92
|
||||||
|
942864,22.62,6018.35,7862.13,7860.21
|
||||||
|
972921,22.63,6018.74,7857.67,7855.24
|
||||||
|
1002978,22.69,6018.77,7858.07,7855.60
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
ecMeasured,time,tempReservoir,ECadcCalib,ECadc,ECadcAdjusted
|
||||||
|
0,488810,25,6018.5,749.49,749.29
|
||||||
|
0,500924,25,6018.5,749.85,749.65
|
||||||
|
0,512968,25,6018.5,750.33,750.13
|
||||||
|
470,607166,25,6018.38,6631.48,6629.84
|
||||||
|
475,618283,25,6018.38,6632.4,6630.75
|
||||||
|
480,630263,25,6018.38,6657.02,6655.37
|
||||||
|
960,728530,25,6018.48,9028.83,9026.44
|
||||||
|
965,739728,25,6018.48,9038.25,9035.85
|
||||||
|
970,751586,25,6018.48,9085.94,9083.53
|
||||||
|
1290,845876,25,6018.53,9975.25,9972.51
|
||||||
|
1300,857889,25,6018.53,9956.18,9953.44
|
||||||
|
1310,869129,25,6018.53,10024.26,10021.51
|
||||||
|
3070,979125,25,6019,12369.85,12365.49
|
||||||
|
3070,991238,25,6019,12391.81,12387.44
|
||||||
|
3070,1003282,25,6019,12429.84,12425.47
|
||||||
|
3620,1065510,25,6018.74,12577.39,12573.5
|
||||||
|
3620,1079543,25,6018.86,12796.35,12792.14
|
||||||
|
3620,1091656,25,6018.86,12823.02,12818.81
|
||||||
|
30,1184837,25,6019.05,928.33,928
|
||||||
|
30,1196950,25,6019.05,928.99,928.66
|
||||||
|
30,1208340,25,6019.05,923.8,923.46
|
||||||
|
380,1309239,25,6019.18,5713.99,5711.81
|
||||||
|
380,1321252,25,6019.18,5718.64,5716.45
|
||||||
|
380,1333296,25,6019.18,5738.1,5735.91
|
||||||
|
710,1405519,25,6018.48,7862.59,7860.49
|
||||||
|
710,1417563,25,6018.48,7861.14,7859.04
|
||||||
|
710,1429607,25,6018.48,7859.18,7857.09
|
||||||
|
1460,1488823,25,6018.43,10252.78,10250.14
|
||||||
|
1460,1500836,25,6018.43,10266.79,10264.14
|
||||||
|
1460,1511972,25,6018.43,10278.46,10275.82
|
||||||
|
1960,1579122,25,6019.31,11072.54,11068.06
|
||||||
|
1960,1596158,25,6019.48,11143.74,11138.92
|
||||||
|
1960,1608171,25,6019.48,11162.37,11157.55
|
||||||
|
2510,1661293,25,6019.38,11800.73,11795.82
|
||||||
|
2510,1673306,25,6019.38,11757.97,11753.08
|
||||||
|
2510,1684573,25,6019.38,11810.64,11805.73
|
||||||
|
2840,1734501,25,6019.07,12125.58,12121.17
|
||||||
|
2840,1746521,25,6019.07,12137.02,12132.61
|
||||||
|
2840,1758704,25,6019.07,12165.2,12160.77
|
||||||
|
3550,1821882,25,6018.94,12486.45,12482.18
|
||||||
|
3550,1834006,25,6018.94,12587.85,12583.54
|
||||||
|
3550,1845173,25,6018.94,12597,12592.7
|
||||||
|
4220,1916439,25,6018.58,12688.82,12685.24
|
||||||
|
4220,1928281,25,6018.58,12911.29,12907.65
|
||||||
|
4220,1940325,25,6018.58,12946.13,12942.48
|
||||||
|
5320,2164675,25,6018.38,13294.82,13291.5
|
||||||
|
5320,2175910,25,6018.38,13343.59,13340.26
|
||||||
|
5320,2187810,25,6018.38,13220.96,13217.66
|
|
Binary file not shown.
|
@ -0,0 +1,36 @@
|
||||||
|
ecMeasured,time,tempReservoir,ECadcCalib,ECadc,ECadcAdjusted
|
||||||
|
0,975348,24.75,6018.3,746.44,746.26
|
||||||
|
0,986521,24.76,6018.3,746.37,746.19
|
||||||
|
30,1058510,24.92,6018.8,883.8,883.52
|
||||||
|
50,1093614,24.97,6018.78,1363.18,1362.75
|
||||||
|
70,1125783,25.02,6018.88,1707.09,1706.52
|
||||||
|
90,1167844,25.09,6018.88,2146.24,2145.53
|
||||||
|
110,1211926,25.14,6018.93,2568.53,2567.65
|
||||||
|
150,1258010,25.19,6018.48,3231.4,3230.54
|
||||||
|
200,1307192,25.25,6018.39,3838.19,3837.22
|
||||||
|
310,1349294,25.31,6018.68,4956.19,4954.71
|
||||||
|
440,1398370,25.37,6018.42,6031.16,6029.62
|
||||||
|
440,1410383,25.37,6018.42,6037.3,6035.75
|
||||||
|
440,1453556,25.4,6018.02,6045.55,6044.4
|
||||||
|
440,1477695,25.44,6018.08,6048.88,6047.68
|
||||||
|
440,1519863,25.46,6017.67,6053.23,6052.44
|
||||||
|
510,1576045,25.5,6018.12,6531.07,6529.73
|
||||||
|
690,1669283,25.56,6018.22,7520.7,7519.03
|
||||||
|
810,1706446,25.57,6018.15,8065.97,8064.27
|
||||||
|
970,1750616,25.62,6018.21,8635.71,8633.8
|
||||||
|
1180,1791783,25.62,6018.56,9272.33,9269.74
|
||||||
|
1320,1899035,25.69,6018.59,9622.38,9619.66
|
||||||
|
1470,1948148,25.69,6018.4,9947.52,9945.01
|
||||||
|
1730,2020229,25.69,6018.11,10444.77,10442.64
|
||||||
|
1910,2055333,25.69,6018.3,10763.83,10761.28
|
||||||
|
2090,2163536,25.75,6018.43,10937.14,10934.32
|
||||||
|
2320,2207599,25.75,6018.02,11288.6,11286.47
|
||||||
|
2560,2290827,25.75,6018.48,11569.56,11566.47
|
||||||
|
2900,2332985,25.75,6018.8,11867.85,11864.05
|
||||||
|
3250,2422120,25.75,6017.84,12148.5,12146.55
|
||||||
|
3900,2478252,25.75,6018.16,12552.99,12550.31
|
||||||
|
4500,2535336,25.73,6018.65,12893.54,12889.75
|
||||||
|
5240,2579418,25.69,6018.27,13288.07,13284.99
|
||||||
|
5940,2612489,25.69,6018.07,13470.15,13467.48
|
||||||
|
6020,2652655,25.69,6018.21,13508.16,13505.17
|
||||||
|
7230,2744804,25.67,6018.02,13771.93,13769.33
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
EC Peaktech neu kalibriert
|
||||||
|
Lösung laut https://www.researchgate.net/profile/Sameer-Sayyad-2/post/How-is-it-possible-to-convert-conductivity-of-NaCl-solution-in-uS-to-its-salinity-NaCl-concentration-in-ppm/attachment/5abdeaedb53d2f63c3c2e08c/AS%3A609786693443585%401522395885345/download/conductivity+vs+concentration+NaCl+25+degress.pdf
|
||||||
|
3g NaCl auf 1L H2O = 5690 uS/cm @ 25°C
|
||||||
|
Also 7,5g auf 0,25L H2O
|
||||||
|
Dann 100mL davon mit 900mL H2O auf 1L auffüllen.
|
||||||
|
|
||||||
|
|
||||||
|
Messwertkalibrierung DIY EC Messgerät:
|
||||||
|
Open EC Sensor:
|
||||||
|
time,tempReservoir,ECadcCalib,ECadc,ECadcAdjusted
|
||||||
|
125483,21.06,6018.22,737.27,737.11
|
||||||
|
187583,21.12,6018.63,737.87,737.65
|
||||||
|
288741,21.19,6018.19,738.09,737.93
|
||||||
|
300754,21.23,6018.19,738.04,737.88
|
||||||
|
312798,21.29,6018.19,737.98,737.82
|
||||||
|
minimum adc raw=737.27
|
||||||
|
|
||||||
|
Shorted EC Sensor:
|
||||||
|
time,tempReservoir,ECadcCalib,ECadc,ECadcAdjusted
|
||||||
|
363992,21.44,6018.52,17411.64,17406.89
|
||||||
|
396062,21.50,6018.48,17411.45,17406.83
|
||||||
|
407198,21.51,6018.48,17861.44,17856.70
|
||||||
|
433216,21.56,6018.52,17381.09,17376.37
|
||||||
|
444363,21.56,6018.52,14442.77,14438.85
|
||||||
|
516433,21.62,6018.45,17450.95,17446.39
|
||||||
|
527600,21.62,6018.45,17861.36,17856.70
|
||||||
|
539591,21.64,6018.45,17860.74,17856.07
|
||||||
|
550857,21.66,6018.45,17861.28,17856.61
|
||||||
|
maximum adc raw=17861.44
|
||||||
|
|
||||||
|
ca. 300mL dest. Wasser in 500mL Becherglas auf Magnetrührer
|
||||||
|
Wasser temperiert auf 25°C und durchgehend temperatur gehalten
|
||||||
|
Temperatursensor und DIY EC-Probe in Flüssigkeit gehalten
|
||||||
|
EC Sensor in Flüssigkeit zur Referenzmessung
|
||||||
|
Magnetrührer auf langsamer Stufe (keine Strudelbildung)
|
||||||
|
Messwert per Tastendruck erfasst (time,tempReservoir,ECadcCalib,ECadc,ECadcAdjusted)
|
||||||
|
zeit
|
||||||
|
temperatur d. flüssigkeit
|
||||||
|
referenz adc wert (geschalteter fester widerstand statt probe)
|
||||||
|
Roher ADC Messwert
|
||||||
|
angepasster ADC Messwert (linear gemappt nach abweichung vom referenz adc wert, referenz adc wert vorher ermittelt und eingegeben in code)
|
||||||
|
|
||||||
|
manuell abgelesen: EC wert
|
||||||
|
|
||||||
|
Erster Messwert nur dest. Wasser.
|
||||||
|
Weitere Messwerte jew. nach hinzufügen erst wenigen tropfen NaCl Lösung. Später mehr bis zu 10mL pro Messung.
|
||||||
|
|
||||||
|
Bläschen an Elektroden durch pusten entfernt wenn sie sich gebildet haben
|
||||||
|
|
||||||
|
Werte in 20230509_NaCl_raw.csv bzw auswertung in ..ods
|
||||||
|
|
||||||
|
Polynom x. Grades erstellt mit python approximate.py
|
||||||
|
polynom in c++ code übernommen und punktuelle ergebnisse aus adc zu ec funktion ausgegeben und geplottet zur kontrolle, ob rechnung funktioniert.
|
||||||
|
|
||||||
|
Dauermessung:
|
||||||
|
Start bei EC 980 laut EC Meter
|
||||||
|
bei 972921 EC 940 laut EC Meter
|
||||||
|
Bläschenbildung an elektroden. Werte nicht genau!
|
||||||
|
|
||||||
|
|
||||||
|
Temperaturabhängigkeit: TODO
|
||||||
|
NaCl Lösung auf etwa 1500uS/cm angemischt
|
||||||
|
Im Eiswasserbad gekühlt
|
||||||
|
Auf Magnetrührer platziert mit Temperatur und Diy EC-Probe
|
||||||
|
Kontinuierlich (alle 30s) messwerte aufgezeichnet
|
||||||
|
Bläschenbildung an den Elektroden ab etwa 34°C
|
||||||
|
Werte in 20230505_NaCl_temperature.csv
|
||||||
|
|
||||||
|
t=99s: start bei 10.9°C (EC messgerät) (8.5°C laut DS18B20) EC=1364uS/cm (EC messgerät)
|
||||||
|
t=219s: erster korrekter calib wert. EC Messgerät: 1416uS/cm @11.4C
|
||||||
|
t=851s: 1443uS @15.6°C
|
||||||
|
t=1423s: 1553uS @25,3°C
|
||||||
|
t=1513s: blaeschen entfernt von ec probe
|
||||||
|
|
||||||
|
ab 30°C viele bläschen
|
Binary file not shown.
|
@ -8,7 +8,7 @@ import matplotlib.pyplot as plt
|
||||||
from pandas import *
|
from pandas import *
|
||||||
|
|
||||||
# reading CSV file
|
# reading CSV file
|
||||||
data = read_csv("20230505_NaCl_optimized.csv")
|
data = read_csv("20230509_NaCl_raw.csv")
|
||||||
|
|
||||||
# converting column data to list
|
# converting column data to list
|
||||||
#solutionAdded = data['solutionAdded'].tolist() #in ml
|
#solutionAdded = data['solutionAdded'].tolist() #in ml
|
||||||
|
@ -68,7 +68,7 @@ xmodel = np.arange(xstart,xstop,increment)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for model_order in [9,10,11]:
|
for model_order in [3,4,5,6]:
|
||||||
print("model order="+str(model_order))
|
print("model order="+str(model_order))
|
||||||
# Finding the Model
|
# Finding the Model
|
||||||
p = np.polyfit(x, y, model_order)
|
p = np.polyfit(x, y, model_order)
|
||||||
|
|
37
src/main.cpp
37
src/main.cpp
|
@ -82,7 +82,7 @@ void setup() {
|
||||||
|
|
||||||
|
|
||||||
//Serial.println("time,tempReservoir,ECadcCalib,ECadc,ECadcAdjusted,EC,EC25");
|
//Serial.println("time,tempReservoir,ECadcCalib,ECadc,ECadcAdjusted,EC,EC25");
|
||||||
//Serial.println("time,tempReservoir,ECadcCalib,ECadc,ECadcAdjusted,sm");
|
Serial.println("time,tempReservoir,ECadcCalib,ECadc,ECadcAdjusted");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,11 +100,31 @@ void loop() {
|
||||||
sm_loop(loopmillis);
|
sm_loop(loopmillis);
|
||||||
|
|
||||||
|
|
||||||
|
static bool getReading=false;
|
||||||
|
|
||||||
if (!digitalRead(PIN_BUTTON)) {
|
if (!digitalRead(PIN_BUTTON)) {
|
||||||
|
last_check=loopmillis;
|
||||||
valueError=false;
|
valueError=false;
|
||||||
Serial.println("Reset ValueError flag by user");
|
//Serial.println("Reset ValueError flag by user");
|
||||||
digitalWrite(PIN_LED,valueError);
|
//digitalWrite(PIN_LED,valueError);
|
||||||
delay(100);
|
delay(100);
|
||||||
|
last_measurement_ec=0; //force reading
|
||||||
|
getReading=true;
|
||||||
|
ec_flag_measurement_available=false;
|
||||||
|
digitalWrite(PIN_LED,HIGH);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ec_flag_measurement_available && getReading) {
|
||||||
|
ec_flag_measurement_available=false;
|
||||||
|
getReading=false;
|
||||||
|
digitalWrite(PIN_LED,LOW);
|
||||||
|
Serial.print(loopmillis); Serial.print(",");
|
||||||
|
Serial.print(tempCmean_reservoir); Serial.print(",");
|
||||||
|
Serial.print(ec_calib_adc); Serial.print(",");
|
||||||
|
Serial.print(ec_adc); Serial.print(",");
|
||||||
|
Serial.print(ec_adc_adjusted);
|
||||||
|
Serial.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loopmillis>last_check+2000) { //check values
|
if (loopmillis>last_check+2000) { //check values
|
||||||
|
@ -181,11 +201,12 @@ void loop() {
|
||||||
Serial.print(ec25);
|
Serial.print(ec25);
|
||||||
Serial.println();
|
Serial.println();
|
||||||
|
|
||||||
Serial.print("Waterlevel="); Serial.print(waterlevel);
|
Serial.print("Waterlevel distance,volume = "); Serial.print(waterlevel); Serial.print(","); Serial.print(watervolume);
|
||||||
|
if (waterlevel_failcounter>0) {
|
||||||
|
Serial.print(" fails="); Serial.print(waterlevel_failcounter);
|
||||||
|
}
|
||||||
Serial.println();
|
Serial.println();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -252,7 +273,5 @@ void loop() {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TODO:
|
TODO:
|
||||||
- waterlevel nur -1
|
- recalibrate EC. Note min max (shorted, open) values. Test screw terminal connection. Recalibrate EC Probe.
|
||||||
- waterlevel distance to volume fukntion
|
|
||||||
- soilmoisture min max calibartion einfügen
|
|
||||||
*/
|
*/
|
Loading…
Reference in New Issue