Reliable recognition of lying, sitting, and standing with a hip‐worn accelerometer

Hip‐worn accelerometers are widely used to estimate physical activity (PA), but the accuracy of acceleration threshold‐based analysis is compromised when it comes to identifying stationary and sedentary behaviors, let alone classifying body postures into lying, sitting, or standing. The purpose of this study was to devise a novel method for accurate classification of body posture using triaxial data from hip‐worn accelerometer and to evaluate its performance in free‐living conditions against a thigh‐worn accelerometer. The posture classification rested on 2 facts: constant Earth's gravity vector and upright walking posture. Thirty healthy adults wore a hip‐mounted accelerometer and underwent an array of lying, sitting, standing, and walking tasks. Task type, their order, and length were randomly assigned to each participant. During walking, the accelerometer orientation in terms of gravity vector was taken as reference, and the angle for posture estimation (APE) was determined from the incident accelerometer orientation in relation to the reference vector. Receiver operating characteristic (ROC) curve yielded an optimal cut‐point APE of 64.9° (sensitivity 100% and specificity 100%) for lying and sitting and 11.6° (94.2%; 94.5%) for sitting and standing. In free‐living conditions, high agreement (89.2% for original results and 90.4% for median‐filtered results) in identifying sedentary periods (sitting and lying) was observed between the results from hip‐ and thigh‐worn accelerometers. Walking provides a valid reference activity to determine the body posture. The proposed APE analysis of the raw data from hip‐worn triaxial accelerometer gives accurate and specific information about daily times spent lying, sitting, and standing.


| INTRODUCTION
Physical activity (PA) is consistently associated with reduced risk of many health problems. 1 Recently, PA research has focused on the concept of sedentary behavior (SB), which has traditionally conceptualized as one end of the PA spectrum, not as a distinct behavior. [2][3][4] Sedentary behavior (SB) is defined either as any waking behavior with intensity below 1.5 metabolic equivalents (MET) or as a combination of seated or reclined posture with intensity below 1.5 MET. 5 One MET is defined as the resting metabolic rate for quietly sitting and is about 3.5 mL/kg/min, when expressed as oxygen consumption (VO 2 ) rate. 6 There is not yet consensus whether or not standing posture should be included in SB, and knowledge on specific features or patterns of SB besides the total daily sedentary time is scarce.
Single thigh-worn accelerometers measuring the thigh inclination angle can differentiate sitting and standing with over 90% accuracy, but differentiating sitting from lying is difficult. [7][8][9][10][11] Using both the thigh inclination angle and rotation angle has shown promising results to separate sitting from lying. 12 Solutions based on multiple accelerometers have reached accuracy over 98% in identifying the body posture. 13,14 Currently, it is recommended to use thigh-worn or multiple accelerometers for reliable measurement of posture. 15 However, in large-scale population studies, low burden to the participants and high feasibility are of primary importance besides the ability of the used accelerometer setting to provide information on SB and PA that are of greatest interest to the researchers. 16 Further, participants might feel public embarrassment if the accelerometers are visible to others or if they clash with their idea of style. 17 Also, the adhesive layer used with the thigh-worn accelerometers may sometimes cause skin irritation to some participants. 18 Obviously, one has to face a trade-off between simple systems and more burdensome and costly systems offering higher accuracy. 16 Hip-worn accelerometers have been the mainstay for the large-scale population studies. 16 Although the hip has been shown to be the best single location for an accelerometer to the measure intensity of PA, 19 its validity to detect body posture (ie, standing, sitting, and lying) has been considered inadequate. 7,8 The commonly used inclinometer function of the accelerometer can detect the posture only with 70% accuracy at its best. 7,8 Because the inclinometer measures the angle between the gravity direction and the accelerometer's vertical axis, the limited performance of the hip-worn accelerometers is likely attributable to the position or orientation of the accelerometer that differs from its intended placement or fixation. 20 A single hip-worn accelerometer may still provide an acceptable option, if its ability to evaluate the body posture is improved.
Theoretically, the accelerometer orientation on the hip can be determined by 2 facts: The direction and magnitude of Earth's gravity vector are constant, and the body posture during walking is upright. Accordingly, we hypothesized that the body posture (ie, lying, sitting, or standing) can be accurately determined by a metric that is calculated from the raw triaxial data from a single hip-worn triaxial accelerometer and denotes the accelerometer orientation in terms of the gravity vector. The purpose of this study was to devise a novel method and evaluate its accuracy in differentiating lying, sitting, and standing from each other, and carry out a preliminary validation in free-living conditions against a thigh-worn accelerometer.

