User avatar
HawaiianPi
Posts: 4584
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Pimoroni Fan Shim service fails to start (SOLVED)

Sun Aug 18, 2019 12:35 am

EDIT:
Apparently it only works with Buster (doesn't say that anywhere in product description or tutorial).
Tried a fresh Stretch image on SD, and same problem. Tried Buster and it all works as advertised.
Pretty cool product (pun intended). LED goes green-yellow-red as SoC heats up.


Got a Fan Shim recently, and after installing the hardware it runs all the time with no LED or button control, which is probably expected since it's software controlled. So today I followed the Pimoroni tutorial (Getting Started with Fan SHIM), but the fan just shuts off, with no LED or button control, and it does not turn on no matter how hot the system gets (stress tested to over 80C where SoC started to throttle).

Running sudo systemctl status pimoroni-fanshim.service returns the following error.

Code: Select all

~ $ sudo systemctl status pimoroni-fanshim.service
● pimoroni-fanshim.service - Fan Shim Service
   Loaded: loaded (/etc/systemd/system/pimoroni-fanshim.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2019-08-17 16:40:31 PDT; 1min 9s ago
  Process: 604 ExecStart=/home/tim/fanshim-python/examples/automatic.py --on-threshold 65 --off-threshold 55 --delay 2 --brightness 255 (code=exited, status=1
 Main PID: 604 (code=exited, status=1/FAILURE)

Aug 17 16:40:30 Pi3BSSD systemd[1]: pimoroni-fanshim.service: Failed with result 'exit-code'.
Aug 17 16:40:31 Pi3BSSD systemd[1]: pimoroni-fanshim.service: Service hold-off time over, scheduling restart.
Aug 17 16:40:31 Pi3BSSD systemd[1]: Stopped Fan Shim Service.
Aug 17 16:40:31 Pi3BSSD systemd[1]: pimoroni-fanshim.service: Start request repeated too quickly.
Aug 17 16:40:31 Pi3BSSD systemd[1]: Failed to start Fan Shim Service.
Aug 17 16:40:31 Pi3BSSD systemd[1]: pimoroni-fanshim.service: Unit entered failed state.
Aug 17 16:40:31 Pi3BSSD systemd[1]: pimoroni-fanshim.service: Failed with result 'exit-code'.
Trying to run automatic.py manually returns the following error.

Code: Select all

~ $ /home/tim/fanshim-python/examples/automatic.py --on-threshold 65 --off-threshold 55 --delay 2 --brightness 255
Traceback (most recent call last):
  File "/home/tim/fanshim-python/examples/automatic.py", line 99, in <module>
    t = get_cpu_temp()
  File "/home/tim/fanshim-python/examples/automatic.py", line 50, in get_cpu_temp
    t = psutil.sensors_temperatures()
AttributeError: module 'psutil' has no attribute 'sensors_temperatures'
Spent some time on google without a solution. Only found one hit that seemed to be the same problem, and it had no resolution (yet). Pretty lost on this one. Thought it would be simple.

  • Raspberry Pi 3B v1.2 (not +), with USB boot OTP bit set.
  • Raspbian Stretch, fully up-to-date (apt update/full-upgrade).
  • USB booted from SSD (empty FAT32 card in slot).
  • Not official PSU, but load tested, so I know it's okay (good micro USB cable as well).
  • Nothing else on GPIO.
  • SATA-III SSD with Eluteng black USB adapter (only other USB device is a Logitech Unifying dongle).
  • Image was written directly to SSD with Etcher and has been updated/upgrade regularly.
  • HDMI monitor.
  • No Ethernet (using WiFi).
  • Nothing weird in my OS configuration (basic Raspbian Stretch with Desktop and a few applications).

Anyone got one of these working correctly? Thanks in advance for any help.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

andrum99
Posts: 792
Joined: Fri Jul 20, 2012 2:41 pm

Re: Pimoroni Fan Shim service fails to start (SOLVED)

Sun Aug 18, 2019 8:42 am

HawaiianPi wrote:
Sun Aug 18, 2019 12:35 am
LED goes green-yellow-red as SoC heats up.
I wasn't going to get one, but you've just convinced me 8-)

I guess since it is intended to be used on the Pi 4B they didn't bother testing on Stretch. Per https://github.com/giampaolo/psutil/blo ... ISTORY.rst, support for reading temperatures on the Pi was added in psutil version 5.4.8 in 2018-10-30, so updating to the latest version would probably get it working on Stretch:

Code: Select all

sudo pip3 install psutil --upgrade
If pip is not installed already, you would need this first:

Code: Select all

sudo apt update && sudo apt install python3-pip

pitemp3
Posts: 1
Joined: Fri Sep 13, 2019 5:53 pm

Re: Pimoroni Fan Shim service fails to start (SOLVED)

Fri Sep 13, 2019 6:56 pm

Hi,

The install-service.sh script is not terribly well written...

Make sure to run the install-service.sh script from the fanshim-python/examples/ directory
where automatic.py lives, because the script sets up the service with: ExecStart=$(pwd)/automatic.py
From fanshim-python/ the following would work correctly: cd examples; sudo ./install-service.sh
whereas this would not: sudo examples/install-service.sh

Run from examples/, then take a look in: /etc/systemd/system/pimoroni-fanshim.service
It should have a line something like: ExecStart=/home/pi/fanshim-python/examples/automatic.py
Make sure it does indeed point to correct place.
For instance, this would be wrong: ExecStart=/home/pi/fanshim-python/automatic.py

Alternative hack #1: make a link from fanshim-python/ like so: ln -s examples/automatic.py .
then: sudo systemctl restart pimoroni-fanshim.service

Alternative hack #2, manually edit: /etc/systemd/system/pimoroni-fanshim.service
then: sudo systemctl daemon-reload
then: sudo systemctl restart pimoroni-fanshim.service

In any case, run: systemctl status pimoroni-fanshim.service
and it should show: Active: active (running) [...]

It seems to work well for me on Pi 3B+ with Raspbian 9 Stretch and on Pi 4 with Raspbian 10 Buster.
With small flat (or nearly flat) copper heat-sinks that fit underneath the fans, using: sudo ./install-service.sh -o 50 -f 40
the temperature goes all the way down to 40 C while idling, and up to around 55C under stress test
(in official cases with tops off, Pi 4 has firmware update).

- R

itsmedoofer
Posts: 359
Joined: Wed Sep 25, 2013 8:43 am

Re: Pimoroni Fan Shim service fails to start (SOLVED)

Sat Sep 14, 2019 3:53 pm

Hi,

PeterO found this handy little alternative if you cant use the installer or simply dont want to....

Code: Select all

dtoverlay=gpio-fan,gpiopin=18,temp=65000

Return to “Troubleshooting”