filter esr

This commit is contained in:
Matthew Kennedy 2021-06-03 20:50:39 -07:00
parent 646638d367
commit 6238eed3e3
2 changed files with 10 additions and 3 deletions

View File

@ -41,9 +41,13 @@ static void SamplingThread(void*)
float r2_opposite_phase = (r_1 + r_3) / 2;
// Compute AC (difference) and DC (average) components
nernstAc = f_abs(r2_opposite_phase - r_2);
float nernstAcLocal = f_abs(r2_opposite_phase - r_2);
nernstDc = (r2_opposite_phase + r_2) / 2;
nernstAc =
(1 - ESR_SENSE_ALPHA) * nernstAc +
ESR_SENSE_ALPHA * nernstAcLocal;
// Exponential moving average (aka first order lpf)
pumpCurrentSenseVoltage =
(1 - PUMP_FILTER_ALPHA) * pumpCurrentSenseVoltage +

View File

@ -15,6 +15,9 @@
#define ESR_SUPPLY_R (22000)
#define VM_RESISTOR_VALUE (10)
// Heater low pass filter
#define ESR_SENSE_ALPHA (0.002f)
// *******************************
// Pump current sense
// *******************************
@ -25,8 +28,8 @@
#define LSU_SENSE_R (61.9f)
// Pump low pass filter alpha
// sampling at 2.5khz, alpha of 0.1 gives about 42hz bandwidth
#define PUMP_FILTER_ALPHA (0.1f)
// sampling at 2.5khz, alpha of 0.01 gives about 50hz bandwidth
#define PUMP_FILTER_ALPHA (0.02f)
// *******************************
// Pump controller