Skip to content

Question: Sample Time #16

@lbussy

Description

@lbussy

Background:

  • I am using this for a slow-acting temperature control system. It will take minutes for the system to react.
  • The temperature sensors sample once every 10 seconds (these are DS18B20 sensors so not incredibly granular).
  • I am using that to feed a circularbuffer<5> and my temperature reading is the average of that buffer.

tl;dr my &Input is a 60-second average.

Further: My current efforts have QuickPID loop() every X seconds based on Arduino's Ticker.

I suspect that your code is intended to sample temperatures over time, taking action when sampleTimeUs expires. If I'm correct, my circular buffer and Ticker are redundant to the QuickPID functions, and I could eliminate those and just run QuickPid::Compute() in my main::loop(). Right so far?

I "need" the running average to smooth out the UI, so I'll keep that no matter what.

So all that to set up my question: Should I use the average for %Input and QuickPID::SetSampleTimeUs() to something like 10 seconds and call QuickPID::Compute() every second or so? I'm leaning that way (or even longer periods) because of the slow-acting time of the system.

OR

Should I use the current "live" temperature reading, a more frequent loop, and a longer sampleTimeUs time?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions