Browse Source

wrong ldr lux-calc (see Excel sheet, mixed x y )

tags/v1.0.0
Dominik Bartsch 3 years ago
parent
commit
0cd46a3c9f
3 changed files with 5 additions and 4 deletions
  1. 3
    2
      lib/treppe/treppe.cpp
  2. 2
    2
      lib/treppe/treppe.h
  3. BIN
      misc/LDR-Regression.xlsx

+ 3
- 2
lib/treppe/treppe.cpp View File

= 37280.00/analogRead(A0) = 37280.00/analogRead(A0)
ldr_ohm = R(LDR) 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) ldr_value = E(LDR)
*/ */
float ldr_ohm = 37280.00 / analogRead(A0); 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; return ldr_value;
} }



+ 2
- 2
lib/treppe/treppe.h View File



// #define LDRDEBUG // comment in to override LDR measurement // #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_OBEN 16
#define SENSOR_UNTEN 12 #define SENSOR_UNTEN 12
uint16_t idle_pwm_internal = 0; uint16_t idle_pwm_internal = 0;
uint16_t active_pwm = 700; 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 start_pwm = 0;
uint16_t ziel_pwm = 0; uint16_t ziel_pwm = 0;

BIN
misc/LDR-Regression.xlsx View File


Loading…
Cancel
Save