Skip to content

luciancheng/PacemakerProject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Pacemaker Project

This is a simulated pacemaker built to visually and functionally represent the various functions of modern pacemakers today. The following project is based on Boston Scientific's pacemaker specifications.

Through model-based code generation and a Python GUI, we created the following features:

  • 10 unique pacemaker modes (AOO, VOO, AAI, VVI, AOOR, VOOR, AAIR, VVIR, DDD, DDDR)
  • Real-time electrocardiogram display from the ventricle and atrium readings
  • Locally encrypted data storage

Technology Stack

Python | Matlab Simulink | Customtkinter | NXP FRDM K64F Board | J-Link

Showcase

Demonstration

Pacemaker.mp4

DCM


The FRDM-K64F Board


Login Screen


Registration Screen


Main Screen


Live Electrogram in UI

Pacemaker


Simulink Overview


Mode and Parameter Stateflow in Simulink


Serial Communication Stateflow in Simulink

Development Process

Modeling with MATLAB Simulink

Central to modelling our pacemaker's functionality was the use of MATLAB Simulink, which allowed us to generate code iteratively and quickly flash our code into our board.

Through user-set parameters, our Simulink code allow for the pacing of both the atrium and ventricle alongside rate adaptive pacing with an in-built accelerometer.

All important user-set data and electrocardiogram data were framed. The resulting packet was sent through a micro USB to the device controller monitor.

Device Controller Monitor (DCM)

Through Python's tkinter, we created a secure interface that allows for the modification of the pacemaker. Our GUI allows for:

  • Real-time display of the simulated heartbeat
  • Patient data to be saved and modified
  • Encryption of patient data
  • Serial communication to the K64F board

Validation

To test and validate our pacemaker mode function, we employed Heartview, a McMaster-created cardiac simulation tool that was pre-flashed onto our board.

Installation

Prerequisites

  1. Python 3.18 or later
  2. MATLAB Simulink 2023 or later

Python Libraries

pip install customtkinter matplotlib serial numpy

MATLAB Simulink Libraries

In MATLAB, write the following in to the terminal:

open([codertarget.freedomk64f.internal.getSpPkgRootDir,
'/src/mw_sdk_interface.c']);

Upon opening the device change the following line:

{ GPIO_MAKE_PIN(GPIOA_IDX, 0),  MW_NOT_USED},// PTA0, D8

into the following:

{ GPIO_MAKE_PIN(GPIOC_IDX, 12),  MW_NOT_USED},// PTC12, D8

About

Pacemaker project from Mechtron 3K04

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages