Last year I purchased a new Raspberry PI 4. It’s been sitting gathering dust since then… until now.
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).
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.
- 1 x NPN transistor (2N2222)
- 1 x 680ohm resistor
- a bunch of female/male jumper cables
- a soldering iron
- wire stripper (or craft knife)
The board uses 3 pins that are used for the fan and the transistor to work, these are –
- GPIO Pin 2 – 5v
- GPIO Pin 17 – Switch for collector pin on Transistor
- 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.
…Its not the cleanest wiring job I’ve ever done, but it does the job 🙂