Project 09 of 11: 项目 09 / 11:DIY Laptop CoolerDIY 压风式笔记本散热器
I built an acrylic-and-foam laptop cooler, with a Windows application sending temperatures over Bluetooth to an ESP32 fan controller. A later STM32 board reached serial control but never rejoined the complete system.我做了一台亚克力与泡棉散热器,用 Windows 程序读取温度,经蓝牙控制 ESP32 和风扇。后来重画的 STM32 板完成了串口控制,尚未重新接成完整的温控整机。

Airflow and Temperature Source风道与温度来源
My laptop ran very hot in CSGO, and the frame rate sank with it. I had tuned the system and cleaned out the dust, and nothing helped much. The ordinary cooling pad beside it simply blew at the underside; its fans worked hard while much of the air escaped around the edges. I wanted a base sealed as tightly as I could manage, pushing air into the laptop's intake in generous volume.
玩 CSGO 的时候,我的笔记本温度高得厉害,帧数也跟着往下掉。调机器、清灰尘,能想到的办法试了一圈,都不太管用。再看手边的普通散热底座,它只是对着笔记本底部吹,风扇转得挺卖力,大量的风却从四周溜走了。我想做一个尽量密封的底座,把风集中往笔记本的进风口里送,送进去的风要量大管饱。
I built it from acrylic sheet, with foam pressed against the laptop's underside to enclose a space between cooler and computer. Less leakage around the edges meant more air through the intake, and reducing leakage while aiming at the intake was all I was after.
底座用亚克力板搭起来,泡棉贴着笔记本底部,在散热器和电脑之间围出一块相对封闭的送风空间。四周少漏一点,风就多从进风口走一点,当时追求的也就是少漏风、对准进风口。
How fast the fan should spin depends on how hot the computer is, and where that temperature came from was a cost-versus-need decision. A computer already carries plenty of temperature sensors, some built right into the CPU package. Paying extra for an external probe on the cooler would most likely measure the case or the airflow, with no guarantee of accuracy. So I read the computer's own temperatures. The catch was that those readings live inside Windows, and I needed a way to get them onto my own controller board.
风扇该转多快,要看电脑有多热。温度从哪儿来,我是按成本和需求掂量过的。电脑里本来就有好多温度传感器,有的直接做在 CPU 封装里,集成度高得很。我再花一笔钱在散热器上装个外置探头,测到的多半是外壳或者风道的温度,准不准还难说。所以温度直接读电脑自己的。麻烦在于这些读数都在 Windows 里,得想办法送到我自己的控制板上。
Windows Desktop ControllerWindows 上位机
That chain was the heart of the project. Windows reads the temperature and sends it over Bluetooth to an ESP32, which works out a duty cycle and outputs the matching PWM wave to set the fan speed. The ESP32 runs a Classic Bluetooth serial port through BluetoothSerial; once paired, a virtual COM port appears in Windows, carrying raw, unprocessed serial data.
这个项目真正的重心就在这条链路上。Windows 读出温度,经蓝牙发给 ESP32,ESP32 算出占空比,从引脚发出对应的 PWM 波,去控制风扇转速。ESP32 用 BluetoothSerial 开了一个经典蓝牙串口,电脑配对以后会多出一个虚拟 COM 口,里面跑的是没经过任何处理的原始串口数据。
A working link still had to be usable. I did not want anyone using this cooler to open VS Code, plug a USB-to-TTL cable into the board and type speed commands by hand, which is far too much fuss. The board does not speak USB either, so plugging it in would not make anything run on its own. What I pictured was something like launching a game: open it, see a window, click Connect, adjust, switch on automatic, done. The problem was that I had never written a Windows desktop application or touched a graphical interface.
数据通了,还得有人会用。我不想让用这台散热器的人打开 VS Code,拿 USB 转 TTL 线插到板子上,再手敲调速命令,这也太折腾了。它又不走 USB 协议,插上电脑也不会自己跑起来。我设想的是像打开一个游戏那样,点开就是一个界面,点连接、调一调、开自动,几下就能用上。问题是我从没写过 Windows 上位机,图形界面也一点没碰过。
The result is a C# WinForms application targeting .NET Framework 4.7.2. I picked up the basics bit by bit from CSDN, AI helped me a great deal, and the whole thing took considerable effort. The application source uses LibreHardwareMonitor to read CPU and GPU temperatures, scans and connects to COM ports, shows the readings, and automatically sends short messages such as CPU62.7 and GPU71.3 at 115200 baud.
最后做出来的是一个 C# WinForms 程序,目标框架是 .NET Framework 4.7.2。我在 CSDN 上一点点补基础,AI 也帮了我很大的忙,前前后后费了好一番功夫。上位机源码用 LibreHardwareMonitor 读取 CPU 和 GPU 温度,能扫描 COM 口、连接、显示读数,再把 CPU62.7、GPU71.3 这样的短报文以 115200 波特率自动发出去。
The first time I clicked Connect, the window found ESP32_Bluetooth, temperatures appeared, and the fan on my desk changed speed. I was genuinely thrilled. For the first time, a desktop program I had written made a circuit board in the physical world respond to my mouse in Windows. The 3 min 57 s demonstration records Windows, Bluetooth, the OLED, the buttons and the fan all working together.
第一次在窗口里点下 Connect,连上 ESP32_Bluetooth,温度数字出现在窗口里,桌上的风扇跟着变了速。我当时是真的兴奋。这是我第一次用自己写的上位机,让物理世界里的电路板跟着 Windows 里的鼠标做出了反应。3 分 57 秒的演示录下了 Windows、蓝牙、OLED、按键和风扇一起工作的全过程。
I had meant to put every control in the interface, but it ended up handling only connection, temperature reading and automatic sending. Mode, PWM frequency and manual duty went to five physical buttons on the board. That split turned out fine. Software has to be found, downloaded and installed; buttons work as soon as the power is on, one up and one down, and the fan speeds up or slows down.
界面这边,我原本想把所有操作都放进去,最后只做到连接、读温度和自动发送,切换模式、调 PWM 频率和手动占空比交给了板子上的五个实体按键。这样分工其实也挺好。软件得先找到、下载、装上,按键插上电就能按,一个加一个减,风扇就跟着变快变慢。
Temperature Control Rules温控规则
For turning temperature into fan speed, I first wanted PID. I wrestled with it for about half a week, could not get the algorithm written, and gave up. The rule that actually runs on the board is much simpler. The ESP32 takes the highest CPU or GPU temperature from the last 30 seconds and multiplies it by a mode factor: 0.5 in Quiet, 0.7 in Normal, and in High Speed the temperature simply becomes the duty, so 84°C gives 84%. Manual mode ignores temperature and holds whatever duty the buttons set. So much time had passed that I remembered it as a lookup table, until a check against the firmware confirmed this proportional mapping.
温度怎么换算成风扇转速,我一开始想上 PID,在这上面纠结了差不多半周,算法实在写不明白,最后还是放弃了。真正跑在板子上的规则简单得多。ESP32 取最近 30 秒里 CPU 和 GPU 的最高温度,按模式乘一个系数:静音模式乘 0.5,普通模式乘 0.7,高速模式干脆拿温度当占空比,84°C 就给 84%。手动模式不看温度,只认按键调出来的占空比。时间隔得太久,我自己都记成了查表,对照固件才确认是这套比例映射。
The desktop program sends one temperature every five seconds, alternating CPU and GPU, so each updates roughly every ten seconds. Five seconds keeps the data from going stale. The 30-second peak window stops a short in-game spike from being instantly overwritten by lower readings and keeps the fan from hunting up and down. I also felt at the time that a direct Bluetooth serial link was less efficient than it sounds, so a slower pace seemed safer. Between a temperature being read and the fan output actually changing there are several separate waits, and a button press can wipe the accumulated peaks; those details are in Temperature Sampling and Fan Response.
上位机每 5 秒发一条温度,CPU 和 GPU 轮流,每种大约 10 秒更新一次。5 秒是为了数据别太旧;30 秒的峰值窗口能让游戏里短时间的高温不被后面的低读数马上盖掉,风扇也不会一会儿快一会儿慢。我当时还觉得蓝牙串口直连没有想象中那么高效,发得慢一点比较稳妥。一条温度读数从读出来到真正改变风扇输出,中间隔着好几段等待,按键还会把攒下的峰值清掉,这些细节放在了温度采样与风扇响应里。
ESP32 Controller BoardESP32 控制板
I drew the ESP32 board quickly, without much ceremony. After the schematic, EasyEDA project and Gerber files, I had it fabricated, soldered it, powered it up and installed it in the acrylic base. It carries two fan connectors, power conversion, an OLED and five buttons. There is no separate fan-driver IC: these are PWM fans, and the ESP32's PWM goes straight to the fan's own control wire. The OLED line labelled Fan Speed actually shows duty cycle; the program never measured speed. How the fan is wired, and how duty differs from real RPM, are covered in PWM Fan Control and Speed Feedback.
ESP32 这块板是我随手画的。原理图、EasyEDA 工程和 Gerber 画完以后,打板、焊接、上电,再装进亚克力底座。板上有两路风扇接口、电源变换、OLED 和五个按键。板上没给风扇单独配驱动芯片,接的是 PWM 风扇,ESP32 的 PWM 直接送到风扇自带的控制线上。OLED 上那行 Fan Speed 显示的其实是占空比,程序从来没测过转速。风扇怎么接、占空比和实际转速怎么区分,写在PWM 风扇控制与转速反馈里。
I really did use this version under my laptop for two or three days, and cooling felt noticeably better. As I remember it, CSGO gained roughly 20 to 30 FPS and the peak temperature fell from about 92 or 93°C to around 84°C.
这一版我真垫在电脑底下用了两三天,确实感觉散热好了不少。按我记得的量级,CSGO 大概多了 20 到 30 帧,最高温度从九十二三度降到 84 度左右。
STM32 Revision and 3D-Printed EnclosureSTM32 改版与 3D 打印外壳
Later I redrew the controller around an STM32F103C8T6 as an across-the-board refinement of the ESP32 version: wider, tidier traces, a new placement, a smaller board, and a CH340N for USB-to-serial. I soldered and powered this board as well and finished its firmware. Speed commands sent over serial from VS Code got replies, and the fan changed speed. The STM32F103 has no wireless of its own, so Bluetooth depends on an external module; that link never made it back to the Windows application, and the board never went into the acrylic base.
后来我用 STM32F103C8T6 把控制板重画了一版,算是对 ESP32 版的整体优化。走线拉宽、理顺,元件重新布局,板子也缩小了,另外加了一颗 CH340N 做 USB 转串口。这块板同样焊好、上电,固件也写完了。在 VS Code 里通过串口给它发调速命令,它会回复,风扇也跟着变速。STM32F103 本身不带无线功能,蓝牙得靠外接模块,这条链路一直没接回 Windows 上位机,这块板也没装进亚克力底座。
I also tried a 3D-printed enclosure. I modelled and split it for a Bambu Lab A1 mini, arranged the parts across nine build plates in the 3MF project, and compared automatic and manual tree supports, part orientation, brim and skirt. It stopped at the slicing preview, and not a single part was printed.
外壳我也试过 3D 打印。给 Bambu Lab A1 mini 建模、拆件,在 3MF 里排成九块打印板,自动和手动树状支撑、零件朝向、Brim 和 Skirt 都比较过,最后停在切片预览,一件也没打出来。



