Feature

System Stats

Pico-based Tiny System Monitor

Dmytro Panin

Issue 67, February 2023

A handy display to keep an eye on your computer's resources in real time.

Back in November 2022 (Issue 64), we published a Raspberry Pi Based Sun Tracker by Ukranian-based Dmytro Panin. It used a RPi Pico to simulate the position of the moon and Earth around the sun, along with the time and sunrise/sunset times.

Another clever project by Dmytro is his computer system monitor, which also uses a Pico board. With the addition of a Pimoroni Display Pack, this clever computer system monitor provides a real-time view of the computer’s vital stats, including memory and SSD capacity, CPU and GPU usage, temperature, and more.

We contacted Dmytro and found out more.

We know you are living in Ukraine at the moment. Are you able to stay safe? And, from a maker's perspective, how do you go about sourcing electronic supplies for your projects?

These are very unprecedented times here in Ukraine. What we’ve learnt over the past few months, which are about to coalesce into a whole year now, is that people are extremely adaptable and resilient. As strange as it might sound, people here are getting used to the shelling. Just to provide an example, a few days ago a rocket hit a building very close to where I live. It was deafening, disorienting, and things in my apartment shook.. but just half an hour after that, people were out and about tending to the damage or continuing with their daily lives as if nothing extraordinary had happened.

From a maker's perspective, it’s become harder to get components from abroad, not impossible, but you need to wait longer and sometimes jump through some hoops to get what you need. That being said, one can get whatever a maker might need locally as well, we have a plethora of reliable resellers who import all sorts of electronic supplies for makers.

We hope you continue to stay safe and keep up with your amazing projects. Tell us about your tiny system monitor project. What was the reason you needed such a project to monitor your computer?

I wanted to see how my laptop performed when I was using full screen apps (mainly 3d rendering software and games) to fine tune all parameters including fan speed to make sure that I get the best performance and that my system doesn’t overheat or throttle.

At the time when I built this project I didn’t have access to an additional monitor so having something like that lying next to my laptop (ended up as magnetically attachable to the laptop’s screen) was a game changer.

What parts does it use and how does it work?

The hardware part is indeed isn’t too complicated and consists of:

  • Raspberry Pi Pico
  • Pimoroni Display Pack
  • Red LED and 100Ω resistor
  • Translucid 3D printed “inside fitting” to fit the magnet on one end with a light diffuser on the other

What data are you displaying and does the display change if any of the data becomes too high?

The following characteristics are displayed: CPU usage, GPU usage, available RAM, SSD’s capacity, network activity and CPU’s (SoC’s) temperature. The gauges represent the load in a gradient green-yellow-red fashion, hence if a given parameter is too high the red characterises this.

Do you have a driver in the computer sending the packets over USB?

From the software perspective, I’ve written a CLI utility for a host computer that monitors the following characteristics: CPU usage, GPU usage, available RAM, SSD’s capacity, network activity and CPU’s (SoC’s) temperature. The utility then combines and sends the binary data over USB to Tiny System Monitor, which, in turn, dynamically adjusts the gauges to the new values. The host program sends the data once a second to minimise its impact on the host system. I’ve mentioned that the gauges are adjusted “dynamically”, that’s me trying to say that since the client only receives data only once a second, it needs to fill in the gaps to have that smooth transition from an old value to a new one. The same goes for the network activity values. You can see what I’m trying to explain in the demo:
https://twitter.com/dr2mod/status/1557773285022203904

It draws its power from the connected USB port?

Yes, it doesn’t need any additional power source but USB.

What is the purpose of the LED? Where has this been wired to and is there a current limiting resistor?

The idea behind the LED is that it lights up to show that I am “busy”. People around me were “instructed” that when the device glows red to not disturb me as I was on a (video) call. It’s connected through a current limiting resistor of 100 Ohm.

Brilliant! Hopefully, avoids those embarrassing moments of people interrupting the call. Does this work with Windows and Linux, or just macOS?

While the host application was designed for macOS it took me about 5 minutes to adjust its code to work with Linux. It shouldn’t be complicated to modify it to work with windows as one of the core libraries of the program is cross platform.

Tell us how you went about coding it?

The coding was indeed the part that took the bulk of the build. Partially it had to do with the fact that I decided to go with the CircuitPython this time. I haven’t used it prior to this build and have only used MicroPython or C to program an RPi Pico.

Does it need the 3D enclosure you designed? Can you tell us more about this?

It’s not an enclosure per se, but an internal framework / fitting. While it’s not necessary, it definitely adds to the fun of the build. MacBooks have two magnets in their lids on opposite sides. The magnets are there for the laptop to know when the lid is closed. So I made use of those magnets and designed this 3D printed fitting that has a magnet of its own. I made this so then the device can be at my eye level when I need it.

That’s clever to use the magnet in the MacBook. What part, in particular, are you most proud of and why?

I like how the animation of the gauges turned out it helps sell the idea that the data flow is constant.

What part do you think you could have done better or would like to improve?

There are a lot of things that could be improved. When I began the project, I had a limiting factor of only having an RPi Pico and a Pimoroni display to work with. I didn’t have access to my home-lab or any other parts and I wanted to make something that works as soon as possible. All the additional 3d printed parts and magnets came later after I’d already been using my tiny system monitor for a while.

Was there any troubleshooting you needed to do to get it to work?

Surprisingly, there were many challenges I had to overcome during the development of this project. The one that did my head in was the fact that due to the change of the MacBook’s hardware M1-chip (Apple Silicon), I couldn’t get the SoC’s temperature via any system tool. Eventually, I found a piece of code in Objective-C that taps into the systems API and produces the data I need. As I settled on Python for the host cli tool as well, it wasn’t ideal that part of the host software was using another language, but it had to be done. Grin.

Is there anything else that our readers should know about the project that we haven’t covered?

The magnets came from an old photo lens that a friend of mine, whose trait is to repair photo cameras, disassembled under 2 mins when I asked him if he had any magnets to spare.

As I have two Tiny System Monitors built, I use one of them in pair with my RPi 3B+ home server.

If our readers wanted to make one for themselves, where can they get details, and code/3D files, etc?

The process should be fairly straightforward and described on the Tiny System Monitor’s GitHub page here: https://github.com/dr-mod/tiny-system-monitor

The 3d printed part can be found on the corresponding Printables page here: https://www.printables.com/model/358176-tiny-system-monitor

Wonderful. Out of curiosity, where do you get your inspiration from?

That’s a good one, I pretty much build what I or people around me need. I also keep a list of ideas and whenever something crosses my mind I tend to jot it down. Every now and again, when I don’t have a problem to solve and I just want to build something new, I review the ideas from the list and combine them if necessary. I believe it’s a part of the “Second Brain” method.

Are there any particular makers you follow on social media you could recommend?

Not really, I’m subscribed to various subreddits, explore Twitter and YouTube, that’s it. TBH, I didn’t even know makers had existed before someone started calling me one.

Thank you one again, Dmytro, for sharing your project with us.

Dmytro Panin

Dmytro Panin

Software Developer and Maker, Ukraine