I built a box with fans attached to it to control the temp like a regular desktop would have. I wrote a python script that checks the temp of the CPU every 45 seconds and turns the fans on/off accordingly.
Video w/ links in the description:
Code: Select all
#!/usr/bin/env python3 import time import os import RPi.GPIO as GPIO GPIO.setmode(GPIO.BOARD) GPIO.setup(12, GPIO.OUT) GPIO.setwarnings(False) def getCPUtemperature(): res = os.popen('vcgencmd measure_temp').readline() return(res.replace("temp=","").replace("'C\n","")) def fanON(): GPIO.output(12, False) return() def fanOFF(): GPIO.output(12, True) return() def getTEMP(): CPU_temp = float(getCPUtemperature()) if CPU_temp>40: fanON() else: fanOFF() return() while 1: getTEMP() time.sleep(45)