I purchased a FAN-SHIM and Raspberry Pi 4 from Pimoroni last year but occasionally saw a problem, and struggled with a diagnosis.
The FAN-SHIM generally worked great, but I noticed that it didn’t seem to always work when I didn’t have a lead coming off the header to a breadboard. The fan would just run, the LEDS wouldn’t work – it was basically unhappy. Given it was directly related to the cable, I took the easy route to fixing things – leave it attached! However, I always wanted to properly diagnose what was going on.
Exploring Problems with the FAN-SHIM on a Pi
I recently had a chance to look at this again, and this is collecting my exploration and thoughts. In short, I did a lot of hunting about, until I found something that really helped me diagnose things. I knew the installation was working – as I said, with the cable attached all is good. However, I didn’t really want it plugged in all the time. It looked like it was pushed on OK – but I had no control.
How could I work out if it was the SHIM with an issue, my Pi or something else?
Eventually, I found this page. A comment by gadgetoid suggested a really good diagnostic approach.
Diagnosing the FAN-SHIM problem on the Pi
Basically, turn the fanshim service off:
systemctl stop pimoroni-fanshim.service
Then, start up python and run the following:
import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(18,GPIO.OUT) GPIO.output(18,0) # Should turn fan off GPIO.output(18,1) # Should turn fan on
Basically, run the command to get the fanshim to do what it isn’t at the moment. Then adjust the fanshim until the action actually happens – so in my case it finally turned off!
Having done this, I could run now run the other test scripts in the fanshim example source code.
Finally the LED would change as expected, and the fan would turn on and off as expected.
I now re-enabled the fan-shim service:
systemctl start pimoroni-fanshim.service
Now, I know how to check things if it goes wrong again!