Fan Shim Too Bright During The Night

The LED of the Fan Shim is too bright during the night.

  1. How can I disable the LED without changing the fan settings?

  2. How do I turn the LED red when the fan is off (most of the time), and green when the fan is on (red is better during the night)?

  3. I also got the Raspberry Pi 4 Heatsink, what’s the temperature reduction with it on?

If you add --noled to the end of the sudo ./install-service.sh --on-threshold 55 --off-threshold 40 --delay 2 when you run it the LED will be off.
`sudo ./install-service.sh --on-threshold 55 --off-threshold 40 --delay 2 --noled"

To find out if the fan is on its
fanshim.get_fan() # returns 1 for ‘on’, 0 for ‘off’
then set the LED accordingly

Fan Shim includes one RGB APA-102 LED.
Set it to any color with:
fanshim.set_light(r, g, b)

Arguments r, g and b should be numbers between 0 and 255 that describe the color you want.

For example, full red:

fanshim.set_light(255, 0, 0)
1 Like

The addition of --nolead at the end of the command to start the service worked as expected.

Is there a way to keep the fan off when the Raspberry Pi 4 is shutdown?

The default is for the fan to turn on when the RPi is shutdown and it’s not needed, reducing its lifespan.

There is a physical mode you can do, it entails cutting a track on the circuit board.

Fan Shim Button to turn Pi on and off FYI post - Discussion - Pimoroni Buccaneers

I was hoping for a software edit to tell fan to stop before service shuts down.

My RPi can shutdown in the middle of the night if there’s a power outage, but the UPS comes back when power is restored.

Because the USB 3.0 hub is back-powering the RPi, it has power, but doesn’t boot, and without the service running the Fan Shim stays on until I wake up in the morning.

  • Can I tell the fan to stop via software by editing its config file (if any) when the RPi shuts down? Or by executing a command during shutdown?

The way it works is with no signal to the fan control pin the fan runs. Its fail safe state is on. If you plug it in and don’t install any control software it just runs continuously.
The fan control pin has to be pulled low to turn the fan off. If its a logic high or a floating no state, the fan is on.
When the Pi shuts down the Pimoroni fan daemon stops, the pin goes to a floating state, and the fan turns on.
You’d have to use the dtoverlay=gpio-poweroff, param = val in config.txt. I did this and it works if the pi is properly shut down. The problem for me was I couldn’t boot it back up by grounding GPIO 3. I had to power cycle it or ground the run pin. I don’t think it will work on a power failure though, and I don’t remember what values I used for the param and val

1 Like

firmware/README at master · raspberrypi/firmware · GitHub
I think it should be as follows
dtoverlay=gpio-poweroff,gpiopin=18,active_low=“y”

1 Like

Thank you for the information, very detailed. Will check it.

Wanted to leave this fragment here from another post:

With Pibow coupé case, the tactile button can’t be pressed unless the shim is mounted up high on the GPIO header pins, flapping about in the breeze, and seems a bit floppy and vulnerable. If you press it down to sit firmly, the side of the case covers the button.

I also have by necessity a RTC partially on top of the Fan Shim.

I notched out that top layer with my dremel tool to get good access to the button. I use it to shut down and boot up the Pi. And I cut a track on the board so my fan turns off when the Pi shuts down. I don’t bother with the Pimoroni software I just do a config.txt edit.

dtoverlay=gpio-shutdown,gpio_pin=17,active_low=1,gpio_pull=up
dtoverlay=gpio-fan,gpiopin=18,temp=55000

The above makes the fan come on at 55c and off again at 45c. The LED is off, not used.

1 Like

Making sure I understood, to use the Fan Shim button as on/off switch you add this line to /boot/config.txt:

dtoverlay=gpio-shutdown,gpio_pin=17,active_low=1,gpio_pull=up

Also, you have to cut a track on the board as shown in the link you posted above for the fan to turn off when the Pi shuts down.

To use the fan without the Pimoroni service you add this example line to /boot/config.txt:

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

Fan turns on when temperature reaches the “temp” stated above and turns off 10 degrees lower. The LED is off and not used.

Yes, that is all correct. If you do a shutdown and don’t unplug the power supply, momentarily grounding GPIO 3 will have it boot up. The Button on the fan shim grounds GPIO 3 and GPIO 17 when pressed. Adding dtoverlay=gpio-shutdown to config.txt will have it do a proper shutdown when GPIO 3 is grounded. That works as long as you don’t enable i2c. I often use i2c so I use the expanded entry switching the shutdown pin to GPIO 17. That works if i2c is on or off.
The fan control pin is GPIO 18. and the “temp =” is where it turns on. There is now an option in Raspberry Pi Configuration menu to enable fan control, and it will add the dtoverlay entry. It’s minimum temp is 60c. I’m usually going in to add the shutdown dtoverlay anyway so I just do both at the same time and don’t bother with the fan control menu option.
Fan SHIM at Raspberry Pi GPIO Pinout

1 Like

Are you saying that I need to edit the config.txt file manually to get the Fan to activate at a lower temp than 60C?

Did it via raspi-config and is working the way I wanted it, but it added [all] section again, can I just delete the extra one?

[all]
#dtoverlay=vc4-fkms-v3d

dtoverlay=i2c-rtc,ds3231
[all]
dtoverlay=gpio-fan,gpiopin=18,temp=60000

Edited the file this way:

[all]
#dtoverlay=vc4-fkms-v3d
dtoverlay=i2c-rtc,ds3231
dtoverlay=gpio-fan,gpiopin=18,temp=55000

BTW, the information is excellent. Devices seem to be working.

Yes if you want to set it to a temperature lower than 60 you have edit it manually, Yes just delete the double entry,

1 Like

All set, thank you very much! This thread will be useful to others.

It’s always nice to have options. Nothing wrong with the Pimoroni software, I just find the config.txt edit easier for how I use the Fan Shim. If you want more than that 10 degree spread between on and off temperatures you don’t have a choice. Or if you want to show temperature on the LED etc.

install service
cd fanshim-python
cd examples
sudo ./install-service.sh --on-threshold 55 --off-threshold 40 --delay 2
–nobutton to turn button off and
–noled to turn the LED off.

change service, run this from fanshim-python / examples folder

sudo systemctl stop pimoroni-fanshim.service
sudo ./install-service.sh --on-threshold 75 --off-threshold 60 --delay 5

disable service

sudo systemctl stop pimoroni-fanshim.service
sudo systemctl disable pimoroni-fanshim.service

enable again

sudo systemctl enable pimoroni-fanshim.service
sudo systemctl start pimoroni-fanshim.service

1 Like