Last year I purchased a new Raspberry PI 4. It’s been sitting gathering dust since then… until now.

I finally got the chance to install Noobs and set up virtualMin to use as a hosting and development environment.  I also installed php v7.3, apache and mysql.

Fast forward a few days after moving all my website and development code to the new PI 4,  I now have a spare PI 3B. I had them running side by side for a while but found my desk area was getting a bit messy, therefore I done some research and found a nice little PI cluster case (below).

PI Cluster Case
Raspberry PI Cluster Case

This new case has 2 x 5 volt fans that I connected up to PI’s GPIO board.  After a while I found the constant fan noise annoying so had a thought if there was a way I could adapt the fans to only run when the board started running hot.   I found a great article on how to achieve this and purchased the parts required.

Part List

Circuit Diagram

raspberry pi fan controller schematic

The board uses 3 pins that are used for the fan and the transistor to work, these are –

  1. GPIO Pin 2 – 5v
  2. GPIO Pin 17 – Switch for collector pin on Transistor
  3. GPIO Pin 15 – Ground


When all the pins and components were connected to the board and jumper wires, I then installed the python script to control the GPIO Pin 17.   The script uses a built in python module (gpiozero) which allows us to control the GPIO pins on the PI.   The script first checks the CPU temperature and if it hits a predefined value it switches on Pin 17, therefore switching on the Fan.

PI Fan Controller code


…Its not the cleanest wiring job I’ve ever done, but it does the job 🙂

Leave a comment

Your email address will not be published. Required fields are marked *