diff --git a/lib/treppe/treppe.cpp b/lib/treppe/treppe.cpp index e8a6839..ffc518b 100644 --- a/lib/treppe/treppe.cpp +++ b/lib/treppe/treppe.cpp @@ -182,11 +182,12 @@ float Treppe::read_ldr() = 37280.00/analogRead(A0) ldr_ohm = R(LDR) - E(LDR) = 79.735 * R(LDR)^-0.498 (see Excel Regression) + E(LDR) = 6526.5 * R(LDR)^-2 (see Excel Regression) + E(LDR) = 6526.5 / (R(LDR)^2) ldr_value = E(LDR) */ float ldr_ohm = 37280.00 / analogRead(A0); - float ldr_value = 79.735 * pow(ldr_ohm, -0.498); + float ldr_value = 6526.6/(ldr_ohm*ldr_ohm); return ldr_value; } diff --git a/lib/treppe/treppe.h b/lib/treppe/treppe.h index 66016dd..b5a1093 100644 --- a/lib/treppe/treppe.h +++ b/lib/treppe/treppe.h @@ -5,7 +5,7 @@ // #define LDRDEBUG // comment in to override LDR measurement -#define LDR_HYS 5.0 // Hysteresis for switching off FSM [lux] +#define LDR_HYS 1 // Hysteresis for switching off FSM [lux] #define SENSOR_OBEN 16 #define SENSOR_UNTEN 12 @@ -21,7 +21,7 @@ private: uint16_t idle_pwm_internal = 0; uint16_t active_pwm = 700; - uint16_t ldr_schwelle = 7; // activation value for FSM [lx] + uint16_t ldr_schwelle = 2; // activation value for FSM [lx] uint16_t start_pwm = 0; uint16_t ziel_pwm = 0; diff --git a/misc/LDR-Regression.xlsx b/misc/LDR-Regression.xlsx index bb499cc..515f7c3 100644 Binary files a/misc/LDR-Regression.xlsx and b/misc/LDR-Regression.xlsx differ