Skip to content

repository of pip installable package for the cbt study and ecg study integration for the interaction lab fall 2025

License

Notifications You must be signed in to change notification settings

interaction-lab/cbt_ecg_integration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cbt_ecg_integration

repository of pip installable package for the cbt study and ecg study integration for the interaction lab fall 2025

ECG Collector

Collects ECG signals from AD8232 heart rate sensor via ADS1115 ADC on Raspberry Pi.

Hardware Requirements

  • Raspberry Pi (tested on Pi 4)
  • AD8232 ECG sensor module
  • ADS1115 16-bit ADC
  • I2C connection on bus 0

Quick Start on Raspberry Pi

  1. Clone the repository:
   git clone https://github.com/interaction-lab/cbt_ecg_integration.git
   cd cbt_ecg_integration
  1. Install in editable mode:
   pip install -e . --break-system-packages

This installs the package and all dependencies, and lets you edit the code. We need --break-system-packages for the RPI 4.

  1. Run the collector:
   # Collect for 60 seconds at 250 Hz
   ecg-collect -d 60 -r 250 -o test_data.csv
   
   # Or continuous collection (Ctrl+C to stop)
   ecg-collect

Usage

Command Line

ecg-collect -d 60 -r 250 -o mydata.csv

Options:

  • -d, --duration: Collection duration in seconds (omit for continuous)
  • -r, --rate: Sample rate in Hz (default: 250)
  • -o, --output: Output CSV filename (default: auto-generated)

As a Python Library

from ecgcollector import ECGCollector

collector = ECGCollector(sample_rate=250, output_filename="data.csv")
collector.collect_data(duration=60)

Output Format

CSV file with columns:

  • timestamp: Relative time in seconds
  • voltage: ADC voltage reading
  • raw_value: Raw ADC value

Troubleshooting

I2C not enabled:

sudo raspi-config
# Interface Options -> I2C -> Enable

Permission denied:

sudo usermod -a -G i2c $USER
# Log out and back in

License

MIT License - see LICENSE file

About

repository of pip installable package for the cbt study and ecg study integration for the interaction lab fall 2025

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages