new ldr algo
This commit is contained in:
parent
ca938ef3dd
commit
937f7f09e7
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user