====== Cooling Fan ======
===== Introduction =====
This page introduces the [[https://www.khadas.com/product-page/3705-cooling-fan | Cooling Fan]]. The first section describes how to control the fan on Ubuntu, and the second section describes how to control it on Android.
===== Ubuntu =====
This setting is only applicable to 4.9, 5.15, 5.4, and 6.1 linux kernel
==== Fan Application ====
This method is recommended if you are using a desktop OS. Find ''Fan Setting'' in the applications list. Open the app to control the cooling fan speed.
{{/products/sbc/common/accessories/gnome_application_fan.png|gnome_application_fan}}
==== Command Line ====
You can also use commands to control the fan from the terminal.
=== Set the fan mode ===
^ fan mode ^ command ^
| off | ''fan.sh off'' |
| on | ''fan.sh on'' |
| auto | ''fan.sh auto'' |
=== Get the fan mode ===
```shell
fan.sh mode
```
=== Set the fan speed ===
^ fan speed ^ command ^
| high | ''fan.sh high'' |
| mid | ''fan.sh mid'' |
| low | ''fan.sh low'' |
=== Get CPU temperature ===
```shell
fan.sh temp
```
=== Get and Set the trigger temperature ===
You can read the trigger temperature from the following nodes:
^ fan mode ^ trigger temp parameter ^
| low | ''/sys/class/fan/trigger_temp_low'' |
| mid | ''/sys/class/fan/trigger_temp_mid'' |
| high | ''/sys/class/fan/trigger_temp_high'' |
Example: Get the low trigger temperature:
```shell
cat /sys/class/fan/trigger_temp_low
```
Example: Set the low trigger temperature to ''40'' Celsius.
```shell
echo 40 | sudo tee /sys/class/fan/trigger_temp_low
```
The trigger temperature only affects the fan when it is in auto mode.
=== Mainline linux ===
The fan is controlled automatically by the Linux thermal subsystem. Temperatures are in millidegrees Celsius.
Example: Get the auto trigger temperature:
```
cat /sys/class/thermal/thermal_zone0/trip_point_3_temp
```
Example: set the auto trigger temp to 40000 millicelcius
```
echo 40000 | sudo tee /sys/class/thermal/thermal_zone0/trip_point_3_temp
```
To turn the fan off, set the trigger temperature to a higher value (e.g., 80000). \\
To turn the fan on, set the trigger temperature to a lower value (e.g., 10000).
===== Android =====
Check system settings to control the fan.