Beryl AX cooling fan control in vanilla OpenWrt

When using vanilla OpenWrt, does the cooling fan works on a Beryl AX MT3000? What’s the GL recommendation to control the cooling fan while using vanilla OpenWrt? I’ve read about it and I saw that controlling it manually would reduce the fan’s life. I’d like to know is there’s an automatic and effective way to control it. And in case it doesn’t work I guess it can damage the router if it gets too hot.

I also have questions about how to monitor the fan speed, control it from the open OpenWrt firmware

In general, what is the fan operation algorithm? Does it work autonomously with its own temperature sensor?

On pure OpenWrt, the fan works, I can hear it when I put it to my ear

try this https://forum.gl-inet.com/t/i-found-a-way-to-set-the-gl-fan/22274

There they describe how to regulate the temperature on the official firmware and how to control the fan on pure OpenWrt?
what package should be installed for MT3000 (Beryl AX)?

root@GL-MT3000:~# opkg list-installed | grep fan
kmod-gl-sdk4-fan - 5.4.211+git-2024.274.10104-fb625f2-1
kmod-hwmon-pwmfan - 5.4.211-1

so I'd say install kmod-gl-sdk4-fan and kmod-hwmon-pwmfan

# ubus call system board
{
        "kernel": "5.15.167",
        "hostname": "BerylAX",
        "system": "ARMv8 Processor rev 4",
        "model": "GL.iNet GL-MT3000",
        "board_name": "glinet,gl-mt3000",
        "rootfs_type": "squashfs",
        "release": {
                "distribution": "OpenWrt",
                "version": "23.05.5",
                "revision": "r24106-10cc5fcd00",
                "target": "mediatek/filogic",
                "description": "OpenWrt 23.05.5 r24106-10cc5fcd00"
        }
}
root@BerylAX:/sys/class/hwmon# opkg list-installed | grep fan
kmod-hwmon-pwmfan - 5.15.167-1
root@BerylAX:/sys/class/hwmon# opkg list | grep fan|awk '{print $1}'
fish
kmod-hwmon-g762
kmod-hwmon-gpiofan
kmod-hwmon-pwmfan
mksh

How to manage it now?

for one, v24 is available, you can install that right from glinet,
I'm guessing you got it directly from openwrt?

As far as controlling the fan goes, I tested this with v24 openwrt from glinet,
you can test settings with:

/etc/init.d/gl_fan stop
gl_fan -v -t 45 -i 4 -d 20

otherwise set it persistently across reboot;

uci set glfan.@globals[0].temperature='45' #target temp in c
uci set glfan.@globals[0].integration='4' #fan ramping
uci set glfan.@globals[0].differential='20' #polling time in seconds
uci commit glfan
/etc/init.d/gl_fan restart

use a temp higher than 45 if you dont want it constantly running around 2500rpm

1 Like

You have firmware from GL.iNet v24
I want to understand how to control the fan from the stock OpenWrt firmware taken from the official website

https://firmware-selector.openwrt.org/?version=23.05.5&target=mediatek%2Ffilogic&id=glinet_gl-mt3000

If you have firmware v24 from GL.iNet
please show the output of the command
ubus call system board

and the contents of the file /etc/init.d/gl_fan
cat /etc/init.d/gl_fan

