Introduction: OPEN External Hardware Monitor
Hi guys! Today I will show you how create an external hardware monitor with any Arduino board(in my case a pro micro board), a Nokia 5110 LCD and some VB programming! Let's get started!
ps. Sorry for my bad english
Step 1: What Is the Aim?
The aim of this project is for monitoring pc hardware while you're in game. There are other many system to do that, like afterburner ingame overlay, but for me is too cumbersome (this covers always the GUI in every videogame). So i decided to create my own external system for HW monitoring!
Step 2: Materials
-Arduino board
-Nokia 5110 LCD
-Some wires
-A breadboard
Step 3: Wiring the LCD to Arduino!
Here are my connections:
VCC -> Arduino 3.3V
LIGHT -> Arduino GND (I am going to be using it on)
GND -> Arduino GND
CLK (SCLK) -> Arduino pin 7
DIN (MOSI) -> Arduino pin 6
DC -> Arduino pin 5
CE or CS -> Arduino pin 4
RST (RESET) -> Arduino pin 3
Remember that! The LCD runs on 3.3V ! With 5V, it has worked but gave some weird effects, so I suggest connecting to the 3.3V output of the arduino.
Step 4: Some Arduino Codes and Libraries!
For the LCD, we use Adafruits Libraries:
Adafruit_PCD8544: Here
Adafruit_GFX: Here
The code: For this code i decided to monitor Temperature, Load,Fan Usage, Clock and Memory Clock of my GPU. For these "parameters" i have created a few variables for serial reading and for casting to string(so we can display the values on the LCD)
You don't know how works parseInt()? ->Solution!
Finally the code:
#include
#include #includeAdafruit_PCD8544 display = Adafruit_PCD8544(7, 6, 5, 4, 3);
byte temp; String temps;
int clk; String clks;
int mem; String mems;
byte load; String loads;
byte cont; String conts;
void setup() { Serial.begin(9600); display.begin(); display.setContrast(50); display.clearDisplay(); display.setTextSize(1); }
void loop() {
if (Serial.available()) { clk = Serial.parseInt(); mem= Serial.parseInt(); temp = Serial.parseInt(); load = Serial.parseInt(); cont = Serial.parseInt(); } clks=String(clk); mems=String(mem); temps=String(temp); loads=String(load); conts=String(cont); display.setTextColor(BLACK); display.setCursor(0,0);display.println("GPU CLCK");display.setCursor(50,0);display.println(clks+"M"); display.setCursor(0,10);display.println("GPU MEMO");display.setCursor(50,10);display.println(mems+"M"); display.setCursor(0,20);display.println("GPU TEMP");if(temp<100){display.setCursor(50,20);display.println(temps+" C");}else{display.setCursor(50,20);display.println("ALERT");} display.setCursor(0,30);display.println("GPU LOAD");display.setCursor(50,30);display.println(loads+" %"); display.setCursor(0,40);display.println("GPU FANS");display.setCursor(50,40);display.println(conts+" %"); display.display(); display.clearDisplay(); }
Step 5: Now VB :D
First of ALL upload the sketch to your arduino board, open the serial monitor and write "100,1500,60,100,100"
Now this appear on the LCD:
--------------------------------
GPU CLCK 100M
GPU MEMO 1500M
GPU TEMP 60 C
GPU LOAD 100%
GPU FANS 100%
--------------------------------
Now we can create our program for sending values to arduino!
- Open Visual Studio and create a new windows application in VB
- Import in our program OpenHardwareMonitorLib(you can find DLL here)
- Create labels according to your parameters you want to send (in this case 5)
- 2 button for start and stop serial comunication
- A timer
- A background worker
- A serial port
- A textbox for COM name
Now code:
Imports OpenHardwareMonitor.Collections<br>Imports OpenHardwareMonitor.Hardware
Imports System.IO
Imports System.IO.Ports
Imports System.Threading
Imports System.ComponentModel
Public Class Form1
Dim flag As Boolean
Dim cp As New Computer()
Public Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
Timer1.Start()
cp.GPUEnabled = True
cp.CPUEnabled = True
cp.Open()
End Sub
Public Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
For Each hw In cp.Hardware
If hw.HardwareType = HardwareType.GpuAti Then 'If you have a NvidiaGPU write".GpuNvidia"
hw.Update()
For Each sensor In hw.Sensors
If sensor.SensorType = SensorType.Temperature Then
GTEMP.Text = sensor.Value
End If
If sensor.SensorType = SensorType.Load Then
GLOAD.Text = sensor.Value
End If
If sensor.SensorType = SensorType.Control Then
GFAN.Text = sensor.Value
End If
If sensor.SensorType = SensorType.Clock Then
If sensor.Name.Contains("Core") Then
GCCLK.Text = Convert.ToInt64(sensor.Value)
End If
End If
If sensor.SensorType = SensorType.Clock Then
If sensor.Name.Contains("Memory") Then
GMCLK.Text = sensor.Value
End If
End If
Next
End If
Next
End Sub
Private Sub BackgroundWorker1_DoWork(sender As Object, e As DoWorkEventArgs) Handles BackgroundWorker1.DoWork
Do While flag = True
SerialPort1.Write(GCCLK.Text + "," + GMCLK.Text + "," + (GTEMP.Text) + "," + (GLOAD.Text) + "," + (GFAN.Text))'this send the values to arduino
delay(1500)'we need this delay(1.5s) because this is the refresh rate of the LCD, if you modify it lower than 1.5 the lcd doesn't refresh!
Loop
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
SerialPort1.Close()
SerialPort1.PortName = TextBox1.Text
SerialPort1.BaudRate = 9600
SerialPort1.DataBits = 8
SerialPort1.Parity = Parity.None
SerialPort1.StopBits = StopBits.One
SerialPort1.Handshake = Handshake.None
SerialPort1.Encoding = System.Text.Encoding.Default
SerialPort1.Open()
flag = True
BackgroundWorker1.RunWorkerAsync()
End Sub</p><p> Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click</p><p> flag = False
SerialPort1.Close()
End Sub
'delay function
Private Declare Function timeGetTime Lib "winmm.dll" () As Long
Public lngStartTime As Long
Public Sub delay(msdelay As Long)
lngStartTime = timeGetTime()
Do Until (timeGetTime() - lngStartTime) > msdelay
Loop
End Sub
'End delay function</p><p>End Class
<br>Step 6: The End and Considerations!
Now test your program and check if it works!
(If there are problems, post comments and I help you)
Congratultion! You made it :D
Now YOU CAN upgrade this project, ex. add rgb led,add a buzzer; update the arduino and VB code
Post your version in the comments! :D

