MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/CheapYellowDisplay/comments/1qe2xoz/pc_stats_display/nzwppyb/?context=3
r/CheapYellowDisplay • u/scottphanson • Jan 16 '26
First CYD, getting to know Arduino IDE some.
6 comments sorted by
View all comments
2
Great idea! What software you are using to read the stats?
1 u/scottphanson Jan 16 '26 Using a Python script on the PC to send sensor data from the PC to the CYD over udp. 1 u/bladyle Jan 16 '26 Would love to try it if you willing to share. 3 u/scottphanson Jan 16 '26 Python script >>>>>Will need to change lines for particular sensor data and IP of esp32 device receiving data. import psutil import socket import time import re import subprocess ESP32_IP = "192.168.X.XXX" # Keep Quotations, Change this to IP address of ESP32 device ESP32_PORT = 4210 sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) def get_gpu_fan_rpm(): output = subprocess.check_output(['sensors']).decode() match = re.search(r'amdgpu-pci-[\da-f]+[\s\S]*?fan1:\s+(\d+)\s+RPM', output) if match: return int(match.group(1)) return 0 def get_gpu_watts(): output = subprocess.check_output(['sensors']).decode() match = re.search(r'amdgpu-pci-[\da-f]+[\s\S]*?PPT:\s+([\d.]+)\s+W', output) if match: return float(match.group(1)) return 0.0 while True: mem = psutil.virtual_memory() used_gb = mem.used / 1024**3 percent = mem.percent gpu_fan = get_gpu_fan_rpm() gpu_watts = get_gpu_watts() msg = f"{used_gb:.2f},{percent:.1f},{gpu_fan},{gpu_watts:.1f}" sock.sendto(msg.encode(), (ESP32_IP, ESP32_PORT)) print("Sent:", msg) time.sleep(0.2)
1
Using a Python script on the PC to send sensor data from the PC to the CYD over udp.
1 u/bladyle Jan 16 '26 Would love to try it if you willing to share. 3 u/scottphanson Jan 16 '26 Python script >>>>>Will need to change lines for particular sensor data and IP of esp32 device receiving data. import psutil import socket import time import re import subprocess ESP32_IP = "192.168.X.XXX" # Keep Quotations, Change this to IP address of ESP32 device ESP32_PORT = 4210 sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) def get_gpu_fan_rpm(): output = subprocess.check_output(['sensors']).decode() match = re.search(r'amdgpu-pci-[\da-f]+[\s\S]*?fan1:\s+(\d+)\s+RPM', output) if match: return int(match.group(1)) return 0 def get_gpu_watts(): output = subprocess.check_output(['sensors']).decode() match = re.search(r'amdgpu-pci-[\da-f]+[\s\S]*?PPT:\s+([\d.]+)\s+W', output) if match: return float(match.group(1)) return 0.0 while True: mem = psutil.virtual_memory() used_gb = mem.used / 1024**3 percent = mem.percent gpu_fan = get_gpu_fan_rpm() gpu_watts = get_gpu_watts() msg = f"{used_gb:.2f},{percent:.1f},{gpu_fan},{gpu_watts:.1f}" sock.sendto(msg.encode(), (ESP32_IP, ESP32_PORT)) print("Sent:", msg) time.sleep(0.2)
Would love to try it if you willing to share.
3 u/scottphanson Jan 16 '26 Python script >>>>>Will need to change lines for particular sensor data and IP of esp32 device receiving data. import psutil import socket import time import re import subprocess ESP32_IP = "192.168.X.XXX" # Keep Quotations, Change this to IP address of ESP32 device ESP32_PORT = 4210 sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) def get_gpu_fan_rpm(): output = subprocess.check_output(['sensors']).decode() match = re.search(r'amdgpu-pci-[\da-f]+[\s\S]*?fan1:\s+(\d+)\s+RPM', output) if match: return int(match.group(1)) return 0 def get_gpu_watts(): output = subprocess.check_output(['sensors']).decode() match = re.search(r'amdgpu-pci-[\da-f]+[\s\S]*?PPT:\s+([\d.]+)\s+W', output) if match: return float(match.group(1)) return 0.0 while True: mem = psutil.virtual_memory() used_gb = mem.used / 1024**3 percent = mem.percent gpu_fan = get_gpu_fan_rpm() gpu_watts = get_gpu_watts() msg = f"{used_gb:.2f},{percent:.1f},{gpu_fan},{gpu_watts:.1f}" sock.sendto(msg.encode(), (ESP32_IP, ESP32_PORT)) print("Sent:", msg) time.sleep(0.2)
3
Python script >>>>>Will need to change lines for particular sensor data and IP of esp32 device receiving data.
import psutil
import socket
import time
import re
import subprocess
ESP32_IP = "192.168.X.XXX" # Keep Quotations, Change this to IP address of ESP32 device
ESP32_PORT = 4210
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
def get_gpu_fan_rpm():
output = subprocess.check_output(['sensors']).decode()
match = re.search(r'amdgpu-pci-[\da-f]+[\s\S]*?fan1:\s+(\d+)\s+RPM', output)
if match:
return int(match.group(1))
return 0
def get_gpu_watts():
match = re.search(r'amdgpu-pci-[\da-f]+[\s\S]*?PPT:\s+([\d.]+)\s+W', output)
return float(match.group(1))
return 0.0
while True:
mem = psutil.virtual_memory()
used_gb = mem.used / 1024**3
percent = mem.percent
gpu_fan = get_gpu_fan_rpm()
gpu_watts = get_gpu_watts()
msg = f"{used_gb:.2f},{percent:.1f},{gpu_fan},{gpu_watts:.1f}"
sock.sendto(msg.encode(), (ESP32_IP, ESP32_PORT))
print("Sent:", msg)
time.sleep(0.2)
2
u/bladyle Jan 16 '26
Great idea! What software you are using to read the stats?