Saturday, May 1, 2021

Underwater ECG/HRV - Movesense Datalogger tutorial

The Movesense ECG is a very handy device. It consists of a single lead ECG with up to a 512 Hz sample rate in a chest belt form factor, and is available for a reasonable price.  It also possesses "onboard" memory for the data it is acquiring such as the ECG tracing.  Although most users will not need this modality, for those interested in "recording device free" sessions such as in water exercise (with loss of bluetooth transmission), the unit is able to store about 6 minutes of ECG data at a sample rate of 250 Hz. Since dynamic HRV research is quite scare for the sport of swimming, this could be a game changer for those interested in ECG/HRV during the swimming activity itself.

The following is a brief run through on how to do a series of recording sessions using the data logger.

Requirements - Movesense ECG with version 2 firmware, Data logger for android (and an android device).  The Data logger is in this folder - https://bitbucket.org/suunto/movesense-mobile-lib/downloads/ and called "DataLoggerSample-app-debug-1.1.apk".  Install it on your android device.

Starting a recording session:

  • Get the ECG unit in place with conductive cream or similar.
  • Open the Data logger.  You will see the "scan" screen - press the scan button to look for your device

  • Your device should show up - click on it
  • There will be some choices we need to make - the important one is to select the "path" and choose ECG
  • Like this - select the ECG/250 line:
 
  • We should be ready to start the "log" - press "start logging"
  • When you are done, press "stop logging"

  • We will see the file show up below:

  • The file will not be saved unless you click, open it and hit save.

  • After hitting save you are ready for another session recording - hit "create new log" and the "current log ID " should advance (and the old data will be overwritten in the device). 
  • Note that current log is now #4:


  • If you have a series of entries, remember to click, open and save each one.  You may want to keep a separate file of log # and what you were recording since there is no way to annotate the files otherwise.
  • The logs are stored in the "Download" folder and correspond to the log numbers in the above window.  You can copy them to your PC, dropbox etc.

What do we do with the json files?  Before Kubios can read the ECG, we need to parse the json file into a csv with time stamps and signal voltage.  For now, I'm going to share the instructions given to me by Petri Lipponen (lead engineer for the device who was kind enough to write the logger software).  

 There are a couple of possibilities without going to actual programming languages:

  • Just do a quick search-replace with a good text editor (this is what I usually use). For best editor I’d recommend “NotePad++” for windows, I’ve based these instructions to that editor (See attachments for screengrabs):
    1. Press Ctrl-H to open replace-dialog. Se Search Mode to “Extended” and Search for “Samples”:[  and replace with \n (line-feed). Click “Replace All”
      -> Now you should have alternating lines starting with sample data or other stuff
    2. Search for “]},”Timestamp”  and replace with \n. Click “Replace All”
      -> Now you should have every second line just samples
    3. In search window Open “Mark” tab. Set “Bookmark line” checkbox, Set “Find what” to RequiredSampleRate and click “Mark All”.
      -> This creates bookmarks to lines that don’t have data
    4. In menus choose “Search->Bookmark->Remove Bookmarked Lines”
      -> Now you only have lines of 16 samples
    5. Back to Replace dialog and Search for , (comma) and replace again with \n
      -> Now you have a csv file that only contains one column (samples)
    6. Save as with name ending to .csv

Following these instructions, here is the end result with my tracing:


Picture perfect waveform!  


When I get to the point of doing large scale conversions, I'll write a script to do it, but you can use this for now.  If you end up writing a script, please share with us and I'll add it to this post.


Heart rate variability during dynamic exercise

No comments:

Post a Comment