A Python program implemented to monitor a CPU/GPU Water Cooling Unit with sensors connected with a Raspberry Pi Model 3 B+.
To develop a program that collects live data from temperature and water flow rate sensors installed in a central processing unit (CPU) / graphics processing unit (GPU) water cooling system. The program will output the collected data in a comma-separated values text file and in graph format that is live updated as long as the program is running.
The data monitoring program for the CPU/GPU Water Cooling Unit is implemented with a Python program, a Raspberry Pi Model 3 B+, DS18B20 digital temperature sensors, and Seeed G1/2" water flow sensors. The diagram for the prototype environment is shown in figure below.
The python program, which is run from the command line, is broken into two parts. The initial program connects to the Raspberry Pi and sensors to collect data and store the data in a comma-separated values text file. The second program reads the text file and separates the comma-separated rows of data and graphs each set of statistics against the timestamp.
The programs implement the following important Python packages: matplotlib and RPi.GPIO. The matplotlib library allows the final graph output to be generated, and the RPi.GPIO package allows for the ability to control the general purpose input output (GPIO) pins on the Raspberry Pi.
Install matplotlib
$ pip install matplotlib
Install RPi.GPIO
$ pip install RPi.GPIO
-
generate_data.py - This program displays usage and implementation of File I/O along with the interaction between hardware and software. Data is first collected from each connected temperature and/or flow rate sensor. Once all of the data is collected and properly interpreted, the data is written into a comma-separated values text file.
-
generate_graph.py - This program operates based off of the output of the
generate_data.py
program. The text file generated by the first program is pulled apart row by row, data entry by data entry. Then the data is plotted on a line graph. As both programs run, the graph will continually update every 15 seconds to contain the most recent 50 data entries recorded. -
Sample Output Graph - The figure below is an example output of the
generate_graph.py
program file based off of the data included in thetest_data.txt
file.