root@GL-MT3000:~# ubus call system board
{
"kernel": "5.4.211",
"hostname": "GL-MT3000",
"system": "ARMv8 Processor rev 4",
"model": "GL.iNet GL-MT3000",
"board_name": "glinet,mt3000-snand",
"release": {
"distribution": "OpenWrt",
"version": "21.02-SNAPSHOT",
"revision": "r15812+902-46b6ee7ffc",
"target": "mediatek/mt7981",
"description": "OpenWrt 21.02-SNAPSHOT

root@GL-MT3000:~# cat /etc/init.d/gl_fan
#!/bin/sh /etc/rc.common

START=99

USE_PROCD=1

PROG=/usr/bin/gl_fan

get_fan_config() {
config_get enabled $1 enabled
config_get sysfs $1 sysfs
config_get div $1 div
config_get temperature $1 temperature
config_get proportion $1 proportion
config_get integration $1 integration
config_get differential $1 differential
config_get debug $1 debug
}

start_service() {
config_load glfan
config_foreach get_fan_config globals

[ "$enabled" != "1" ] && exit
[ -n "$sysfs" ] && PROG="$PROG -T $sysfs"
[ -n "$div" ] && PROG="$PROG -D $div"
[ -n "$temperature" ] && PROG="$PROG -t $temperature"
[ -n "$proportion" ] && PROG="$PROG -p $proportion"
[ -n "$integration" ] && PROG="$PROG -i $integration"
[ -n "$differential" ] && PROG="$PROG -d $differential"
[ "$debug" = "1" ] && PROG="$PROG -v"

procd_open_instance
procd_set_param respawn
procd_set_param stderr 1
procd_set_param command $PROG
procd_close_instance

}

stop_service() {
kill -9 $(pgrep -f '/usr/bin/gl_fan') 2>/dev/null
echo 0 > /sys/class/thermal/cooling_device0/cur_state

please upload this file: /usr/bin/gl_fan

Just extract it from any firmware image you need?

I have a clean OpenWrt 23.05.5 installed + additional packages that are not in the official repository

I can simply flash 21.xx on the GL.iNet website for a couple of files
but then, when I return to 23.05.5, I will be exhausted from setting everything up again

I have not yet dealt with unpacking squashfs images

They are just tgz files, so you can unpack them using 7-Zip or tar itself.
I extract the whole files on my windows PC just in one directory, search through the path tree for whatever I need and done - really easy.

https://fw.gl-inet.com/firmware/mt3000-open/rc/openwrt-mt3000-4.6.6-op24-1014-1728893369.bin

Figured it out, and indeed 7zip unpacks the kernel and root image
the entire file system is inside root

1 Like

I don't understand which kernel module should be responsible for the fan
I'm almost sure that it is not in the stock OpenWrt firmware (from the openwrt.org website)

please show the output of the command lsmod

# cat /sys/class/thermal/cooling_device0/cur_state
2

And this path is missing, which means the module is not loaded.
/sys/class/fan/fan_speed

The official repository contains the following packages

kmod-hwmon-g762
kmod-hwmon-gpiofan
kmod-hwmon-pwmfan

But which one is suitable for Beryl AX?
I doubt it, I don't want to install everything at once

How to full disable fan on vanyl openwrt ?

OpenWrt 24.10.0 (Vanilla)

Install package

opkg update
opkg install kmod-hwmon-pwmfan

and reboot router

Disable fan

/bin/echo '0' > /sys/class/hwmon/hwmon2/pwm1_enable

Enable fan

/bin/echo '1' > /sys/class/hwmon/hwmon2/pwm1_enable

Control fan

/bin/echo '255' > /sys/class/hwmon/hwmon2/pwm1
/bin/echo '127' > /sys/class/hwmon/hwmon2/pwm1
/bin/echo '63' > /sys/class/hwmon/hwmon2/pwm1

255 = max
127 = middle
63 = minimal (silent)

2 Likes

Hi, I have a Chinese clone of GL-MT3000 (Huasifei WH3000 / Fudy MT3000) with immortalWRT 24.10.0 installed. I understand this might look totally offtop here but since the device is almost the same as Beryl AX (only 1GB of RAM and 8GB eMMC storage, everything else is the same) I am trying to be able to control it's fan. Installed kmod-hwmon-pwmfan, and rebooted, but when I try to edit /sys/class/hwmon/hwmon2/pwm1_enable it gives me a permission denied error. Maybe you know how to solve it?

Hi,

The Fudy TR3000/Huasifei WH3000 is a clone of the Cudy TR3000.

The Beryl AX only has 512mb RAM and 256 NAND.

I'd recommend posting on the actual Openwrt forum