Skip to content

01Qin/HeartRateDetector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 

Repository files navigation

❤️ Heart Rate and HRV Monitor (Raspberry Pi Pico + Kubios Cloud)

MicroPython Raspberry Pi Pico License: MIT Kubios Cloud

A real-time heart rate (HR) and heart rate variability (HRV) monitor built on the Raspberry Pi Pico, using MicroPython, OLED visualization, and Kubios Cloud for advanced analytics.


🩺 Features

  • Real-time ECG/PPG sampling via ADC (GPIO 26, 250 Hz)
  • On-device HRV computation:
    meanHR, meanPPI, SDNN, RMSSD, SD1, SD2
  • OLED display with live signal and menu navigation
  • Rotary encoder input with push-button control
  • LED pulse indicator synchronized with heartbeat
  • Wi-Fi integration for Kubios Cloud readiness analysis
  • Persistent JSON storage for session history
  • Error feedback on OLED for network or sensor faults

System Overview

        ┌──────────────┐
        │  PPG Sensor  │
        └──────┬───────┘
               │ ADC (26)
        ┌──────┴───────┐
        │ Raspberry Pi │
        │     Pico     │
        └──────┬───────┘
     ┌─────────┴─────────┐
     │ Signal Processing  │ → HR + HRV
     └─────────┬─────────┘
               │
   ┌───────────┴────────────┐
   │ OLED Display / Encoder │
   └───────────┬────────────┘
               │
          Kubios Cloud

Hardware Setup

Component GPIO Function
PPG/ECG Sensor 26 Analog input
OLED (SSD1306 I²C) SDA = 14, SCL = 15 128×64 display
Rotary Encoder A/B 10 / 11 Menu rotation
Encoder Button 12 Selection
PWM LED 21 Pulse feedback
Onboard LED "LED" Status indicator
Power: via USB 5 V
Sampling Rate: 250 Hz
Display Refresh: ~25 Hz

Menu Navigation

Use the rotary encoder to scroll and press the button to select.

Mode Description
Measure HR 60 s sampling, computes HR + HRV metrics
HRV Analysis Displays results on OLED
History Shows last saved session
Kubios Uploads RR data for cloud analysis

Example Outputs

OLED Display

MeanHR: 73 bpm
SDNN: 41 ms
RMSSD: 28 ms
SD1: 20  SD2: 55

Serial Console

--- Kubios HRV Summary ---
Mean HR: 72.6 bpm
SDNN: 41.2 ms
RMSSD: 27.8 ms
PNS Index: 0.65
SNS Index: -0.42
Readiness: 7.9

HRV Metrics

Metric Description
SDNN Standard deviation of NN intervals
RMSSD Root mean square of successive differences
SD1 / SD2 Poincaré plot short/long term variability
PNS / SNS index Parasympathetic & sympathetic balance

Skills Demonstrated

  • Embedded systems design
  • Real-time signal acquisition
  • HRV time-domain analysis
  • OAuth2 + REST API integration
  • I²C, ADC, PWM, interrupt-driven input
  • MicroPython async and timer programming

License

Distributed under the MIT License. See LICENSE for details.

About

A real‑time heart rate (HR) and heart rate variability (HRV) monitoring system built on the Raspberry Pi Pico using MicroPython, featuring on‑device signal processing, OLED visualization, and Kubios Cloud integration for advanced analytics.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages