A Python Interface for ProtoCentral HealthyPi v3
HealthyPi is a fully open-source vital signal monitoring system with Raspberry Pi. The HealthyPi add-on HAT would work independently to collect vital signals via package streaming.
This repository provides a Python interface for data collection and simple monitoring window that works on any platform that can run with Matplotlib. This repository also demonstrates the streaming package decoding method as an example for interface development in other languages.
Use python main.py -h
to print out the detail user manual.
Example usage:
python main.py -p COM3 -g -v
-g
refers to the Matplotlib graphical interface for logging; and
-v
refers to verbose output from decoded data package
CTRL
+ C
to quit (This is a proper way to close communication, you may need to manually close thread if you don't use this way to close.)-c
. The collected data will be stored in ./data/healthypiv3_yyyymmdd-HHMMSS_Numerics.csv
and ./data/healthypiv3_yyyymmdd-HHMMSS_Signals.csv
. The data formation in CSV file follows the pattern of BIDMC PPG and Respiration Dataset.The HealthyPi sends data out on the serial port in the following packet format.
Offset | Byte Value | Description |
---|---|---|
0 | 0x0A | Start of frame |
1 | 0xFA | Start of frame |
2 | Payload Size LSB | |
3 | Payload Size MSB | |
4 | Protocol version | (currently 0x02) |
5-6 | ECG Value | Signed int 16,LSB first |
7-8 | Respiration Value | Signed int 16,LSB first |
9-12 | PPG IR Value | Signed int 32, LSB first |
13-16 | PPG Red Value | Signed int 32, LSB first |
17-18 | Temperature | Signed int 16, LSB first |
19 | Respiration Rate | Unsigned int 8 |
20 | SpO2 | Unsigned int 8 |
21 | Heart Rate | Unsigned int 8 |
21-23 | BP (not implemented) | Not implemented yet |
24 | SpO2 and ECG lead status | |
25 | 0x00 | Footer |
26 | 0x0B | End of Frame |
y_ppg = np.append(y_ppg,collector.data[-1]["ppg_ir"])
into
y_ppg = np.append(y_ppg,collector.data[-1]["ppg_red"])