Skip to content

Navigation Menu

Sign in
Sign up

Where can I find the documentation for tuner.softPwm #21

Answered by Dlloydev
alextrical asked this question in Q&A
Discussion options

Good Morning,
I'm hoping that someone can help point me in the right direction for the configuration definition for this project's "softPwm"

Looking in the examples I see the following "tuner.softPwm(relayPin, Input, Output, 0, outputSpan, 1);"

I'm trying to understand what this is doing.
The "relayPin" makes sense that this is the Hardware pin on the MCU
"Input" not quite so clear, why does this need to know the PID input?
"Output" This looks to be the value desired to be set as the output signal when mapped to the next 2 following values
"0" looks to be the minimum map value, i.e. 0%
"outputSpan" looks to be the maximum map value, i.e.100%
"1" not a clue what this is for,

Kind regards
Alex

You must be logged in to vote

I'll be adding documentation later this year after the next sTune and QuickPID update. Right now, softPwm is a function in sTune that is called by QuickPID.

Here's the header for the softPwm function:
float softPwm(const uint8_t relayPin, float input, float output, float setpoint = 0, uint32_t windowSize = 1000, uint8_t debounce = 0);

The last parameter is for setting the debounce value in milliseconds.

  • Use debounce=0 if using an SSR. In this case, sTune can optimize the output to keep tighter regulation when the input is near or at the setpoint.
  • Use debounce=1 if using the output with a MOSFET or transistor (this is set to 1 in your example)
  • If using a mechanical relay, you can use a hi...

Replies: 1 comment

Comment options

I'll be adding documentation later this year after the next sTune and QuickPID update. Right now, softPwm is a function in sTune that is called by QuickPID.

Here's the header for the softPwm function:
float softPwm(const uint8_t relayPin, float input, float output, float setpoint = 0, uint32_t windowSize = 1000, uint8_t debounce = 0);

The last parameter is for setting the debounce value in milliseconds.

  • Use debounce=0 if using an SSR. In this case, sTune can optimize the output to keep tighter regulation when the input is near or at the setpoint.
  • Use debounce=1 if using the output with a MOSFET or transistor (this is set to 1 in your example)
  • If using a mechanical relay, you can use a higher debounce setting i.e 50 ms

windowSize sets the softPwm period (ms). Defaults to 1000 ms (1-sec) ... in your example, this is called outputSpan
input is used when using SSRs so that the output can be optimized (tighter regulation) when the input is at or near the setpoint.

softPwm uses the PID input when using solid state relays (SSR).

setpoint In your example, 0 is the setpoint.

You must be logged in to vote
0 replies
Answer selected by alextrical
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /