I'm aware that the only officially supported OS that the PoE hat works on is Raspbian. I can confirm that both my hats work, and that the fan does switch on and off if I have Raspbian installed on the SD card the Pi is booting from.

Currently, however, I'm dong a project and I'm using Ubuntu Server 18.04 64bit, which runs fine on the Pi, and the PoE hat powers the device with no problems. Unfortunately, as the OS isn't Raspbian, the fan never spins up, so it can run a little hot. As a result, if I can get the fan to spin up, and down then that would be great. I have no problems with doing this with scripts, using crontab and inspecting the value of /sys/class/thermal/thermal_zone0/temp, but I just don't know how to get the fan to spin.

I did initially try my simply editing config.txt, which is located in /boot/firmware on Ubuntu, and adding the below:


This has no effect though (but does have the desired effects on Raspbian).

I did, therefore, wonder if I could use the GPIO pins to start the fan up, and stop it, however, I honestly have no knowledge of GPIO. I assume it is controlled via this on Raspbian, but very little on ideas here, I'm afraid.

If anyone can point me in the right direction, or has some ideas to try that would be great. Any further questions on things I haven't covered, please do ask, and I'll be happy to elaborate to the best of my ability.

Edit: Looking at this post here, it appears that it's controlled via the I2C pins, so I've added the tag, in case anyone has found how to control it via that.

Edit 2: So it seems that the drivers for the fan were added in Ubuntu 19.04, as the answer below suggests, however, it doesn't control the fan, it just switches it on. Having the fan permanently on is actually even less desired as they create constant high levels of noise (despite being quite small the fans aren't quiet). I am looking for a solution that can spin the fans up and down. I did add the above parameters to /boot/firmware/config.txt again as well, but this has no effect. Even at 40C the fan was spinning at full speed (the settings state that full speed would be at 77C, down to 75C).

  • I got it spin with Ubuntu 19.04 (raspberry pi version). Unfortunately I cannot let it stop. May 14, 2019 at 20:45
  • But how did you get it to start in the first place, @user2186068 ?
    – Larnu
    May 15, 2019 at 7:48
  • From the driver documentation it uses the I2C bus usually reserved for HAT EEPROM chips to control the fan. Have you looked under the /sys/ folder for fan*, rpipoefan or rpi-poe-fan entries? Here's the driver source: github.com/raspberrypi/linux/blob/rpi-4.19.y/drivers/hwmon/… May 17, 2019 at 9:25
  • Nothing on the 18.04, but the 19.04 host (after answer below), does show the driver in /lib/modules/5.0.0-1008-raspi2/kernel/drivers/hwmon/rpi-poe-fan.ko @RogerJones . i'm going to try a fresh install of 19.04 on the pi I ungraded to 19.04 last night anyway (as it corrupted the lxc install when it changed it to snap) and see if that works.
    – Larnu
    May 17, 2019 at 9:44

4 Answers 4


I'm using Ubuntu Server 20.04 LTS. The dtparams setting does not work, instead you need a udev rule.

The fan config is in /sys/class/thermal/cooling_device0/, if you cat /sys/class/thermal/cooling_device0/type, it should be "rpi-poe-fan".

Once you've confirmed that, use this udev rule as an example:


# If the temp hits 75c, turn on the fan. Turn it off again when it goes back down to 70.
# If the temp hits 78c, higher RPM.
# If the temp hits 80c, higher RPM.
# If the temp hits 81c, highest RPM.

Place it in /etc/udev/rules.d/50-rpi-fan.rules. To apply udev rules, issue udevadm control --reload-rules && udevadm trigger

  • Note, the udev rules are for the CPU's tripping points, the fan itself is in /sys/class/thermal/cooling_device0, and you can turn on / off the fan directly with echo '0' > /sys/class/thermal/cooling_device0/cur_state. May 5, 2020 at 10:47
  • Thanks Luke. i haven't upgraded to 20.04 as yet, and when I upgraded to 19.04 from 18.04 the fan didn't work; only a fresh install of 19.04 got it to work. Won't lie, little concerned that the same will happen and really not wanted a full reinstall on the Pi. Will try and upgrade at some point anyway; hopefully /sys/class/thermal/cooling_device0/ (and I assume the related ` /sys/devices/virtual/thermal/cooling_device0/`) will be created.
    – Larnu
    May 5, 2020 at 11:01
  • well, put a fresh install of Ubuntu 20.04 on, and yes, this works (great!). Now to take the plunge of upgrading and seeing if that exposes the needed files.
    – Larnu
    May 13, 2020 at 13:22
  • 2
    This file is great, and I'm using it, but I did notice that my fan was always either off or very loud. This is because the trip_point_0_temp should be the HIGHEST RPM setting, and the trip_point_3_temp should be LOWEST. Otherwise your fan will waffle between states 0 and 4 to stay below the lowest temperature, and likely never enter states 1, 2 or 3. If you reverse them, you get the desirable gradual increase from state 0 to 1 to 3 to 4.
    – Patches
    Jun 4, 2020 at 21:27
  • thank you! i'm also using poe hat for raspberry pi on ubuntu server 20.04 lts it seems by default, the fan is spinning on and off automatically based on cpu temperature, what's the default rule? thanks!
    – jerry
    Feb 21, 2021 at 13:42

Using 21.04, if you add this line to /boot/firmware/config.txt it should work. It seems to work a little better after doing an apt upgrade and rebooting.

  • This and the dtparams on @dsmith8 answer worked like a charm in my Raspberry Pi 4 with Ubuntu 20.04.5 LTS
    – luismesas
    Jan 6, 2023 at 22:48
  • 1
    It is recommended to apply this solution in the /boot/firmware/usercfg.txt file instead as recommended by the S.O.
    – luismesas
    Jan 6, 2023 at 22:50

I'm also using 20.04 on Raspberry Pi 4s. After googling around, there is a config.txt at /boot/firmware/config.txt and the following example worked for me in that file:

  • This and the dtoverlay on @Derrick answer worked like a charm in my Raspberry Pi 4 with Ubuntu 20.04.5 LTS
    – luismesas
    Jan 6, 2023 at 22:48
  • It is recommended to apply this solution in the /boot/firmware/usercfg.txt file instead as recommended by the S.O.
    – luismesas
    Jan 6, 2023 at 22:50

You can try Ubuntu Disco Dingo for Raspberry pi 3b+. You may download it from Ubuntu releasing site. http://cdimage.ubuntu.com/releases/19.04/release/ In the new firmware, the PoE Fan driver is merged in.

  • Interesting if it is in Dingo. I'll do a release upgrade instead (changing the value of prompt to normal in /etc/update-manager/release-upgrades) and see if that works first; as i'd like to avoid a fresh install. i'll report back after testing. Thanks,
    – Larnu
    May 16, 2019 at 13:54
  • Doing a release update didn't work. Will try a fresh install later. See if that has any luck
    – Larnu
    May 17, 2019 at 9:34
  • After installing Ubuntu 19.04 fresh, the fan works, but doesn't switch off; even with the above changes to the config. This also, is undesired (as the fans are noisy). The fan needs to switch on and off. Unfortunately this is therefore not the solution.
    – Larnu
    May 17, 2019 at 18:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.