Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faster temperature sampling and moving average #1

Merged
merged 2 commits into from
Oct 14, 2019

Conversation

tlecomte
Copy link
Contributor

@tlecomte tlecomte commented Oct 14, 2019

There is a large noise in the temperature readings. That makes the projected temperatures unreliable.

Here we add a moving average of 10 samples on top of the temperature readings. The value of 10 is a compromise between noise and latency: ideally we would need at least 100 samples to get a nice smooth signal (according to the measurements from previous runs), but that would be too much latency: MAX6675 needs 200 ms to convert. Assuming the noise is high-frequency, averaging 10 samples should produce smoother temperature readings. The added latency is around 2 seconds, which should be ok.

The heatings controls are updated every 2 seconds. The logic is not changed.

We add an element to the serial output to log which heater has been chosen.

There is a large noise in the temperature readings. That makes the projected temperatures unreliable.

Here we add a moving average of 100 samples on top of the temperature readings. The value of 100 was found by looking at the data from previous runs. The temperature readings are done every 10 ms. Assuming the noise is high-frequency, this should produce smooth temperature readings. The added latency is no more than 1 second, which is negligible.

The heatings controls are updated every 2 seconds. The logic is not changed.

We add an element to the serial output to log which heater has been chosen.
MAX6675 needs 200 ms to convert the analog value to digital. Take that into account, increase the reading period, decrease the number of readings to be averaged.
@sdelgran sdelgran merged commit 76b2abf into sdelgran:master Oct 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants