element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Blog cpu monitor panel
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Former Member
  • Date Created: 12 Apr 2019 5:14 PM Date Created
  • Views 1681 views
  • Likes 9 likes
  • Comments 8 comments
  • python
  • systemmonitor
  • arduino
Related
Recommended

cpu monitor panel

Former Member
Former Member
12 Apr 2019

There seems to be plenty of LCD screen that fit onto the front of a desktop pc which display time, sometimes temperatures and fan speeds. I'm looking to expand on this and create an LCD screen that can be used to monitor the system performance such as memory and cpu usage.

 

The current LCD's take their data from temperature headers (some boards have them) and usually fan speeds directly from the fans themselves, to include system performance stats we need to be able to get that information out of the operating system and onto the LCD screen.

 

A great way of doing this would be through the serial (COM) header on the main board, most desktop computers don't have a physical serial port anymore but they do usually have a header on the main board. Since the LCD is to be mounted onto the front of the desktop case, we can connect directly to that header inside.

 

This is an overview of the system I have in mind:

 

Python script on PC >>> COM port >>> Arduino >>> LCD

 

An Arduino acts as the main system holding the drawing functions for the LCD. When the Arduino wants to refresh the data on the screen, it polls the COM  port which signals a Python script on the PC to collect the performance figures and send them back to the Arduino. The Arduino can then update the LCD.

 

It would be a great way for gamers, content producers and others who put their computer under heavy load to keep an eye on their systems performance.

 

I'm waiting on an LCD coming but have gotten on with the software aspect to test whether it is possible to get the information we need using Python. Since I don't have the LCD yet I used pygame to replicate it.

 

image

 

and a video of it in action...

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

Here is the Python script I used:

 

import sys
import psutil
import threading
import pygame
import pygame.locals



#SETUP PYGAME
pygame.init()
pygame.display.set_caption('sysmon')



#CREATE COLORS
backgroundColor = (100,100,100)
tbackgroundColor = (0,100,100)
titleColor = (255,255,0)
labelColor = (255,0,0)
labelYellowColor = (255,255,0)

#CREATE FONTS
titleFont = pygame.font.SysFont("monospace", 25)
labelFont = pygame.font.SysFont("monospace", 15)

#CREATE DRAWING SCREEN
WIDTH = 400
HEIGHT = 300
screen = pygame.display.set_mode((WIDTH, HEIGHT), 0, 32)
screen.fill(backgroundColor)
pygame.draw.rect(screen,tbackgroundColor,(0,50,400,250))

#CREATE AND DRAW STATIC LABELS
titleLabel = titleFont.render("SYSTEM MONITOR", 1,titleColor)
screen.blit(titleLabel, (100, 0))
coreLabelValue = "cores: " + str(psutil.cpu_count(logical=False))
coreLabel = labelFont.render(coreLabelValue, 1, labelColor)
screen.blit(coreLabel, (0, 30))
threadLabelValue = "threads: " + str(psutil.cpu_count())
threadLabel = labelFont.render(threadLabelValue, 1, labelColor)
screen.blit(threadLabel, (100, 30))
memTotalLabelValue = "total mem: " + str("%.2f" %(float(psutil.virtual_memory().total) / 1073741824)) + "GB"
memTotalLabel = labelFont.render(memTotalLabelValue, 1, labelColor)
screen.blit(memTotalLabel, (220, 30))
cpuUsageLabel = labelFont.render("cpu_usage", 1,labelYellowColor)
screen.blit(cpuUsageLabel, (100, 100))
memUsageLabel = labelFont.render("mem_usage", 1,labelYellowColor)
screen.blit(memUsageLabel, (100, 130))
   
#DEFINE A THREAD OBJECT
class ConstantThread(threading.Thread):
     
     def run(self):
    #use a while loop to keep the thread and app alive
         while True:
        
        #grab the system data and convert to a string
        cpuuse = str(psutil.cpu_percent(interval=0.5)) + "%"
        memuse1 = str(psutil.virtual_memory().percent) + "%"
        memuse2 = "("+ str("%.2f" %(float(psutil.virtual_memory().used) / 1073741824)) + "GB)"
        
        #send the system data to be drawn to the screen
        updateScreen(cpuuse,memuse1,memuse2)
        
        #if the exit button on the pygame window is pressed, close the app
        for event in pygame.event.get():
            if event.type == pygame.locals.QUIT:
                         pygame.quit()
                         sys.exit()

