8000 PID Fan Control by WantClue · Pull Request #800 · bitaxeorg/ESP-Miner · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

PID Fan Control #800

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

Merged
merged 15 commits into from
Apr 7, 2025
Merged

PID Fan Control #800

merged 15 commits into from
Apr 7, 2025

Conversation

WantClue
Copy link
Collaborator

adds a PID controller

@WantClue WantClue added the enhancement New feature or request label Mar 29, 2025
@WantClue WantClue added this to the v2.6.1 milestone Mar 29, 2025
@mutatrum
Copy link
Collaborator

IMO it would be safer to also keep the existing automatic fan control, and add a dropdown for which fan control algo to use, until we have enough testing data. There are so many different fan setups, heatsinks and environments out there, it would be a miracle if this works immediately on all devices.

pid_set_sample_time(&pid, POLL_RATE - 1);
pid_set_output_limits(&pid, 35, 100);
pid_set_mode(&pid, AUTOMATIC);
pid_set_controller_direction(&pid, REVERSE);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need these two controls? AUTOMATIC/MANUAL and DIRECT/REVERSE? They're only set once and with a hardcoded setting. Might as well just yank them, or are there plans to re-use the PID class for other things as well and we want to keep a more general version?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • AUTOMATIC mode:

The PID controller continuously calculates the output based on the current input, setpoint, and tuning parameters. It actively adjusts the output to minimize the error.

  • MANUAL mode:

The PID controller stops automatic adjustments. The output is either fixed or controlled externally. This is useful for tuning, testing, or when you want to override the PID temporarily.

  • DIRECT:

An increase in input (e.g., temperature) causes an increase in output (e.g., fan speed).

Use this when the output should move in the same direction as the error.

  • REVERSE:

An increase in input causes a decrease in output.

Use this when the output should move in the opposite direction of the error.

It is possible to add a dynamically mode change to it maybe in the future, I'm peeking into auto tuning functionallity. Therefore I would leave it in here for now

@mutatrum mutatrum changed the title Pid controller PID Fan Control Mar 30, 2025
@NilByte
Copy link
NilByte commented Apr 2, 2025

Please consider making the target temperature configurable instead of fixed 60°C.

If you underclock you may wish to set a target temperature of 45°C and if you overclock a target temperature 70°C may be reasonable compared to the THROTTLE_TEMP 75°C.

@mutatrum
Copy link
Collaborator
mutatrum commented Apr 3, 2025

I'm running this on both my Gamma and Supra, the Gamma stays at 35% and 55°, the Supra at 100% and 65°. So not really a proper test, maybe later today when it gets warmer here I get more feedback.

Agree with a configurable setpoint.

@WantClue
Copy link
Collaborator Author
WantClue commented Apr 4, 2025

Please consider making the target temperature configurable instead of fixed 60°C.

If you underclock you may wish to set a target temperature of 45°C and if you overclock a target temperature 70°C may be reasonable compared to the THROTTLE_TEMP 75°C.

I will add the configureable setpoint

@WantClue
Copy link
Collaborator Author
WantClue commented Apr 4, 2025

IMO it would be safer to also keep the existing automatic fan control, and add a dropdown for which fan control algo to use, until we have enough testing data. There are so many different fan setups, heatsinks and environments out there, it would be a miracle if this works immediately on all devices.

The plan is to test this extensivley and integrate this into 2.6.3 if this is save to use

@MaSe-Time
Copy link

This is exciting to see my idea take shape 😬.

Running it on my three today so should see it adjust as the temperatures rise. For me I'd like to see the minimum fan speed be reduced to 20% though as when ambient is cool as per my image, 35% isn't low enough.

Screenshot_20250405_062605_Chrome

@MaSe-Time
Copy link

My three ran perfectly yesterday ran upto 100% fan speed as ambient rose and back down to 35% through the evening.

I'd very much like the lower end fan threshold to be around 20% though. 👍

@mutatrum
Copy link
Collaborator
mutatrum commented Apr 6, 2025

Is there a reason low end can't be 0%?

@MaSe-Time
Copy link

Is there a reason low end can't be 0%?

Someone mentioned somewhere that not all fans modulate down to that level so if 15% was called for example the fan would actually stop but I don't see that as much of an issue as if the fan did stop the temp would rise and trigger it to start again at what ever level it works at.

I'd prefer 0% to be honest as when I've been manually adjusting mine I sometimes need 9%.

@mutatrum
Copy link
Collaborator
mutatrum commented Apr 6, 2025

The fan on the supra I have only starts spinning at ~10%. On restart it takes a bit to get the temperature right, it overshoots about 5C until it comes back down to the set point:

image

Maybe a more advanced way would be to do a calibration run on startup, see what the RPM curve is over the fan percentage, and then steer the PID based on desired RPM instead of fan percentage?

@WantClue
Copy link
Collaborator Author
WantClue commented Apr 6, 2025

Is there a reason low end can't be 0%?

No there is no reason why it can't be 0, I set it to 15 now I feel uncomfortable setting it all the way to 0. I think even a bit air flow shall exist.