Firmware Key Parameters:


PWM_Freq is DC Motor PWM frequency.
TIM_Prescaler = (168M/2)/1M = 84M
TIM_Period = TIMER_PWM_MAX/PWM_Freq = 1000

TIM = 84M / TIM_Prescaler = 1M
TIM = 1M / TIM_ClockDivision = 1M
1M / (TIM_Period + 1) = 1000Hz (1ms)


const uint16_t PWM_Freq = 1000;
ARR = TIMER_PWM_MAX;
CCR = 0 to TIMER_PWM_MAX = 0 to 100% PWM.
In this case, PID PWM step 1 to 100 mapped to 100000 to 1000000.
TIMER_PWM_33 and TIMER_PWM_40 is 33% and 40% PWM for calibration hand control.


const uint32_t PID_PWM_MIN = 1;
const uint32_t PID_PWM_MAX = 100;
const uint32_t TIMER_PWM_MIN = 100000;
const uint32_t TIMER_PWM_MAX; = 1000000;
const uint32_t TIMER_PWM_33 = 330000;
const uint32_t TIMER_PWM_40 = 400000;
This is PID parameter, you need to redefine in ResetMeasurementParameter() function.


Kp = 2, Ki = 0.3, Kd = 0.001; // for JQB032-3A
AC signal amplitude point of Systolic and Diastolic BP.


float as_am_value = 0.65f;
float ad_am_value = 0.7f;
Polynomial curve fitting is generated from 『Calibration ADC-DC to Mercury Manometer Pressure』, you'll need to create 『curve.csv』and execute PC-GUI software main.app or BPM.exe in the same folder, it will output the『equation.txt』.
e.g. degree = 2, equation.txt format is : (-1.0620516546)x^0+(0.1262915457)x^1+(-0.0000012119)x^2


float a[3] = {-0.0000012119f,0.1262915457f,-1.0620516546f};
If pulse_value_N / total_pulse_value_mean > IPP_Ratio, pulse_N is irregular pulse peak, and IPP ratio range 15%~25%.
If IPP number / total_pulse_number > IHB_Ratio, this measurement is irregular heart beat.
If two or more IHB of the three BP measurements, AF detected.


const float IPP_Ratio = 0.2f;
const float IHB_Ratio = 0.2f;