#FUNCTION TO RESFRESH ACTIVE LABELS AND REDRAW SCREEN AREAS
def updateScreen(cpuuse,memuse1,memuse2):
    pygame.draw.rect(screen,tbackgroundColor,(200,50,200,250))
    cpuLabel = labelFont.render(cpuuse, 1, labelYellowColor)
    screen.blit(cpuLabel, (200, 100))
    mem1Label = labelFont.render(memuse1, 1, labelYellowColor)
    screen.blit(mem1Label, (200,130))
    mem2Label = labelFont.render(memuse2, 1, labelYellowColor)
    screen.blit(mem2Label, (260,130))
    pygame.display.flip()

thread1 = ConstantThread() #create the thread instance
thread1.start() #start the thread




sys.exit()

 

If you want to try it out remember to use pip to install pygame and psutil first

 

The next stage is to get the Arduino to communicate with this script through the COM port which I can get on with while waiting for the LCD to arrive image

  • Sign in to reply

Top Comments

  • 14rhb
    14rhb over 6 years ago +2
    Sounds like a really good and useful project, good luck. I look forward to seeing any progress. Rod
  • DAB
    DAB over 6 years ago +2
    Nice post, Glad to see you back on the site. DAB
  • ralphjy
    ralphjy over 6 years ago +2
    Is there a reason that you don’t want to use a USB port for communication? It would make the unit portable and wouldn’t require special connections.
  • Gough Lui
    Gough Lui over 6 years ago

    In the old days, I used to use an HD44780-compatible display and a homebrew cable to the parallel port to drive a character LCD with the LCD Smartie software (freeware) running in the background collecting various information from plugins to display on the LCD. Pretty cool for the day, and eventually, I even used an Arduino to drive the HD44780 so that I could use LCD Smartie with a USB-connected screen as parallel ports started to be phased out.

     

    - Gough

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • beacon_dave
    beacon_dave over 6 years ago in reply to beacon_dave

    "On a side note, can anyone remember the display technology which came out a few years back which was a small low powered LCD display embedded into the outside of a laptop lid which could display various cached information whilst the laptop was powered down ?"

     

    In answer to my own question it was 'Windows SideShow' that I was thinking of:

    https://en.wikipedia.org/wiki/Windows_SideShow

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • ralphjy
    ralphjy over 6 years ago in reply to Former Member

    Ok, I understand.  I guess I never use up all my USB ports image.  Just thought it would be easier than doing the level conversion from the serial port.  Good luck with your project.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • beacon_dave
    beacon_dave over 6 years ago

    This sounds a bit like the Crystal Control software:

    https://www.crystalfontz.com/software/crystalcontrol2/manual/intro.html

    which is available for the Crystal Fontz range of drive  bay screens.

    https://www.crystalfontz.com/

     

    May be of interest.

     

    On a side note, can anyone remember the display technology which came out a few years back which was a small low powered LCD display embedded into the outside of a laptop lid which could display various cached information whilst the laptop was powered down ?

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Former Member
    Former Member over 6 years ago in reply to ralphjy

    Sure! The idea can easily be modified to run from USB and made portable its just not the goal I have in mind, I like the idea of having an LCD screen built into the computer case that has some ability to display and modify performance. With it being built in the screen would be on the outside of the case and the electrical connections on the inside so it would be advantageous to use the internal headers on the motherboard to send over signals.

     

    On mine and probably most other peoples desktop computer, all of the internal USB and USB3 headers are already in use and linked up to connectors on the case but the COM port generally never gets used and is pretty easy to use too, in the sense that its proposed I don't really see it as being a special connections since external sockets, power switches, drive lights all need to be connected to the motherboard in the same way. Its just another peripheral.

     

    Its a great question and a portable version would be just as great image

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube