Sharing an Space with a sweaty Mac Pro

A 2019 Mac Pro can be particularly troublesome office-mate in the summer. At full throttle the thing can put out 3076 BTU/h of heat – though mine does a lot less. Which may make the space a little warm a sauna. Last year I added vent boosters to the AC vents and returns in the office to try and cool things down. They helped, but in the end high end (non M1) machines just dump out too much heat.

So, how to dump that hot air out of the room, and not just try cool it down with the AC….

A custom rear shroud with a smart fan that directly extracts the hot air out of the room. The fan is sync’ed to the internal Mac Pro fan and speeds up or slows down according to the internal fan speed.

First thing was to move the Mac close to a window. Originally I was going to cut a circular hole into a pane of glass, but I found that a far simpler solution was to use the existing screen area to replace the screen with an identically cut piece of plexiglass with a hole cut into it. This way its as easy to change as changing a screen in my window. Moving the Mac was half the issue, and the other half was staring connected to my monitor etc.

I use a Cisco Webex Desk pro and it connects to the Mac using USB 3.2 2×2 – and the longest cable I could find is a 16.5 footer, which works well for me to have full resolution as well as use the built in camera/mic/speaker set fully…. With the Mac 8 feet away by the window.

Capturing the hot air: I built a 3d printed hot air capture baffle with a high powered Noctua 4-Pin PWM fan that sucks the hot air and vents it out my window. The fan and baffle are mounted to a piece of plexiglass that is cut to exactly match the screen which would have otherwise been in the window opening. The speed of the Noctua fan is synced to the speed of the Mac Pro rear fan speed using a script on the Mac that pushes the fan speed to a Raspberry Pi that is controlling the fan…

To capture the hot air exiting the chassis I used AutoDesk Fusion 360 to design an elongated capture baffle with similar dimensions to the back vent area of the Mac Pro. I tapered the baffle down to a 140mmx140mm fan opening where I am using a Noctua high performance 4 wire PWM fan to do the extraction itself:

I had to slice the baffle into quarters to print and then Bondic the pieces together. Im a huge fan of Bondic now! The back fan is attached to the back of the baffle, and the other side of the fan is attacked to the plexiglass sheet that I had cut and drilled to align with my Mac Pro’s vents.

I used a Raspberry Pi Zero W and an Adafruit 2101 4 Pin PWM fan controller to manager the fan itself. The 2101 is controlled using python and has an internal temperature sensor, and external temperature sensor as well as PWM control and RPM measurement. I was originally going to base fan speed on heat output but fan speed of the Mac seems like a better metric. Note that the fan power is separate from the Pi power, but that the grounds are all tied together.

EMC2101 and Raspberry Pi attached to the baffle using Bondic

As you can see above I added a transistor to the EMC2101 board and pushed it through the baffle so it can measure the temperature inside the extraction cone as well as the temperature of the air around the chip on the EMC2101 board….

Work on the Raspberry Pi: Next, log into the Raspberry Pi and install the Adafruit libraries for python in order to talk to the EMC2101 board:

sudo pip3 install adafruit-circuitpython-emc2101

On the raspberry pi, there is a php script that takes that value and writes it to a Ramdisk, to be read by the next step. I am using a 5MB Ramdisk because I dont want the constant writes to kill the MicroSD card:

sudo mkdir /mnt/ramdisk
sudo nano /etc/fstab
add a line:
tmpfs /mnt/ramdisk tmpfs nodev,nosuid,size=5M 0 0
save and reboot

Now, we create a php file that basically handles the incoming request from the Mac and writes out the % power of the fan to a file on the RamDisk.. saved to /var/html/index.php:

<?php
$data=intval($_GET['target']);
if($data>100){
    $data=100;
}
if($data<20){
    $data=20;
}
$myfile = fopen("/mnt/ramdisk/data.txt", "w") or die("Unable to open file!");
fwrite($myfile, $data);
fclose($myfile);
?>

And finally, the python script that checks for the file on the Ramdisk and updates the fan speed of the EMC2101 fan controller accordingly:

import time
import board
from adafruit_emc2101 import EMC2101

i2c = board.I2C()  # uses board.SCL and board.SDA
emc = EMC2101(i2c)
refresh=10

while True:
    try:
        f = open('/mnt/ramdisk/data.txt','r')
        data=f.read()
        f.close()
        print(data)
    except:
        print("Error reading new params")
    else:
        emc.manual_fan_speed = int(data)
    time.sleep(refresh)

Work on the Mac: A shell script run on the Mac Pro will read the rear fan speed and send that speed (in terms of 1-100%) to the Raspberry Pi, where it will be read. This has to be run as root, and I have it scheduled automatically:


#!/bin/sh
# FanControl.sh by Jeremy Laurenson

sleep 30

counter=1
until [ $counter -gt 10 ]
do
	fanspeed=$(powermetrics -i 200 -n 1  --samplers smc | grep Fan  |  tr -d -c .0-9  | awk '{print int($0)}')
	clear
	echo Real speed is $fanspeed
	output=$(echo "scale=0;($fanspeed-200)/10" | bc)
	echo Target fan is $output
	curl "http://your.raspberry.pi.here/?target=$output"
	sleep 10
done

Now, to have this script load automatically on startup, I put it into /Applications/Utilities and added a new plist file. That plist file I save at: /Library/LaunchDaemons/com.laurenson.fancontroller.plist with the following contents:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Label</key>
	<string>com.laurenson.fancontroller</string>
	<key>ProgramArguments</key>
	<array>
		<string>/bin/sh</string>
		<string>-c</string>
		<string>/Applications/Utilities/fancontrol.sh</string>
	</array>
	<key>RunAtLoad</key>
	<true/>
</dict>
</plist>

Now, activate that script by issuing:

sudo launchctl load /Library/LaunchDaemons/com.laurenson.fancontroller.plist

The Mac Pro extraction fan runs between 500RPM and 1200RPM. The script will take whatever the current value is, subtract 200 and divide by 10, essentially giving a range of 30% to 100% This is fine because I always want some pressure out of the exhaust so I don’t allow air in through the open window.

I had a local company cut me a sheet of acrylic the same size as my normal drop-in screens; at a thickness of 3/8ths of an inch:

Lastly, I created a small app for my Mac that informs me of the speed of the internal Mac fan, the % power to the extractor as well as the speed of the extractor fan:

Shielding

I have had to place tin foul around the cone of the printed part as well as add an RF shielding grill to the fan… bluetooth was a problem


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s