-
Notifications
You must be signed in to change notification settings - Fork 17
/
Nvidia_GPU_Temperature.py
43 lines (33 loc) · 1.33 KB
/
Nvidia_GPU_Temperature.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
""" Easily see your GPU temperature while gaming! This sets the LED colors base on your Nvidia GPU temperature, every second.
60F = green, 70F = yellow, 80F = red
"""
import time
from blinkytape import BlinkyTape
import subprocess
import os
import re
# To find your COM port number in Windows, run "Pattern Paint -> Help -> System Information"
#bb = BlinkyTape('/dev/tty.usbmodemfa131')
bb = BlinkyTape('COM3')
while True:
output = str(subprocess.check_output(
["C:\\Program Files\\NVIDIA Corporation\\NVSMI\\nvidia-smi.exe", "-a"], shell=True))
# os.popen('C:\\Program Files\NVIDIA Corporation\NVSMI\nvidia-smi.exe')
#output=os.popen("C:\\Program Files\\NVIDIA Corporation\\NVSMI\\nvidia-smi.exe").read()
#print("====" + str(output) + "=====")
temp = re.search("GPU Current.*", output).group()[30:33]
temp_baseline = 55 # configure to you base line temp here
temp_multiplier = 5
color_temp = (int(temp) - temp_baseline) * temp_multiplier
green = min(254, max(0, 100 - color_temp))
red = min(254, max(0, 0 + color_temp))
blue = 0
print("Current GPU Temp: %s RGB: %s %s %s" % (temp, red, green, blue))
for x in range(60):
bb.sendPixel(red, green, blue)
bb.show()
# time.sleep(1)
# for x in range(60):
# bb.sendPixel(100, 0, 0)
# bb.show()
time.sleep(1)