I recently got my hands on an Orange Pi Zero, a Raspberry Pi Zero alternative, if you're unfamiliar with it. What I noticed, though, is the OPi's CPU gets hot. So hot that it would crash under heavy load. At first I tried passive cooling with a few stick-on-sinks, and they helped, but I decided to take it one step further and built this:
I drilled a hole in the case and attached the smallest 5v fan I could find on eBay. The fan can be a bit noisy at times, so I decided to control it with a switching PNP transistor, hooked up to pin PA11 and crammed everything inside the small case. This simple Python script is started in rc.local and runs in the background indefinitely:
#!/usr/bin/python from pyA20.gpio import gpio from pyA20.gpio import port from time import sleep gpio.init() gpio.setcfg( port.PA11, gpio.OUTPUT) while 1: with open( "/sys/devices/virtual/thermal/thermal_zone0/temp" ) as f: content = f.readlines() temp = int(content) if temp >= 50: gpio.output( port.PA11,gpio.LOW ) if temp < 45: gpio.output( port.PA11, gpio.HIGH ) sleep(5)
As you can see, when the CPU's internal temperature exceeds 50 degrees celcius, the fan is switched on. I have a hysteria of 5 degrees, so it will not switch off again until the temperature is less than 45 degrees celcius. This was tested using the cpuburn tools that really, really stress the CPU.
And, hey, I'm as surprised as you are: it actually works very well; when the fan starts running, the CPU temperature drops a few degrees in a matter of seconds.
I may not need this too often, but it was a fun (and cute) build. Besides, what's cooler than being cool? Ice cold!