So the one that actually sat under my laptop and adjusted its fan to game temperatures was the acrylic, foam and ESP32 build. The STM32 board stayed at the serial stage, still answering commands and still spinning the fan, one Bluetooth module short of rejoining the desktop program.
所以真正在我电脑底下垫过、跟着游戏温度调过风扇的,是亚克力、泡棉和 ESP32 板拼起来的那一台。STM32 那块板一直停在串口这一步,命令发过去照样回复,风扇照样转,就差一个蓝牙模块把它接回上位机。
Development notes开发笔记
Debugging records and technical notes tied to the decisions and artifacts on this project page.与这个项目页面中的设计决策和工程材料直接关联的调试记录与技术笔记。
- 01PWM Fan Control and Speed FeedbackPWM 风扇控制与转速反馈Studying fan power and PWM connections, waveform frequency and duty, and separate tachometer feedback for measuring each fan’s response.从风扇供电与 PWM 接线,研究频率、占空比和独立测速反馈,理解怎样观察每只风扇的实际响应。
- 02Temperature Sampling and Fan Response温度采样与风扇响应Following sensor selection, asynchronous reading and sending, and peak resets to understand when a temperature sample changes fan output.沿传感器选择、异步读取与发送、温度峰值清空,研究一条温度样本何时影响风扇输出。
Public Project Files公开项目资料
Uploaded evidence served from the public asset folder. Use the file index to preview documents, source code, media, PDFs, and downloadable artifacts without leaving the page.这里列出已经上传到公开目录的项目证据。可以在左侧索引里选择文件,在右侧直接预览文档、源码、媒体、PDF 和可下载附件。
diy-cooling-3d-print-preview-3.jpg
JPEG / 143.5 KB
Related media相关媒体
Board photos, schematic sheets, videos, and test captures that show this project at specific stages.展示这个项目具体阶段的板卡照片、原理图分页、视频和测试截图。
Video视频One Click Connected Windows Temperature to Fan Duty一次点击,把 Windows 温度接到风扇占空比
Nine A1 mini Build Plates That Remained Digital停留在数字阶段的九块 A1 mini 切片板
Brim and Skirt Settings That Never Reached the Printer没有走到打印的 Brim 与 Skirt 设置
Reorienting the Enclosure Parts With Manual Tree Supports手动支撑下重新摆放外壳分件
A Tighter STM32 Board Without the Complete Wireless Chain更紧凑、但未接回完整无线链路的 STM32 板
USB-UART and Dual-Fan Interfaces on the STM32 VersionSTM32 版的 USB-UART 与双风扇接口
