The HRMI Monitor application interfaces with a polar heart rate monitor interface (HRMI) to track and display heart rate information on-screen. This was developed with video game streamers in mind and generates a fake ECG display based on the heart rate read from the HRMI. Getting a clean ECG signal, especially using consumer equipment and while gaming, is borderline impossible; thus the goal of this is to fake the data based on the user’s actual heart rate.


The HRMI monitor is written entirely in Lua using the LÖVE engine and a couple extra Lua libraries. Serial communication is done through the librs232 library which facilitates communication between serial ports and Lua; All of the data written and read from the serial port is handled in Lua. LÖVE provided functionality is used for the main loop and rendering but otherwise most of the code is custom written.


To make the application more useful for streamers many of the elements rendered by the application are configurable. Modifications do need to be made to the Lua source code to do this (it wasn’t worth the effort to implement and make a config file) but the settings were setup to be as painless as possible to change inside the file. Things such as colors, positions, visibility, effects such as fading, behavior of the graphs, and more are all pretty easily configurable by the end user (however they do need to recompile the binaries, which is straightforward).

ECG Data

The main objective of this application was to make a heart rate monitor that could be used for streaming while playing video games. Having your heart rate displayed as a BPM value is cool, but an actual ECG looks a lot more impressive. It is possible to build cheap devices that can read and generate ECG data (and that was done during the development of this application) but ECG data is very noisy; any kind of movement tends to create noise in the data. Thus, the goal was to take the reliable/accurate source of information we had (the user’s BPM) and ‘fudge’ the rest of the information.

The two main pieces of data shown that are fake are the beat indicator and the ECG line. The ECG line is created by generating each wave that makes up real ECG data based on the user’s current heart rate with minor ranges of randomization. Each full section of data is made up of multiple waves/sections which are clearly defined in their behavior (and linked to actual events happening with the heart in real ECG data). By generating each of these sections with lengths based on the user’s current heart rate, plus a bit of randomization, we can create somewhat convincing looking ECG data. The heart beat indicator is very easy to do given we are generating the ECG data ourselves; When we are simulating the ECG data and we are in the QRS complex (the large spike) we consider the heart to be ‘beating’.