| Supervised test
Each participant conducted an individual test protocol containing a 30-second walk and a supervised array of 12 consecutive 1-to 6-minute tasks. The order and length of 6 possible task types were randomly assigned beforehand by rolling 2 dice 12 times: One dice determined the task and the other its duration. The task types were (a) lying in bed on back, (b) sitting on a sofa, (c) sitting on a chair by an office desk, (d) standing still, (e) conducting office work while standing, and (f) walking at self-preferred speed. Walking (activity) was performed along the 30-m-long corridor, and it was needed to define the accelerometer reference orientation in terms of gravity vector. The short walking before the individual test array was performed to guarantee that each participant conducted at least one walking task. Other tasks were performed in a small office room (about 3 × 3 m) beside the corridor. Between each consecutive task, a few steps were required, for example, after each lying and sitting task, the participant stood up and changed location. An examiner (PH) observed the participant during the activities and timed the duration of each task.
Theoretically, the duration of the entire array could vary between 12 and 72 minutes. The median length of the arrays was 42 minutes (the 30-second reference walk excluded), ranging from 35 to 55 minutes. The median time (minute) of lying in bed was 7 minutes (0-20 minutes), sitting on a sofa 7 minutes (0-20 minutes), sitting by the desk 6 minutes (1-15 minutes), standing still 6 minutes (0-24 minutes), conducting office work while standing 9 minutes (0-17 minutes), and walking slowly 4 minutes (0-26 minutes). When pooled, the total time of lying was 3 hours 46 minutes, sitting 7 hours 30 minutes, and upright posture 10 hours 25 minutes, of which standing 7 hours 34 minutes and walking 2 hours 51 minutes. The total pooled time spent in different tasks was 24 hours 32 minutes.

| Free-living test
Thirteen adults participated also in free-living measurements. In the morning, an examiner (HV-Y) attached the thigh-worn accelerometer to the belly of participant's right thigh as instructed by Skotte et al 11 and the participant attached the hip-worn accelerometer by him/herself in a dressing room. The free-living measurement started when the participant left the dressing room. The total number of measurement days was 20 (14 workdays), and the mean daily wear time was 10 hours 39 minutes (ranging from 7 hours 35 minutes to 17 hours 38 minutes).

| Data collection
During all tests, incident acceleration signals were measured with a hip-worn, light-weight (14 g) triaxial accelerometer (Hookie AM20, Traxmeet Ltd, Espoo, Finland). This accelerometer employs a 13-bit digital triaxial acceleration sensor (ADXL345; Analog Devices Inc, Norwood, MA, USA). In total, 10 different accelerometer units were used in the tests. The accelerometer was attached to an elastic belt on the right side of the hip at the level of the iliac crest. During the freeliving test only, besides the hip-worn accelerometer, another accelerometer was firmly fixed on the anterior belly of right thigh with a medical tape according to the procedure suggested by Skotte et al. 11 The thigh-worn accelerometer was oriented so that the x-axis pointed downward in a standing posture.
The accelerometers stored the acceleration signal with 100 Hz sampling frequency and ±16 g measurement range, 4 mg (milligravity) measurement resolution, and 2 GB data storing capacity. After the measurement, the collected acceleration data were transferred to hard disk for further analysis. The analysis was performed with Microsoft Excel 2010 (Microsoft Corporation, Santa Rosa, CA, USA) using the Equations 1-7 described in the subsequent sections.

| Walking detection
The hip-worn accelerometer orientation during walking was used as a reference value, and it was determined as a mean value of each measurement axis during each 6-second-long epoch similar to our previous studies. [21][22][23] The recognition of walking was based on 3 different parameters: (a) activity intensity; (b) activity step rate; and (c) movement steadiness. The activity intensity was classified with the mean amplitude deviation (MAD) of the resultant acceleration, which has been recently found a valid 21-24 metric to assess the intensity of locomotion. The step rate of the activity was determined with a step detection algorithm. The movement steadiness was assessed with novel MAD-like parameters, which are more sensitive to changes in body posture, for example, during turning around.
The MAD describes the variation in the acceleration magnitude irrespective of its direction. The acceleration magnitude is defined as the resultant acceleration (r i ) calculated from measured data samples from all 3 orthogonal measurement axes x i , y i , and z i for each (ith) time point as For each analyzed 6-second epoch, a mean resultant value (R M ) was calculated and the MAD value of the given epoch is defined as where N is the number of data samples in the epoch and j is the start point of the epoch. For walking speeds 1.0-1.8 m/s (3.6-6.5 km/h), the typical MAD values vary between 130 and 450 mg (milligravity). 22 In this study, the steps were identified from the vertical component of the acceleration. 25 The algorithm operates in all sensor orientations and requires about 0.8 m/s walking speed to detect every step. The algorithm is described in Appendix 1. The step rate for normal walking was set to 1.5-2.5 steps/s. 26 The movement steadiness was evaluated by comparing variations in the axis-specific acceleration to the variation in the resultant acceleration. For this purpose, the axis-specific MAD values as well as their resultant MADxyz were determined as follows: where N denotes the number of samples in the 6-second epoch, x i , y i , and z i are the ith measurement samples, and x M , y M , and z M are the measurement axis-specific mean values for the given epoch. A single measurement axis value is sensitive to both the acceleration and the gravity vector projection on it (34). Thus, the MADxyz is sensitive both to the changes of the inclination angle of the axis and to the movement making its magnitude always greater than or equal to MAD. During steady walking at the constant speed, the ratio of MADxyz to MAD should be <1.6. Appendix 2 illustrates the MAD, MADxyz, and their ratio values for different walking speeds.
Each time when the previous above-described parameters of the examined epoch were within the normal walking limits, a new reference value for the upright posture was set. The reference value is a vector (R), which contains the measurement axis-specific mean values for the given 6-second epoch, and it has to be set before the calculation of postural orientation is possible. (1)

| Postural orientation
The angle for postural estimation (APE) of the hip-worn accelerometer in terms of gravity vector was calculated for each epoch, and it denotes the angle (θ) between the measured epoch vector (M) and reference vector (R). The APE was calculated using the scalar product function, which defines the angle between 2 vectors as follows: where x M , y M , and z M are mean values of x-, y-, and z-axes for measured epoch and x R , y R , and z R are the axis values of the reference vector. Figure 1 illustrates sample epochs for walking and standing. For walking and standing still, the axisspecific mean values are 1.059, −0.045, and −0.113 g and 1.059, −0.029, and −0.075 g, respectively. The Equation 7 yields a 2.2˚ APE between these vectors.
The data from the thigh-worn accelerometer were analyzed using the method described by Skotte et al. 11 The raw data were first processed with 4th-order Butterworth lowpass filter with 5 Hz cutoff frequency. Data were divided into 2-second epochs and analyzed in 1-second steps. Thus, there was 50% overlap between successive epochs. For each epoch, mean acceleration per axis (A x , A y , A z ) and standard deviation per axis (SD x , SD y , SD z ) were calculated and the inclination angle of x-axis (Inc) was determined as follows: If SD x was smaller than 100 mg and Inc was greater than 45°, the epoch was classified as SB (ie, sitting or lying). Otherwise, it was classified as non-sedentary behavior (noSB). These results are called as the original results.
Further, to remove sporadic events, the original data were filtered with median filter of 29-second window size, and these results called as median-filtered results.
The data from the hip-worn accelerometer were analyzed with the MAD-APE method in 6-second epochs. When the MAD value of the epoch was less than 22.5 mg and the APE was greater than the optimal cut-point separating standing from sitting, the epoch was classified as SB (lying or sitting); else, it was classified as noSB. The 22.5 mg limit for inactivity is derived from the pooled data of our previous studies. 21,23 Similar to the thigh-worn accelerometer data, sporadic events were removed from the hip-worn accelerometer data with a median filter of 5 epochs. The analysis process of the data from the hip-worn accelerometer is illustrated in Figure 2.

| Statistical methods
For statistical analysis, the accelerometer data were divided into steady-state and transition periods. The transition period was defined as the 2 last epochs of the preceding task and the first 3 epochs of the subsequent task. The steady-state period denoted all epochs between 2 adjacent transition periods.
The APE values during the steady-state periods in different tasks were non-normally distributed, and therefore, median and 25-75th percentiles as well as the minimum and maximum values were given as descriptive statistics. To obtain the optimal cutpoints for APE values in differentiating body postures from each other, the receiver operating characteristic (ROC) curve analysis was used and the area under the ROC curve (AUC) was determined. The optimal cut-point corresponded to the minimum distance between the observed ROC curve and the left upper corner of the ROC space. The validity of these cut-points was evaluated with leave-one-out cross-validation (LOOCV) method. 27 The LOOCV procedure was repeated 30 times using each time one different participant as a testing set and the remaining 29 participants as a learning set. For the cut-points between the lying and sitting and between sitting and standing postures, mean AUC values and their 95% confidence intervals (CI) were determined. For the transition periods, the tasks were divided into sedentary (lying and sitting) and upright (standing and slow walking) tasks. The optimal cut-point between sitting and standing was used to classify the posture to sedentary or upright. The movement needed to standing up was evaluated to devise an algorithm for calculating the number of standing ups or breaks in sedentary behavior. The optimal cutpoints for standing up were set using the F-measure, where false-positive and false-negative values had equal weight. 28 F-measure is a refined ROC analysis for a situation where the datasets are unbalanced, as was the case for standing ups.
The free-living performance was evaluated by comparing the SB and noSB data from the thigh-worn accelerometer second by second to those from the hip-worn accelerometer using both original and median-filtered data. A 2 × 2 contingency table was created from the measurements, and the agreement between the analyzing methods was evaluated with individual Cohen's kappa.

| RESULTS
Descriptive APE values during different tasks during the supervised test are shown in Table 1. One array of tasks is illustrated in Figure 2. During lying, the APE values differed clearly from those during other postures with no overlap between sitting and lying. On average, the body posture was about 10° more upright for sitting by the desk than for sitting on the sofa. Between sitting by the desk and standing work, there was some overlap, especially within the APE ranging from 10 to 15°. Besides distinct differences in APE values during different tasks, a peak in the MAD value and a change in the APE value coincide each postural change.

| Optimal cut-points
According to the ROC curve and LOOCV analyses, the optimal cut-point of APE to separate sitting from standing was 11.6° and to separate sitting from lying 64.9°. Sensitivity and specificity values for whole datasets were 94.2% and 94.5% for the cut-point between standing and sitting, respectively. Lying was separated from sitting perfectly. The corresponding AUC values were 0.989 (95% CI 0.981-0.998) and 1.000. Table 2 shows the performance parameters for the APE method in separating standing from sitting under supervised conditions.
Using the optimal cut-points, the overall lying time during the tasks was 3 hours 39 minutes 42 seconds (2.8% error compared to the actual time), sitting 7 hours 25 minutes 18 seconds (1.0% error), and upright postures 10 hours 36 minutes 00 second (1.8% error). The measured lying time and sitting time were slightly underestimated, and the upright time was slightly overestimated compared to the actual supervised times. Cumulative distribution of APE values measured during different stationary tasks is shown in Figure 3. Figure 4 illustrates changes in MAD, MADxyz, and APE during standing ups in one test array. The total number of actual standing ups in all 30 test arrays was 151, of which 86 took place between sedentary (sitting or lying) and upright position (standing or walking). The rest 65 standing ups occurred when the participant moved from the chair or sofa to the bed or vice versa. In all test arrays, the APE value crossed the optimal 11.6° cut-point between sitting and standing 180 times indicating 29 false standing ups.

| Standing ups
In 94% of cases, the MAD and MADxyz values reached the highest value during the preceding or same epoch when the APE crossed the optimal 11.6° cut-point between sitting and standing. Thus, the best accuracy in detecting the standing up was achieved when the sum of the MAD values was T A B L E 1 Descriptive data of measured angles for posture estimation (APE) in terms of the gravity vector in different tasks greater than 35 mg, and MADxyz was greater than 60 mg for the preceding and concurrent epoch the APE crossed the 11.6° cut-point. As to the allowed movement before standing up, the best accuracy was achieved when the highest MAD value was less than 16.5 mg during 3-8 epochs before the very epoch the APE crossed the 11.6° cut-point. Using these criteria, 124 standing ups (82%) were correctly detected and 27 were missed, but there were only 4 false standing ups yielding the F-measure value of 0.889.

