# Fan Shim Too Bright During The Night

**URL:** <https://forums.pimoroni.com/t/fan-shim-too-bright-during-the-night/16734>\
**Category:** Support\
**Created:** [March 26, 2021, 6:02pm UTC](https://forums.pimoroni.com/t/fan-shim-too-bright-during-the-night/16734 "2021-03-26T18:02:42Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![plank](https://avatars.discourse-cdn.com/v4/letter/p/7bcc69/32.png) [@plank](https://forums.pimoroni.com/u/plank)\
**Post date:** [March 26, 2021, 6:02pm UTC](https://forums.pimoroni.com/t/fan-shim-too-bright-during-the-night/16734/1 "2021-03-26T18:02:43Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [March 26, 2021, 7:48pm UTC](https://forums.pimoroni.com/t/fan-shim-too-bright-during-the-night/16734/2 "2021-03-26T19:48:53Z")

</div>

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:

```auto
fanshim.set_light(255, 0, 0)

```

---

<div class="post-metadata">

**Author:** ![plank](https://avatars.discourse-cdn.com/v4/letter/p/7bcc69/32.png) [@plank](https://forums.pimoroni.com/u/plank)\
**Post date:** [March 26, 2021, 8:45pm UTC](https://forums.pimoroni.com/t/fan-shim-too-bright-during-the-night/16734/3 "2021-03-26T20:45:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [March 27, 2021, 9:01am UTC](https://forums.pimoroni.com/t/fan-shim-too-bright-during-the-night/16734/4 "2021-03-27T09:01:01Z")

</div>

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](https://forums.pimoroni.com/t/fan-shim-button-to-turn-pi-on-and-off-fyi-post/12169/8)

---

<div class="post-metadata">

**Author:** ![plank](https://avatars.discourse-cdn.com/v4/letter/p/7bcc69/32.png) [@plank](https://forums.pimoroni.com/u/plank)\
**Post date:** [March 27, 2021, 3:39pm UTC](https://forums.pimoroni.com/t/fan-shim-too-bright-during-the-night/16734/5 "2021-03-27T15:39:08Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [March 27, 2021, 5:26pm UTC](https://forums.pimoroni.com/t/fan-shim-too-bright-during-the-night/16734/6 "2021-03-27T17:26:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [March 27, 2021, 5:32pm UTC](https://forums.pimoroni.com/t/fan-shim-too-bright-during-the-night/16734/7 "2021-03-27T17:32:28Z")

</div>

[firmware/README at master · raspberrypi/firmware · GitHub](https://github.com/raspberrypi/firmware/blob/master/boot/overlays/README)  
I think it should be as follows  
dtoverlay=gpio-poweroff,gpiopin=18,active\_low=“y”

---

<div class="post-metadata">

**Author:** ![plank](https://avatars.discourse-cdn.com/v4/letter/p/7bcc69/32.png) [@plank](https://forums.pimoroni.com/u/plank)\
**Post date:** [March 27, 2021, 7:12pm UTC](https://forums.pimoroni.com/t/fan-shim-too-bright-during-the-night/16734/9 "2021-03-27T19:12:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [March 27, 2021, 7:47pm UTC](https://forums.pimoroni.com/t/fan-shim-too-bright-during-the-night/16734/10 "2021-03-27T19:47:20Z")

</div>

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.

```auto
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.

---

<div class="post-metadata">

**Author:** ![plank](https://avatars.discourse-cdn.com/v4/letter/p/7bcc69/32.png) [@plank](https://forums.pimoroni.com/u/plank)\
**Post date:** [March 27, 2021, 11:17pm UTC](https://forums.pimoroni.com/t/fan-shim-too-bright-during-the-night/16734/11 "2021-03-27T23:17:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [March 28, 2021, 8:56am UTC](https://forums.pimoroni.com/t/fan-shim-too-bright-during-the-night/16734/12 "2021-03-28T08:56:59Z")

</div>

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](https://pinout.xyz/pinout/fan_shim)

---

<div class="post-metadata">

**Author:** ![plank](https://avatars.discourse-cdn.com/v4/letter/p/7bcc69/32.png) [@plank](https://forums.pimoroni.com/u/plank)\
**Post date:** [March 28, 2021, 11:26pm UTC](https://forums.pimoroni.com/t/fan-shim-too-bright-during-the-night/16734/13 "2021-03-28T23:26:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [March 29, 2021, 12:03am UTC](https://forums.pimoroni.com/t/fan-shim-too-bright-during-the-night/16734/14 "2021-03-29T00:03:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![plank](https://avatars.discourse-cdn.com/v4/letter/p/7bcc69/32.png) [@plank](https://forums.pimoroni.com/u/plank)\
**Post date:** [March 29, 2021, 1:37am UTC](https://forums.pimoroni.com/t/fan-shim-too-bright-during-the-night/16734/15 "2021-03-29T01:37:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [March 29, 2021, 9:23am UTC](https://forums.pimoroni.com/t/fan-shim-too-bright-during-the-night/16734/16 "2021-03-29T09:23:54Z")

</div>

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`
