- new "hrv-log"-app for the bangle.js2 smartwatch
- logging your session into "hrv-data-n.log" (n=0,1,2,3...)
- python script to merge and visualize the data you recorded
import json
import matplotlib.pyplot as plt
import os
def read_log_data(directory_path):
"""
Durchsucht ein Verzeichnis nach Log-Dateien und gibt alle gefundenen HRV-Daten zurück.
"""
all_log_data = []
for filename in os.listdir(directory_path):
if filename.startswith("hrv-data") and filename.endswith(".log"):
filepath = os.path.join(directory_path, filename)
with open(filepath, 'r') as file:
log_data = json.load(file)
all_log_data.append(log_data)
return all_log_data
def plot_hrv_data(all_log_data):
"""
Visualisiert HRV-Daten (BPM-Werte und möglicherweise RR-Intervalle, falls vorhanden) aus mehreren Log-Dateien.
"""
plt.figure(figsize=(10, 6))
# BPM- und RR-Intervalle aus allen Daten extrahieren und visualisieren
for log_data in all_log_data:
bpm_values = log_data['bpmValues']
plt.subplot(2, 1, 1)
plt.plot(bpm_values, label='BPM', color='blue', alpha=0.5)
if 'rrIntervals' in log_data and len(log_data['rrIntervals']) > 0:
rr_intervals = log_data['rrIntervals']
plt.subplot(2, 1, 2)
plt.plot(rr_intervals, label='RR-Intervalle', color='red', alpha=0.5)
# BPM-Graph anpassen
plt.subplot(2, 1, 1)
plt.xlabel('Zeit (s)')
plt.ylabel('BPM')
plt.title('Herzschlag pro Minute (BPM) über die Zeit')
plt.legend()
# RR-Intervall-Graph anpassen
plt.subplot(2, 1, 2)
plt.xlabel('Zeit (s)')
plt.ylabel('Sekunden')
plt.title('RR-Intervalle über die Zeit')
plt.legend()
plt.tight_layout()
plt.show()
def main():
# Pfad zum Verzeichnis der Log-Dateien
directory_path = 'C:/PATH TO YOUR/DATA-LOG/DIRECTORY' # <<< Update this
# Lese alle Log-Daten
all_log_data = read_log_data(directory_path)
# Visualisiere die HRV-Daten aus allen Dateien
plot_hrv_data(all_log_data)
if __name__ == '__main__':
main()
DISCLAMER: This project is not intended to be used as a medical device, use of this device for those purposes is at your own risk.
HRV training, a favorite among bodybuilders and elite soldiers, offers a unique way to gain insights and control over one's physiological state. Known for its use by the Navy SEALs and proven in various field scenarios, HRV training is lauded for its potential to lower burnout rates under stress. (1)
Democratizing HRV-TrainingThis form of training leverages devices like the Emwave2, which, despite its effectiveness, comes with a steep price tag. This sparked my curiosity to create a simplified version for the Bangle.js 2 smartwatch, making use of its built-in sensors. The motivation was clear: the official app store lacked a straightforward HRV training app, and the existing options required external Bluetooth devices, which was less than ideal.
Breaking it downTaking matters into my own hands, I drew upon my own experience as a user of the Emwave2 and other biofeedback devices to design a simpler, yet effective HRV training tool.
The result? Two new apps: "HRV" and "HRV-Guide." The "HRV" app shows your heartbeat and HRV value over a short period, along with a graph visualizing the heart rate, making the data easily understandable at a glance.
The "HRV-Guide" app builds on this by adding a practical training feature: it vibrates every seven heartbeats, mimicking my impression of the basic training session similar to the Emwave2's easiest setting. Of course, the devices have a way more complicated algorhytmn.
This feature is designed to help users sync their breathing with their heartbeat, a practice that taps into a different nervous system pathway, potentially leading to greater control and resilience in high-pressure situations.
The Magic Number is 7The approach here is simple: by breathing in for seven beats and out for seven beats, you can align your body's responses, fostering a sense of calm and control.
Try to count your heartbeats, breath really simple, not squishy, only trough the nose.
Dont breath up, breath inside. It's a straightforward, no-frills method that opens up the benefits of HRV training to anyone with a Bangle.js 2, bypassing the need for expensive gadgets.
Try to feel your HeartSo, if you're looking for a way to get started with biohacking and want to experiment with HRV training, these apps offer a great jumping-off point.
Comments
Please log in or sign up to comment.