| Free-living performance
The mean daily SB time based on the original thigh-worn data was 6 hours 4 minutes (SD 2 hours 4 minutes) and on hip-worn data 5 hours 41 minutes (1 hours 59 minutes). For the median-filtered data, the corresponding SB times were 6 hours 5 minutes (2 hours 5 minutes) and 5 hours 39 minutes (2 hours 0 minutes). In general, the agreement between the thigh-based and hip-based results was good and only marginally better for the median-filtered data ( Table 3). The Cohen's kappa, sensitivity, specificity, and accuracy values for original and median-filtered data are shown in Table 3. The face-to-face comparison of filtered SB and noSB is shown in Figure 5.

| DISCUSSION
This study demonstrated that walking provides a feasible and valid basis to evaluate the orientation of a hip-worn triaxial accelerometer relative to the Earth's gravity vector and determine the body posture (ie, standing, sitting, lying) with excellent accuracy in supervised conditions and with good accuracy in free-living conditions. The accuracy of the novel APE method is comparable to those obtained with multisite [13][14][15]29,30 or thigh-worn 7,9,15 accelerometers and much better than obtained with hip-worn inclinometer. 8,31 The ability of the APE method to identify primarily the body posture as an indicator of SB instead of mere low intensity is fully consistent with a recent recommendation. 32 So far, the posture identification with triaxial hip-worn accelerometers has relied on the inclinometer function, which compares the accelerometer's vertical axis to the gravity vector. The inclination less than 17° is considered to indicate standing, the inclination between 17 and 65° sitting, and the inclination above 65° lying. 11 In this study, the optimal cutpoint for separating sitting from lying was 64.9°, which is identical to the above-described value, whereas the optimal cut-point between standing and sitting was 11.6°. This somewhat lower value is likely due to the fact that walking was employed to determine the reference vector for the upright posture. In so doing, there is no need to control for the exact orientation of the vertical axis of the hip-worn accelerometer, but the method adapts to the position of the device.
The reference method used for validating the new APE method in free-living conditions was based on an open access method, 11 which employed a 45° thigh angle to separate nonsedentary behaviors from sitting and lying. This approach could distinguish between sitting, standing, walking, running, and cycling in a supervised setting with about 99% sensitivity and specificity. Further, its ability to detect sitting posture was validated against pressure sensors in the hip pockets with 98% sensitivity and 93% specificity. Given the above performance values, the 45° thigh angle provides an appropriate reference method for evaluating the free-living performance of the APE method. F I G U R E 5 Face-to-face comparison of sedentary behavior (SB) time between hip-based data (above the x-axis) and thigh-based data (below the x-axis). The time between 2 consecutive tick marks corresponds to 1 h. Whereas the performance was generally good, some situations were challenging: sitting on a saddle chair (case 8) or Swiss ball (case 11). Also, traveling by car or bus may be misinterpreted, especially when driving on snowy or bumpy road (case 6) Whereas the influence of filtering on the comparability between the thigh-and hip-based results was quite marginal, filtering can reduce the occurrence of sporadic short events, which have no apparent clinical bearing in terms of health issues. In real-life measurements, the selection of the filter type and time constant has to be considered carefully, but obviously there is no optimal or universal solution. The data filtering has to be selected according to the research questions, for example, how long PA or SB periods are of primary interest and need to be detected with sufficient accuracy.
The epoch length in this was 6 seconds, and the APE value was determined at the end of each epoch. Therefore, the body posture was determined at every 6 seconds. This long epoch length is needed to separate static gravity component from the dynamic movement component. 33 Be it noted that any rapid change in the body posture within the 6-second epoch is classified as PA if it exceeded the respective MAD threshold. 21,23,24 Further, short (<6 seconds) sedentary times have hardly any clinical relevance, and such an uncertainty is marginal when longer, several minute periods of SB are of interest.
Given the good overall performance of the APE method, it is possible to get specific information about lying, sitting, and standing and to identify postural transitions with reasonable accuracy during free-living conditions. In particular, counting the daily standing ups or breaks in SB may give valuable information about the health effects of interrupted sitting by short breaks. 34 It is, however, recalled that some of the short standing periods during the transition between the sedentary tasks were missed, while the measured MAD values indicated light or moderate activity for all transitions. It is also possible that the body was not fully straightened up during the transition because of the short distance (<2 m) between bed, sofa, or chair and the hip angle did not reach the value required for standing. Nevertheless, the total measured standing time in the pooled data of all arrays was slightly (1.5%) overestimated compared to the expected time. A few seconds movement required for the transition was not counted in the expected time, and it also takes time to settle down to new posture. Both these factors favored the accumulation of time spent in the upright position. Such small errors in the duration of stationary behavior (lying, sitting, or standing) should not have any meaningful clinical bearing.
In free-living conditions, postural orientation may be misclassified if some other PA than walking was falsely recognized as reference activity. This can happen only if no actual steps are taken between false reference activity and subsequent sedentary period. Also, the posture during the false reference PA should not be upright. For example, during some repeated vigorous gym exercises (eg, leg press training), this may happen. Apparently, the likelihood for such a false misclassification remains low. Another risk could be that the reference activity is not recognized at all. This is possible for people with low fitness level (eg, elderly people and those with disabilities) who cannot reach the required intensity of locomotion. In the free-living measurements, a good practice may be to control the number of epochs recognized as walking. If the number of walking periods remains low (eg, less than 10 per day), it may be better to omit posture classification for that day.
This study has some limitations. The use of a convenience sample of volunteer participants may be considered as a limitation. Only 5 participants were overweight, and 5 of the 30 participants were men. Such a sample does not represent the typical distribution of clinical characteristics in a common population. In a population-based large sample of unselected individuals, 35 the performance in detecting different body postures and sedentary behaviors in free-living conditions is likely not so high as in the supervised part of this study. BMI (a proxy for body shape and width as well for obesity/ overweight) and gender may modulate body sway to some extent 36 and modulate the accelerometer orientation. On the other hand, the possible confounding effect of sway may be filtered out when the data are analyzed in 6-second-long (or longer) epochs. Nevertheless, the possibility that the accelerometer angle is also confounded by some other factors cannot be ruled out. Obviously, future independent validation studies are needed to reveal factors that may compromise the accuracy of the APE method. Also, new data processing methods may facilitate recognition of challenging situations in free-living conditions. Ultimately, the most crucial factor pertains to the use of the accelerometer; it should always be used as intended. The preliminary shown good performance of the APE method in free-living conditions is quite promising, however.
As to potential broader utility of the new APE method, it can be basically integrated into any hip-worn triaxial accelerometer, which provides the raw acceleration data. Because the APE method relies on the detection of walking, there is no need to control for the exact orientation of the accelerometer or to know it a priori; only, a sufficiently firm fixation (eg, a belt or clip attachment) is required. The present APE method in conjunction with the MAD method allows also comprehensive reanalysis of already existing data collected with a hip-worn triaxial accelerometer irrespective of the brand if the collected data are available in the raw format stored at an adequate sampling rate, and sufficiently firm fixation of the accelerometer during data collection can be confirmed.

