This project consists of two components:
- A Windows utility to retrieve, process and send system statistics in a simple string of characters to a serial port.
- An STM32 connected to a TFT screen to receive the serial data and display a smooth scrolling line graph of the statistics over time.
A little known feature on the ILI9341 TFT controller is used to achieve the smooth scrolling: rather than attempting to redraw contents of the screen fast enough to achieve fluid motion, the hardware based vertical scrolling feature is used to shift a window of pixels to the left each time the main loop completes. The oldest vertical graph line is then erased and re-drawn with the new graph lines.
Use of the STM32 is probably overkill for this project, however they're often cheaper (and much more powerful) than a similar small Arduino style board.
The Windows utility can run in two modes: with and without administrator privileges. Both will launch the app in the background and will display an icon in the system tray.
When run as a standard user (i.e. not as administrator) the app will use the native Windows performance counters to collect CPU and RAM utilisation statistics. This mode uses a very small amount of CPU and memory to run and prevents the UAC prompt from being shown when the app is started, hence making it a convenient option for automatically launching the program at system startup.
More detailed statistics including system temperatures can be collected through the Open Hardware Monitor library when the app is launched as an administrator. This mode uses slightly more CPU and RAM. The STM32 will automatically detect the presence of the additional statistics and will start graphing them accordingly.
On the first launch, the app will try to determine the most appropriate serial port to send the data to. This can be customised in the app's main Window, along with the update interval and baud rate. Settings are saved in the registry and are persistent between launches of the application.
The hardware setup is very simple - the TFT screen is connected to the STM32 according to the pin assignment in the platformio.ini file. By default this is:
|ILI9341 Pin||STM32 Pin|
There are a few caveats to using the STM32 blue pill board, some of which may cause problems with serial communication. They're documented here: https://stm32duinoforum.com/forum/wiki_subdomain/index_title_Blue_Pill.html#Known_issues
I've not encountered any of these problems on the boards I've used, though it's worth noting.
The Windows app has an additional Output setting, along with a colour slider. Implementation of this feature will be completed in a future release, and will provide realtime ambient visualisation of resource utilisation or temperature using WS2812B LEDs.