new ldr algo

This commit is contained in:
2021-07-25 17:05:14 +02:00
parent ca938ef3dd
commit 937f7f09e7
2 changed files with 7 additions and 2 deletions
+6 -1
View File
@@ -169,8 +169,13 @@ float Treppe::read_ldr() {
E(LDR) = 6526.5 / (R(LDR)^2)
ldr_value = E(LDR)
*/
float ldr_ohm = 37280.00 / analogRead(A0);
//float ldr_ohm = 37280.00 / analogRead(A0);
float voltage = analogRead(A0)*0.0036;
float ldr_ohm = 40.57*(3.3-voltage)/voltage;
float ldr_value = 6526.6 / (ldr_ohm * ldr_ohm);
#ifdef LDRDEBUG
Serial.printf("Ohm: %f lux: %f\n", ldr_ohm,ldr_value);
#endif
return ldr_value;
}
+1 -1
View File
@@ -6,7 +6,7 @@
#include <EEPROM.h>
// #define LDRDEBUG // comment in to override LDR measurement
#define LDR_HYS 1 // Hysteresis for switching off FSM [lux]
#define LDR_HYS 5 // Hysteresis for switching off FSM [lux]
#define SENSOR_OBEN 16
#define SENSOR_UNTEN 12