Using keyboard as an output device
Nov 16, 2020, 10:46 AM
In our previous post, we fixed a backlit keyboard. In this post, Arto Kaitosaari reveals how he actually makes use of the customizable lighting feature of his keyboard.
When RGB-keyboards started gaining popularity, I was a bit confused. I just did not understand why I would want to have my keys flashing to the beat of the music. But when I upgraded my keyboard to a mechanical one, it did have those LEDs in place. So, for the first time I started thinking if those things could be used for some practical purpose. And as it turns out, they can!
Usually a keyboard is just an input device. You can send information to the computer by pressing the keys, but the computer does not talk you back through it. However, if you have an RGB keyboard, you can use those LEDs to convey some useful information and thus use the keyboard as an output device.
Using LED colors as an information radiator
I don’t have a separate information radiator screen at home, so there’s no easy way to see if our builds are failing or if the status of different systems is degraded. To fix this I decided to color my keyboard according to different status information.
Now I can just quickly glance at my keyboard and see both the status of our builds and the status of my VPN connection.
Whenever my function keys are colored red, I need to stop what I’m currently doing and check if there’s something wrong with our systems. And to connect to some internal systems, I need an active VPN connection which is indicated by the overall color of my keys.
I personally find these color indicators really helpful. I no longer need to keep checking my emails or slack messages for system status notifications and I can keep those programs closed when I want to focus on something else.
So how does it all work?
I have a Logitech G815 keyboard and unfortunately the LED configuration tool that ships with it (G-Hub) supports only some flashy animations and other pretty useless effects. But it does ship with an easy to use SDK, which you can use to control the LED colors from an external program!
So, I wrote a small program which controls the RGB LEDs on my keyboard. This program starts automatically after I log in to Windows, monitors the status of my VPN connections and colors my keys accordingly.
Getting the system/build statuses displayed on my function keys required a bit more work since some of the source systems are sitting behind firewalls and I cannot query their statuses directly from my home.
To get this information I added a couple of scripts on the build servers themselves. These scripts periodically publish the statuses to Azure Table Storage using Azure Functions from where my little keyboard application is able to read them. I could of course have used any publicly available cloud service for this, but I do like the fact that the color of my *function keys* are managed by *Azure Functions* (pun intended).
If you want to see the actual code, it’s available in GitHub.
Read previous parts in the keyboard series:
Arto Kaitosaari is a Senior Software Architect at Nitor. He has been designing and implementing IT solutions for over 20 years. Even though Arto has a history of implementing document management and archival systems, he still takes his notes using pen and paper.