Code of the Baby Pulse Monitor (BPM) CLI
From python BPM.py --help
:
Usage: BPM.py [OPTIONS]
Runs the data collection and calculations for the Baby Pulse Monitor
Options:
-t, --time INTEGER Total time to record data in seconds. [default:
60]
-c, --cycle INTEGER How long each cycle takes before calculating BPM
[default: 5]
-b, --brightness FLOAT Percent brightness for the LED [default: 0.85]
-f, --frequency INTEGER Data acquisition frequency. [default: 20]
-s, --save save the data after processing
-showp, --show-plot Show the results of autocorrelation or FFT
-p, --port TEXT The port of the Arduino. [default:
/dev/cu.usbmodem1101]
--help Show this message and exit.
To use MATLAB, you need to install Arduino Support from MATLAB.
To run the program, open MATLAB and run the bpm.m
file. Before running, make sure your parameters at the top of the file are correct.
Pip Packages:
- click
- matplotlib
- numpy
- pyfirmata
- tkinter
- scipy
- Install Firmata onto Arduino
- Instructions can be found here.
- Note the port used by the Arduino(ex:
COM4
)
If the port is COM4, you can run the following command
python BPM.py -p COM4 -f 20 -t 30
This will collect data for 30 seconds with a frequency of 20 Hz using port COM4
.
If you ever need to quit, you can use CTRL+C.
Examples have been provided. To load test data, use examples/test.m', and change the
data` variable in line 3 to the data file you want to analyze.