Introduction: Add a Power Button, Power Indicator LED and Cooling Fan to Raspberry Pi (Model 3B)
- I recently had to re-image my Raspberry with Raspbian few times because the SD card got corrupted due to unexpected shutdown of the Pi.
- I was also seeing a red flashing thermometer icon on the upper right hand corner of the screen telling that the temperature is rising and might cook up the board if not cooled down soon.
Following are the items that I am going to add on my Raspberry Pi which
helps us Power Off/Power On it with a push of the button and a Cooling Fan too which will help it remain well within acceptable temperature.
- A Power Button.
- An LED Indicator.
- A Small cooling Fan.
Step 1: Preparation and Setup
Please note that we will be using one of the GPIO pins to power up the cooling fan and the fan that I used for this purpose requires 12 volt of supply but giving 5 Volts from the Pi’s GPIO pins also provides sufficient air blow and keeps the temperature well below 78 degree Celsius. I tried running multiple games simultaneously which used to over heat the Pi but after adding this fan I have never noticed the temperature icon flashing on the upper right hand corner of the screen.
· A small Power Button, (salvaged from kid’s toy).
· An LED for Power Indicator.
· A small Cooling fan (salvaged from Good Night Mosquito repellant).
· Very little coding coding skills.
- Solder two wires on the Switch with Female jumper ends to plug on GPIO Pins.
- Solder two wires on LED with Female Jumper ends to plug on GPIO Pins.
- Add additional wire with female jumper end to the Cooling Fan to plug on GPIO Pins
- Make a sufficiently big hole on the upper case of the Pi and hot glue the Cooling Fan it properly.
- Super glue the LED on the Pi case at any convenient location of your choice.
- Hot Glue the Power Switch somewhere on the case.
Coding Instructions for Power Button and Power Indicator RED Led
Boot up the OS (Raspbian) and add following two lines at the bottom of the config file /boot/config.txt
Save and close the file.
That’s all the coding that is needed.
As soon as the Pi is rebooted the Power Indicator LED will glow.
When Power Button is pressed, the OS shuts down and pressing it again Powers it back on. (Please note that it does not Power OFF the Board and you will notice that the Cooling fan is still spinning even when the PI is Powered off. The motive behind adding the Power Button is to prevent the SD card/OS from being corrupted due to unexpected shutdowns and we can simply push the button and it will Shutdown the OS without navigating to the Shutdown option from start menu.
Rest of all is wiring the LED, Switch and Fan.
Please refer to the Images and circuit diagram for wiring instructions.
Here are the Connection/Wiring diagram of the components with Pis GPIO/Header Pins.
Cooling Fan + : Pin 2
Cooling Fan - : Pin 39
Power Led + : Pin 8
Power Led – : Pin 9
Switch Pin 1 : Pin 5
Switch Pin 2 : Pin 6
Good Luck :)
Participated in the
First Time Author Contest