Blog

  • How I built an external cooler which operates on internal temperature sensors

    Hello Hello..! Good to see you here!
    If you’ve been following my earlier experiments, you might remember how I used my old laptop to run pihole over my home network and configured it to run DoT, months back the same laptop started overheating.
    Laptop in question : MSI GF65 Thin9SEXR, i7 9th gen 12 Core Processor. Unfortunately, MSI does not have a linux fan control utility, Like most of the OEMs. Thanks to the tool OpenFreezeCenter by Aditya Kumar Bajpai managing fan speeds under Linux has been just as easy as on Windows — at least until the fan started giving up.

    I’ve been using OpenFreezeCenter since day one, and it never let me down. Unfortunately, the same can’t be said for the physical fans. Over time, they began to run slower and less effectively. Both CPU and GPU temperatures began hitting 90°C+. No, don’t blame Pi-hole — it’s built to run on something as lightweight as a Raspberry Pi. The real load came from everything else:

    • Jenkins
    • Grafana
    • Ollama running DeepSeek server (for my VSCode plugin — article coming soon!)
    • Cloudflared
    • Docker containers
    • …and whatever else I felt like experimenting with.
    • And all the 100+ Abandoned projects ( Some projects have been abandoned for so long that I cannot recognize them myself)

    So yeah — temps above 70°C were expected. And normally, OpenFreezeCenter should’ve been able to manage that. But with the fans seemingly losing strength, the temps weren’t staying in check. I tried it all — laptop coolers, DC fans, thermal repaste, and more. The results? Minor improvements, nothing consistent.

    Then Came the Jugaad Moment

    While browsing online, I stumbled upon lightweight drone motors with attached propellers. A thought struck me:

    “Why not reverse the polarity, flip the propellers, and turn them into a high-speed laptop cooler?”

    Laptop started cooling down instantly.

    There was a downside, The fans were as loud as much to ruin my sleep.

    I already had a Pi Pico and a relay lying around, So thought why shouldn’t I use the OpenFreezeCenter as my temperature library and automate the fan so that the drone motor runs only when the temperature reaches certain threshold and turned OFF on lower limit?

    What I Did:

    • Used OpenFreezeCenter to read CPU temps on Linux.
    • Interfaced a Pi Pico via USB serial using
    • /dev/ttyACM0
    • Connected the drone fan via a relay switch controlled by Pico.

    Monitored CPU temp using Prometheus and controlled fan operation via a Python script on Linux. (Because why not?)

    • Wrote a simple Python script that:
    • Turns the fan ON at 90°C.
    • Turns it OFF at 75°C.

    Result?

    A cool, quiet, and controlled setup where the fan runs only when needed, saving power, reducing noise, and keeping temps under check — even with the kind of load this laptop endures.

    Final Thoughts

    This is far from a polished product. But as a DIY solution, it’s cheap, practical, and super fun. If you’re someone who likes hacking hardware or giving a second life to old laptops, this might just be for you.

    System Overview

    Prometheus → Linux Script (Fan Logic + Mode Control)

    Serial (/dev/ttyACM0)

    Pi Pico → Relay → Drone Motor

    1. Setting up Prometheus for CPU Temp Install node_exporter:

    wget https://github.com/prometheus/node_exporter/releases/latest/download/node_exporter-linux-amd64.tar.gz
    tar -xvf node_exporter-linux-amd64.tar.gz
    cd node_exporter-*
    ./node_exporter

    2. Install Prometheus: Follow official instructions: https://prometheus.io/docs/prometheus/latest/installation/ 3. Configure prometheus.yml to scrape node_exporter:

    scrape_configs:
    - job_name: "node"
    static_configs:
    - targets: ["localhost:9100"]

    3. Test: Visit http://localhost:9090 → Query:

    node_hwmon_temp_celsius{chip="platform_coretemp_0"}

    Code
    1.cpu_temp_motor_control.py

    import requests
    import time
    import serial
    import os
    PROMETHEUS_URL = "http://localhost:9090/api/v1/query"
    SERIAL_PORT = "/dev/ttyACM0"
    BAUD_RATE = 9600
    PATH_TO_CONF = "/home/kuvi41/Documents/ofc/conf.txt"
    def get_cpu_temp():
    query = 'max(node_hwmon_temp_celsius{job="node", chip="platform_coretemp_0"})'
    try:
    response = requests.get(PROMETHEUS_URL, params={'query': query})
    result = response.json()
    value = float(result['data']['result'][0]['value'][1])
    return value
    except Exception as e:
    print("Failed to get temperature:", e)
    return None
    def set_mode(mode):
    if not os.path.exists(PATH_TO_CONF):
    print("conf.txt not found")
    return
    with open(PATH_TO_CONF, "r") as f:
    lines = f.readlines()
    if mode == "normal":
    lines[0] = "2\n"
    lines[1] = "0\n"
    elif mode == "cooler_booster":
    lines[0] = "4\n"
    with open(PATH_TO_CONF, "w") as f:
    f.writelines(lines)
    os.system("sudo python3 /home/kuvi41/Documents/ofc/write_EC.py")
    def main():
    try:
    ser = serial.Serial(SERIAL_PORT, BAUD_RATE, timeout=1)
    print(f"Serial connected on {SERIAL_PORT}")
    except Exception as e:
    print("Failed to open serial port:", e)
    return
    fan_state = None
    mode_state = None
    while True:
    temp = get_cpu_temp()
    if temp is not None:
    print(f"CPU Temp: {temp} °C")
    if temp > 95 and fan_state != "ON":
    ser.write(b"ON\n")
    print("Sent ON to Pi")
    fan_state = "ON"
    elif temp < 75 and fan_state != "OFF":
    ser.write(b"OFF\n")
    print("Sent OFF to Pi")
    fan_state = "OFF"
    if temp > 85 and mode_state != "cooler_booster":
    set_mode("cooler_booster")
    print("Switched to Cooler Booster")
    mode_state = "cooler_booster"
    elif temp < 76 and mode_state != "normal":
    set_mode("normal")
    print("Switched to Normal Mode")
    mode_state = "normal"
    time.sleep(5)
    if __name__ == "__main__":
    main()

    2.main.py (pi Pico)

    from machine import Pin
    import time
    import sys
    relay = Pin(15, Pin.OUT)
    relay.value(0)
    def readline():
    line = b""
    while True:
    c = sys.stdin.buffer.read(1)
    if c == b"\n":
    break
    line += c
    return line.decode('utf-8').strip()
    while True:
    cmd = readline()
    print("Received:", cmd)
    if cmd == "ON":
    relay.value(1)
    elif cmd == "OFF":
    relay.value(0)

    Stay tuned for my next post on how I integrated DeepSeek with LLaMA into my dev workflow!

  • My Homelab Setup: Learning Infrastructure the Practical Way

    Long ago I read a blog that said:

    “Homelabs are the perfect places to learn about technology infrastructure in hands-on ways.”

    After running my own homelab for some time, I can confidently say that this statement is absolutely true. A homelab is not just a playground for experimentation—it is one of the best environments to understand how real systems work together.

    Instead of spending time on theory, you can build, break, fix, and optimize real services.

    So let me show you what my homelab looks like.


    The Hardware

    My entire homelab runs on a single machine:

    Old MSI Laptop

    Specifications:

    • Intel Core i7 Processor
    • 24 GB RAM
    • SSD Storage
    • Running Linux

    Although this machine is old by modern standards, it is still more than powerful enough to run multiple services simultaneously.

    One of the best things about homelabs is that you don’t need expensive hardware. Many people start with retired laptops, mini PCs, or old desktops.


    Network Architecture

    My homelab is also responsible for handling parts of my home network.

    DNS + DHCP Server

    I use Pi-hole as my primary DNS server and DHCP server.

    Pi-hole helps me:

    • Block ads and trackers network-wide
    • Control DNS resolution
    • Monitor network traffic
    • Manage DHCP assignments

    Because all devices in my network use Pi-hole as DNS, I can easily monitor and control what domains are accessed.

    Additional DNS Filtering

    Alongside Pi-hole, I also run AdGuard.

    This gives me additional filtering and experimentation capabilities with different DNS blocking approaches.


    Services Running in My Homelab

    My homelab is not just for networking—it also runs several services for experimentation and development.

    Some of the services I run include:

    Local AI Experiments

    I run local LLaMA models to experiment with AI workloads.

    This allows me to:

    • Test local LLM inference
    • Run AI tools without cloud APIs
    • Experiment with AI integrations

    Running LLMs locally is a great way to understand resource usage and infrastructure requirements.


    Development Environment

    As a software developer, my homelab is also used for development work.

    I use it to host:

    • Development servers
    • APIs
    • Backend experiments
    • Self-hosted tools

    Having a dedicated local infrastructure makes it easier to test systems before deploying them to production.


    Network Experiments

    My homelab is also where I experiment with networking technologies such as:

    • DNS configurations
    • Private services
    • Network routing
    • Infrastructure tools

    This environment allows me to safely experiment without affecting production systems.


    Why I Love Homelabs

    A homelab teaches things that tutorials cannot.

    You learn:

    • Infrastructure design
    • Networking
    • Debugging real systems
    • Resource optimization
    • Service reliability

    More importantly, you learn how different systems interact in a real environment.


    Final Thoughts

    You don’t need expensive servers to build a homelab.

    An old laptop, a mini PC, or even a Raspberry Pi can become a powerful learning platform.

    If you are interested in:

    • DevOps
    • Networking
    • Self-hosting
    • Infrastructure engineering

    then building a homelab is one of the best investments you can make.

    Start small, experiment freely, and keep improving your setup.

    Your future self will thank you.

    Checkout my blog on how I handled the thermal issues of the same laptop @ https://vishnuprasadkuntar.me/posts/how-i-built-an-external-cooler-which-operates-on-internal-temperature-sensors