Objective of this repository is to acquire experience in developing products and to get familiar with new technologies. Secondary objective is to create a framework of sensor to machine learning starting with raw electrocardiogram data with the intent of quantize how deviated the heart wave is from sample data and in addition to predict future heart states with different activities. In the future different sensors could be applied such as electromyography sensors.
Server-runner added.
| Goal | Progress |
|---|---|
| ECG to ESP data aquisition | Y |
| ESP UDP control | Y |
| ESP UDP data transmission | Y |
| Feature extraction | Basic |
| Machine Learning model | In progress |
| ESP Prediction | In progress |
Analog input produces 50~ Hertz noise, research into implementing Low-pass filter
Implement windowing to individual heart pulses for additional feature extraction
Find way to change Machine Learning model, the hex array, without recompiling whole program.
Optional: Initialise virtual python env.
conda create -n EmbeddedML_env python=3.8.5
conda activate EmbeddedML_env
pip install requirements.txtInitialise system variables with bash script. This will give prompt for ESSID, Password and UDP IP configurations.
chmod +x env_init.sh
./env_init.shOr edit the script files and the ESP32.ino file manually.
Will output network interface configuration. Use the ip the python scripts will be run off.
Install the ESP32 arduino program with new initialised values.
Place ECG electrodes.
Test the output of the ECG sensor in a serial monitor.
python UDP_init_test_mode.pyGather sample data. Enable sampling server then initialise sampling.
python ECG_sampling_server.py
python UDP_init_sample_mode.pyExample output
With sampled data, perform feature extraction
python ECG_feature_extraction.py
python Visualise_ECG_features.py # Optional, to visualise the output.Feature extraction example output.
To generate model with featured data
python ECG_ML_Modelgen.pyThis script will produce 2 files, ECG_model_quantized.tflite and ECG_ML_Model.h.
ECG_ML_Model.h to be used with Arduino IDE as header file.
Recompile the ESP32 with the new header file and activate Machine Learning mode
python UDP_init_ML_mode.pyHeart sensor schematic.