| CONCLUSION AND PERSPECTIVES
Conventionally, the hip-worn accelerometers have classified activities below a certain intensity threshold (eg, count) as SB while it has not been possible to separate different body postures from each other until this study. Because standing may confer some health benefits compared to sitting and lying, SB should be defined as low-intensity activity spent sitting or lying. Therefore, it is highly important that the analysis of the accelerometer data can accurately identify different stationary postures. The present APE approach based on a single hip-worn triaxial accelerometer showed good-to-excellent performance in identifying different body postures, also in free-living conditions, and can thus give valuable information about total daily time spent lying, sitting, and standing and especially on durations and number of different bouts of SB and standing, as well as breaks between sedentary periods.

APPENDIX 1
The steps were detected with the following algorithm.

Low-pass Filter
The measurement axis values were first filtered with the 2nd order Butterworth low-pass filter with 0.5 Hz cutoff frequency.

Vertical Acceleration
The vertical acceleration component (a v ) was calculated with a scalar product as follows: where x i , y i , and z i are the measurement samples at the moment i and x F , y F , and z F are the low-pass-filtered values at the same moment.

Band-pass Filter
To reduce noise and artifacts from the signal, the av is band-pass filtered with a 2nd order Butterworth band-pass filter, whose frequency range was from 1 to 4 Hz.

Integration
The band-pass-filtered vertical acceleration (a bpv ) is integrated to estimate the vertical impulse. The integration begins when the a bpv value changes from negative to positive.
where I(n) is the integral value, I(n−1) is the previous value of the integral, and ts is the sampling time. With 100 Hz sampling frequency, the sampling interval is 0.01 seconds. Both the I(n) and n values are reset to zero when the a bpv value changes from positive to negative.

Step Detection
Step is detected, if the I(n) value exceeds 0.03 gs (gs, gravity seconds) within 0.5 seconds, ie, the n has to be less than 50 with 100 Hz sampling frequency.