temp: Increase filter time
Increase the filter constant to 100s to smoothen the signal a lot. For online viewing, this is quite nice, but for acquisition, we should probably look at the raw data...
This commit is contained in:
parent
12753d93fb
commit
670576abf8
|
@ -19,11 +19,12 @@ THERMISTOR_R25 = 10e3
|
|||
THERMISTOR_RINF = THERMISTOR_R25 * math.exp(-THERMISTOR_BETA / 298.15)
|
||||
|
||||
# Filter constant in seconds
|
||||
FILTER_RC = 1
|
||||
FILTER_RC = 100
|
||||
FILTER_A = 1 / ADC_RATE / (FILTER_RC / 1 / ADC_RATE)
|
||||
|
||||
temperature_filtered = 25
|
||||
last_report = time.ticks_ms()
|
||||
temperature_filtered = -1
|
||||
# Ignore the first 5 seconds
|
||||
last_report = time.ticks_ms() + 5000
|
||||
while True:
|
||||
raw_value = cs1237.read()
|
||||
value = float(raw_value) / (2**24 - 1)
|
||||
|
@ -35,6 +36,9 @@ while True:
|
|||
|
||||
temperature = THERMISTOR_BETA / math.log(value / THERMISTOR_RINF) - 273.15
|
||||
|
||||
if temperature_filtered == -1:
|
||||
temperature_filtered = temperature
|
||||
|
||||
temperature_filtered = (
|
||||
temperature_filtered * (1 - FILTER_A) + temperature * FILTER_A
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue