# Fan speed controller with custom speed curve

**URL:** <https://community.frame.work/t/fan-speed-controller-with-custom-speed-curve/17208>\
**Category:** Linux\
**Created:** [April 4, 2022, 10:41am UTC](https://community.frame.work/t/fan-speed-controller-with-custom-speed-curve/17208 "2022-04-04T10:41:45Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![jean](https://avatars.discourse-cdn.com/v4/letter/j/fbc32d/32.png) [@jean](https://community.frame.work/u/jean)\
**Post date:** [April 4, 2022, 10:41am UTC](https://community.frame.work/t/fan-speed-controller-with-custom-speed-curve/17208/1 "2022-04-04T10:41:45Z")

</div>

I was a bit annoyed by the noise of my FrameWork laptop’s fan, which was spinning way too fast for my taste, so I’ve written a little script to fix that over the weekend.

You can find it here: [GitHub - TamtamHero/fw-fanctrl: A simple systemd service to better control Framework Laptop's fan(s)](https://github.com/TamtamHero/fw-fanctrl)  
There’s a bash script to install it as a service / uninstall it. I’ve only tested it on Ubuntu 20.04 but I think it should work on other distributions as well.

Feel free to improve it and push PRs, the script is very small (~100 lines of Python) and can be perfected/ made more customizable.

It’s based on the great work done by DHowett: [GitHub - DHowett/framework-ec: Embedded Controller firmware for the Framework Laptop](https://github.com/DHowett/fw-ectool)

---

<div class="post-metadata">

**Author:** ![NM64](https://sea1.discourse-cdn.com/flex001/user_avatar/community.frame.work/nm64/32/6624_2.png) [@NM64](https://community.frame.work/u/NM64)\
**Post date:** [April 5, 2022, 5:45am UTC](https://community.frame.work/t/fan-speed-controller-with-custom-speed-curve/17208/2 "2022-04-05T05:45:09Z")

</div>

Question: I see that your default configuration has a minimum speed of “15” - does setting this value to “0” actually properly turn the fan completely off without causing other issues? (e.g. the fan not getting stuck in the “0” speed state when under load when the script is configured that the fan should turn back on at higher temps)

Also, with Ubuntu 22.04 (not a typo) imminent, do you think you could quickly test it with the beta?

> **[Ubuntu 22.04 LTS (Jammy Jellyfish) Beta](https://releases.ubuntu.com/jammy/)**
>
> CD images for Ubuntu 22.04 LTS (Jammy Jellyfish) Beta

And if you don’t already know about Ventoy, then I highly recommend using it to make your life easier when it comes to booting Linux ISOs:

[https://ventoy.net](https://ventoy.net)

---

<div class="post-metadata">

**Author:** ![jean](https://avatars.discourse-cdn.com/v4/letter/j/fbc32d/32.png) [@jean](https://community.frame.work/u/jean)\
**Post date:** [April 5, 2022, 8:50am UTC](https://community.frame.work/t/fan-speed-controller-with-custom-speed-curve/17208/3 "2022-04-05T08:50:21Z")

</div>

I confirm that there is no issue using the “0” value for the fan, it goes to 0 and is able to go back to higher values without a problem.  
You can use this command to try a particular speed %:  
`sudo ectool --interface=lpc fanduty <percentage>`

And then you can check the actual fan speed in RPM with:  
`sudo ectool --interface=lpc pwmgetfanrpm`

I’ll try on 22.04 later, didn’t know ventoy it looks nice, I usually use Etcher but it formats the key beforehand, which is sometimes annoying

Edit: tried on 22.04, and `lm-sensors` is not available to install via `apt`, no idea why  
It’s possible to install it manually but I haven’t got the time to try it yet

---

<div class="post-metadata">

**Author:** ![dgquintas](https://sea1.discourse-cdn.com/flex001/user_avatar/community.frame.work/dgquintas/32/4038_2.png) [@dgquintas](https://community.frame.work/u/dgquintas)\
**Post date:** [April 5, 2022, 6:41pm UTC](https://community.frame.work/t/fan-speed-controller-with-custom-speed-curve/17208/4 "2022-04-05T18:41:46Z")

</div>

Thank you @jean for this, and for pointing me in the direction of fw-ectool!

I have a small side question: on Arch, installing [the `fw-ectool-git` package](https://aur.archlinux.org/packages/fw-ectool-git) works fine, producing the `ectool` binary as expected. However, passing in `--interface=lpc` _prevents_ things from working (as opposed to not specifying any value for `--interface`, or using `--interface=fwk` which doesn’t seem to be documented by works, added [here](https://github.com/DHowett/fw-ectool/commit/4cd223f7825367c2d630923e4adeb6dd4eb39088)):

```auto
$ sudo ectool --interface=lpc fanduty 0
Missing Chromium EC memory map.
Unable to establish host communication
Couldn't find EC

```

It’s just interesting that `lpc` works for you but not for me, given that we are both on a Framework laptop? Again, **everything works fine for me if I avoid specifying `lpc`** , I’m just curious why we see different behavior on the same(?) hardware. Perhaps we are using different version of `ectool`?

---

<div class="post-metadata">

**Author:** ![jean](https://avatars.discourse-cdn.com/v4/letter/j/fbc32d/32.png) [@jean](https://community.frame.work/u/jean)\
**Post date:** [April 5, 2022, 7:15pm UTC](https://community.frame.work/t/fan-speed-controller-with-custom-speed-curve/17208/5 "2022-04-05T19:15:59Z")

</div>

Indeed !  
It still works for me when removing the interface parameter, my mistake.  
I can’t remember why I came to the conclusion that this parameter was required, but it clearly isn’t 😆  
I’ve updated the repo (along with a new feature, `Strategies`).  
Thanks @dgquintas !

As of why does it work fine on ubuntu with `--interface=lpc` and not on Arch, I have no answer. Not very willing to dig but if someone knows, please let us know 🤓

---

<div class="post-metadata">

**Author:** ![iamef](https://avatars.discourse-cdn.com/v4/letter/i/f0a364/32.png) [@iamef](https://community.frame.work/u/iamef)\
**Post date:** [April 6, 2022, 2:53am UTC](https://community.frame.work/t/fan-speed-controller-with-custom-speed-curve/17208/6 "2022-04-06T02:53:20Z")

</div>

I made this account just to thank you for this. I was almost going to return my framework because the fans were wayy too loud and I couldn’t concentrate on my work because of them.

---

<div class="post-metadata">

**Author:** ![BenVosper](https://sea1.discourse-cdn.com/flex001/user_avatar/community.frame.work/benvosper/32/8244_2.png) [@BenVosper](https://community.frame.work/u/BenVosper)\
**Post date:** [April 22, 2022, 10:32am UTC](https://community.frame.work/t/fan-speed-controller-with-custom-speed-curve/17208/7 "2022-04-22T10:32:41Z")

</div>

This is amazing work @jean ! Thanks for sharing. This thread should be pinned somewhere for visibility! I’d agree that the default fan curve seems overly aggressive.

My only suggestion for potential improvement would be a slow ramp up / down when a new target fan value is set. Would just be slightly nicer sound-wise. But I understand would make the code more complex when we can only set discrete values through `ectool`.

Do you have an idea of how frequently it’s possible to update the duty value using `ectool`? Could it be done multiple times per second for example? Not sure if this would have performance implications. This is interesting actually, I might have a play!

---

<div class="post-metadata">

**Author:** ![jean](https://avatars.discourse-cdn.com/v4/letter/j/fbc32d/32.png) [@jean](https://community.frame.work/u/jean)\
**Post date:** [April 22, 2022, 10:56am UTC](https://community.frame.work/t/fan-speed-controller-with-custom-speed-curve/17208/8 "2022-04-22T10:56:52Z")

</div>

Thanks @BenVosper !

You can get a slower ramp up by increasing the `MovingAverageInterval` parameter in your config.  
For ramp down however, the script takes the minimum temperature between average temp and current temp, so it’s an instant change in fan speed whenever the cpu load decrease suddenly.  
To make the ramp down just as smooth as the ramp up, you can remove these 2 lines: [fw-fanctrl/fanctrl.py at main · TamtamHero/fw-fanctrl · GitHub](https://github.com/TamtamHero/fw-fanctrl/blob/main/fanctrl.py#L35-L36)  
and replace them with this:

```auto
currentTemp = self.getMovingAverageTemperature(self.movingAverageInterval)

```

If this new behavior works for you, feel free to make it configurable, PRs are welcomed 😃

About `ectool`, it’s a very lightweight program so there won’t be performance implications if you trigger it frequently, but I don’t think that the fan itself can mechanically react to more than 1 request/sec. Not 100% sure about it though, let me know if you fiddle with it and find something interesting !

---

<div class="post-metadata">

**Author:** ![Jan-Eric\_Schafrich](https://avatars.discourse-cdn.com/v4/letter/j/71e660/32.png) [@Jan-Eric\_Schafrich](https://community.frame.work/u/Jan-Eric_Schafrich)\
**Post date:** [August 22, 2022, 9:20am UTC](https://community.frame.work/t/fan-speed-controller-with-custom-speed-curve/17208/9 "2022-08-22T09:20:56Z")

</div>

I created an [updated version](https://github.com/Centurio-Macro/fw-fanctrl.git) of TamtamHeros fw-fanctrl which enables automatic switching between two custom fan curves depending on if the laptop is charging or discharging. I created a pull request for this. Until its merged into the original fw-fanctrl the updated version is available in my GitHub repository.

The current charging status of the laptop is read from the following file:  
`/sys/class/hwmon/hwmon2/device/status`  
On my Framework Laptop running Pop OS 22.04 this works. I don’t know yet if this path works for all Framework Laptops on all Linux distributions. So any feedback is appreciated.

---

<div class="post-metadata">

**Author:** ![jean](https://avatars.discourse-cdn.com/v4/letter/j/fbc32d/32.png) [@jean](https://community.frame.work/u/jean)\
**Post date:** [October 20, 2022, 2:36pm UTC](https://community.frame.work/t/fan-speed-controller-with-custom-speed-curve/17208/10 "2022-10-20T14:36:41Z")

</div>

I’ve just published an update which allows to change the strategy more easily: you can now type `fw-fanctrl lazy` or `fw-fanctrl medium` or any other strategy available in the config file without having to mess with the running service.

> <https://github.com/TamtamHero/fw-fanctrl/pull/7>
>
> User can now run \`fw-fanctrl strategyName\` to temporarily change the strategy to… \`strategyName\`.
> The strategy defined in the config file will be used again after restarting the service.

To get it, you can just pull the latest `main` and run the install script again.

---

<div class="post-metadata">

**Author:** ![jean](https://avatars.discourse-cdn.com/v4/letter/j/fbc32d/32.png) [@jean](https://community.frame.work/u/jean)\
**Post date:** [October 28, 2022, 10:24pm UTC](https://community.frame.work/t/fan-speed-controller-with-custom-speed-curve/17208/11 "2022-10-28T22:24:44Z")

</div>

Nice feature/bugfix from @emrebicer: [Fans keep working after suspend · Issue #6 · TamtamHero/fw-fanctrl · GitHub](https://github.com/TamtamHero/fw-fanctrl/issues/6)  
If you’re living like me in a cold/temperate country and you don’t do heavy computation, you might have not noticed it but the fan was not actually stopped by fw-fanctrl when going to sleep. Now it is 🙂

---

<div class="post-metadata">

**Author:** ![jean](https://avatars.discourse-cdn.com/v4/letter/j/fbc32d/32.png) [@jean](https://community.frame.work/u/jean)\
**Post date:** [November 7, 2022, 10:30am UTC](https://community.frame.work/t/fan-speed-controller-with-custom-speed-curve/17208/12 "2022-11-07T10:30:24Z")

</div>

Fix from @Gronkdalonka for 12th gen intel CPUs: [Fix core temp reading for 12th gen by Gronkdalonka · Pull Request #10 · TamtamHero/fw-fanctrl · GitHub](https://github.com/TamtamHero/fw-fanctrl/pull/10)

---

<div class="post-metadata">

**Author:** ![not\_a\_feature](https://avatars.discourse-cdn.com/v4/letter/n/ce7236/32.png) [@not\_a\_feature](https://community.frame.work/u/not_a_feature)\
**Post date:** [June 8, 2023, 11:01am UTC](https://community.frame.work/t/fan-speed-controller-with-custom-speed-curve/17208/13 "2023-06-08T11:01:53Z")

</div>

I’ve extended the great work of @jean with an cinnamon applet make the switch between strategies easier.

### Framework FanCTRL - Fan Strategy Control Applet for Cinnamon

[This applet](https://github.com/not-a-feature/fw_fanctrl_applet) allows you to control the fan speed strategies of Framework laptops directly from your desktop. It uses [fw-fanctrl](https://github.com/TamtamHero/fw-fanctrl) / framework-ec to select different fan speed strategies.

 ![applet view](https://us1.discourse-cdn.com/flex001/uploads/framework3/original/2X/3/33aba913498d4a0a6add68d6b5792f4c38da86b7.png) ![settings view](https://us1.discourse-cdn.com/flex001/uploads/framework3/original/2X/d/d2ca88e37d648259d11e056c7cae29a95f51ddaa.png)

### Installation

Make sure [fw-fanctrl](https://github.com/TamtamHero/fw-fanctrl) is installed.

##### Via Cinnamon Applet Store

```
- Right click on the menu bar.
- Open "Applets".
- Click on "Download" tab.
- Search for "FanCTRL".
- Click on the install icon next to the applet name.

```

The applet should now be available in your Applets settings panel. Add it to your panel to start using it.

#### Via Git

Clone the git repository:

```
git clone https://github.com/not-a-feature/fw_fanctrl_applet

```

Copy the applet to your local Cinnamon applets directory:

```
cp -r fw_fanctrl_applet/files/* ~/.local/share/cinnamon/applets/

```

The applet should now be available in your Applets settings panel. Add it to your panel to start using it.

### License

```auto
Copyright (C) 2023 by Jules Kreuer - @not_a_feature
This piece of software is published unter the GNU General Public License v3.0

```

Go to [LICENSE.md](https://github.com/not-a-feature/fw_fanctrl_applet/blob/main/LICENSE) to see the full version.

---

<div class="post-metadata">

**Author:** ![jean](https://avatars.discourse-cdn.com/v4/letter/j/fbc32d/32.png) [@jean](https://community.frame.work/u/jean)\
**Post date:** [March 12, 2024, 8:10am UTC](https://community.frame.work/t/fan-speed-controller-with-custom-speed-curve/17208/14 "2024-03-12T08:10:57Z")

</div>

Following the release of Framework’s 16" laptop, I’ve been working on an update of fw-fanctrl to add support for AMD CPUs and also for dGPU.

I don’t have a 16/dGPU, and the person who helped me (thanks @hasecris !) has a 16 but no dGPU. It would be nice to have a dGPU owner try the update a bit before I release it. Here’s the PR with preliminary support: [Add AMD/16" support by TamtamHero · Pull Request #21 · TamtamHero/fw-fanctrl · GitHub](https://github.com/TamtamHero/fw-fanctrl/pull/21)  
Feedback can be given on this issue: [[Feature] Support for Framework 16 · Issue #20 · TamtamHero/fw-fanctrl · GitHub](https://github.com/TamtamHero/fw-fanctrl/issues/20)

Edit: merged  
Edit2: new update to fix 13" AMD

---

<div class="post-metadata">

**Author:** ![Lupin](https://avatars.discourse-cdn.com/v4/letter/l/5e9695/32.png) [@Lupin](https://community.frame.work/u/Lupin)\
**Post date:** [April 26, 2024, 6:37am UTC](https://community.frame.work/t/fan-speed-controller-with-custom-speed-curve/17208/15 "2024-04-26T06:37:47Z")

</div>

Any application to control the fans in Windows?

---

<div class="post-metadata">

**Author:** ![TomsonTom](https://sea1.discourse-cdn.com/flex001/user_avatar/community.frame.work/tomsontom/32/24523_2.png) [@TomsonTom](https://community.frame.work/u/TomsonTom)\
**Post date:** [April 26, 2024, 9:09am UTC](https://community.frame.work/t/fan-speed-controller-with-custom-speed-curve/17208/16 "2024-04-26T09:09:01Z")

</div>

It shouldn’t be that hard to make the code run on Windows using ectool, but you will need to disable secure boot to install the EC driver, which is the biggest problem. Otherwise, what would need to change in the source code is the whole running-as-a-service part and checking for temperatures (but you could also call ectool to get the temperatures).

---

<div class="post-metadata">

**Author:** ![Lupin](https://avatars.discourse-cdn.com/v4/letter/l/5e9695/32.png) [@Lupin](https://community.frame.work/u/Lupin)\
**Post date:** [April 26, 2024, 9:31am UTC](https://community.frame.work/t/fan-speed-controller-with-custom-speed-curve/17208/17 "2024-04-26T09:31:09Z")

</div>

Thanks for the reply. How do I disable secure boot?

---

<div class="post-metadata">

**Author:** ![Joaquin\_Ayuso\_de\_Pau](https://sea1.discourse-cdn.com/flex001/user_avatar/community.frame.work/joaquin_ayuso_de_pau/32/4557_2.png) [@Joaquin\_Ayuso\_de\_Pau](https://community.frame.work/u/Joaquin_Ayuso_de_Pau)\
**Post date:** [June 1, 2024, 3:21pm UTC](https://community.frame.work/t/fan-speed-controller-with-custom-speed-curve/17208/18 "2024-06-01T15:21:14Z")

</div>

For those who use gnome-shell, I made this simple extension to manage fw-fanctrl modes:

> **[GitHub - joax/fw-fanctrl-gnome-shell-extension: Gnome Shell extension to manage fw-fanctrl -...](https://github.com/joax/fw-fanctrl-gnome-shell-extension)**
>
> Gnome Shell extension to manage fw-fanctrl - Framework Laptop Fan Control

 ![image](https://us1.discourse-cdn.com/flex001/uploads/framework3/original/3X/7/e/7efec6be91fe424ee932346279bee7135530203b.png)

**Requisites**  
You need to have [fw-fanctrl](https://github.com/TamtamHero/fw-fanctrl) installed.

---

<div class="post-metadata">

**Author:** ![Joaquin\_Ayuso\_de\_Pau](https://sea1.discourse-cdn.com/flex001/user_avatar/community.frame.work/joaquin_ayuso_de_pau/32/4557_2.png) [@Joaquin\_Ayuso\_de\_Pau](https://community.frame.work/u/Joaquin_Ayuso_de_Pau)\
**Post date:** [June 3, 2024, 8:19pm UTC](https://community.frame.work/t/fan-speed-controller-with-custom-speed-curve/17208/19 "2024-06-03T20:19:33Z")

</div>

If you want to install it directly, here is the gnome-shell extensions link:  
[https://extensions.gnome.org/extension/7053/fw-fanctrl/](https://extensions.gnome.org/extension/7053/fw-fanctrl/)

---

<div class="post-metadata">

**Author:** ![Wai](https://sea1.discourse-cdn.com/flex001/user_avatar/community.frame.work/wai/32/26423_2.png) [@Wai](https://community.frame.work/u/Wai)\
**Post date:** [June 6, 2024, 2:30am UTC](https://community.frame.work/t/fan-speed-controller-with-custom-speed-curve/17208/20 "2024-06-06T02:30:12Z")

</div>

Made a general purpose tray icon ui that should work on any DE over here,

> **[GitHub - waicool20/fw-fanctrl-ui: Tray Icon UI for the tool @...](https://github.com/waicool20/fw-fanctrl-ui)**
>
> Tray Icon UI for the tool @ https://github.com/TamtamHero/fw-fanctrl/

It’s available on AUR for arch linux users

[Next page](https://community.frame.work/t/fan-speed-controller-with-custom-speed-curve/17208.md?page=2)
