G5: Remote Patient Monitoring (RPM) System - shalan/CSCE4301-WiKi GitHub Wiki
Group Members
Link to project repo: https://github.com/Dinamarei/RPM
Dina Marei
Omar Ali
Osama Wahsh
Project Idea
Health care industry new comers and legacy players alike are vying to contribute to the growing market of Remote Patient monitoring Systems(RPM) especially after the pandemic. RPM services leverage technology to offer healthcare delivery by gathering patient’s data outside of traditional healthcare settings; a technology that proves extremely useful in line with social distancing requirements that limit people’s physical visits to their healthcare providers.
We aim to provide a low-cost alternative to existing RPM services that caters for two basic needs
a) The need to detect patient’s vital signals and medication doses timely
b) The need to notify caregivers in due time in case of life-threatening situations.
Components
Software
- STM32CubeMX
- Keil µVision
- Termux for Android
- Serial Bluetooth Terminal for Android
Hardware
- 1x STM32L432KC
- 2x Buzzer
- 1x RTC
- 1x Push Button Switch
- 1x MAX30102 Heart Rate and Pulse Oximeter
- 1x HC06 Bluetooth Module
- Android Smartphone
Programming Languages
- C
- Python
Components Description
Reference
MAX30102In the systolic process of the human heart, the heart pumps blood that increases the volume of oxygenated blood and decreases the volume of deoxygenated blood. Alternatively during the diastolic process which is the relaxation of the heart muscle, the volume of deoxygenated blood increases and the volume of oxygenated blood increases. **It has been observed that: **
- Oxygenated Blood - absorbs more infrared light and passes more red light.
- Deoxygenated Blood - absorbs red light and passes more infrared light.
The MAX30102 is used to measure the rates above and send them to the Microcontroller over I2C Communication.
Reference
DS3231 RTCThe DS3231 is a low-cost, real-time clock (RTC) with an integrated temperature compensated crystal oscillator (TCXO) and crystal.
The device incorporates a battery input, and maintains accurate timekeeping when main power to the device is interrupted. The integration of the crystal resonator enhances the long-term accuracy of the device as well as reduces the piece-part count in a manufacturing line.
Dependencies
Flask Library Documentation
Geocoder Library Documentation
Getting Started
- Complete the building and loading of the code on STM32 Microcontroller on Keil µVision.
- On your cellphone connect to the HC06 module and verify the connection. Connection is established when the blinking led on the bluetooth module stabilizes
- The output of the Serial Terminal can be seen on the Serial Monitor for Android software.
- Run Python Script in the background and use the IP 127.0.0.1 to access the server to start the patient monitoring
- Logged Data is shown on the webpage.
System Features
The system is comprised of four main features:
1. Monitoring vital signals How does the sensor work?\
How do we process the samples?\
- In order to calculate the BPM, we need to calculate the number of spikes in a curve corresponding to a beat. MAX30102 takes 25 samples/sec, which is less than the person's heartbeat that typically ranges between 60-100 BPM.We extend this to take 100 samples over 4 seconds to get 5 peaks to be averaged.\
- Applying a triangular peak finding algorithm, we get the maximum peak (provided that its neighboring elements are less). Peaks that are too close to each other are removed. Afterwards, We calculate the inter-arrival time IAT of the samples, and average this time.\
- We plug this average into the equation (60*samplingrate/avg-inter-arrival), where the sampling rate is that of the sensor (25 samples/sec) converted to minutes and the average inter-arrival time is the amount of samples in one beat.
2. 24-hour location tracking Our system design has been altered to accommodate for cases when the caregiver is not able to connect to Wifi that would have previously been on another Microcontroller. The new design choice actually saves cost by relieving the need to use a GPS module, and using the built-in GPS capability of the phone. This is achieved through the use of the geocoder library that calculates the phone's exact location and offloads the latitude and longitude data to the cloud for display.
3. Medication Reminders. Remind patients of pre-set medication times with a specified pre-configured voice message for each medication This functionality is realized through the use of Real-Time Clock that tracks the current time, and increments an alarm buffer with the pre-configured value (eg: every 5 hours ). A buzzer is triggered during the time of the alarm to alert the patient to take their medication. The functionality of this feature could be extended by having different frequencies generated for different medications to be able to differentiate between them.
4. SOS buttons for emergencies
Special SOS button is to be used by the patient in case of discomfort or when facing any adverse situation to send their location to their caregiver to be able to intervene immediately.
The SOS button feature is realized with the use of a push button that when pressed, triggers an alarm buzzer to indicate error, and sends a value over UART to be later sent to the cloud as a notification for the caregiver to take immediate action.
Preliminary System Design
Elaborate System Connections
SYSTEM CONNECTIONS
STM PINS AND PUSH BUTTON \
PB7-> GPIO TRIGGER PUSH_BUTTON
STM AND MAX30102 ON I2C1
PA9 SCL
PA10 SDA
PA5 INT TRIGGER GPIO
STM AND RTC ON I2C3
PA7 SCL
PB4 SDA
STM AND HC06 BT MODULE ON UART2
PA2 TX
PA3 RX
STM AND BUZZER2
PA6 GPIO TRIGGER BUZZER
Circuit
Demo 1 (Initial Prototype)
https://drive.google.com/file/d/1aRTBfHZ8EV59fFIUoyj9mDxI8jzyWQOM/view?usp=sharing
Video:Demo 2 (Final Prototype)
Vital Signals: https://drive.google.com/file/d/1DREaCcqW_0UE7JRhOrLcDeXb6Vy4hYKV/view?usp=sharing Web Application: https://drive.google.com/file/d/1d622qnb6CDAYJkiQ8ubX6kiyTDeVqWLY/view?usp=sharing
Results
For the final working prototype we were able to achieve the following:
- Measuring the heart rate of the patient using MAX30102
- Generate medication reminders based on pre-set values and trigger a buzzer
- Introduce SOS button functionality by triggering a buzzer
- Detecting the GPS coordinates using Processing on Android Phone
- Establish successful Bluetooth communication between the phone and the microcontroller
- Create a web application using Flask that displays this data in real-time for patient monitoring
Screenshot from the web application:
References
https://datasheets.maximintegrated.com/en/ds/MAX30102.pdf
https://datasheets.maximintegrated.com/en/ds/DS3231.pdf
https://flask.palletsprojects.com/en/2.0.x/
https://geocoder.readthedocs.io/ \