//Logo Image
Authors: Che-Chang Yang, Yeh-Liang Hsu(2007-11-08)Recommend: Yeh-Liang Hsu (2009-09-09).
This paper is presented at the 33rd Annual Conference of the IEEE Industrial Electronics Society, Nov. 5-8, 2007, Taipei, Taiwan

Algorithm Design for Real-time Physical Activity Identification with Accelerometry Measurement


Characteristics of physical activity are indicative of one’s mobility level, latent chronic diseases and aging process. Current research has been oriented to provide quantitative assessment of physical activity with ambulatory monitoring approaches. This study presented the design of algorithm integrated with a portable microprocessor-based accelerometry measuring device to implement real-time physical activity identification. This algorithm processes real-time tri-axial acceleration signals produced by human movement to identify targeted still postures, postural transitions or walking. Fall detection is also featured in this algorithm to meet the increasing needs for elderly care. High identification accuracy was obtained during the preliminary test phase and the observed limitations regarding real-time processing was also discussed. The result reveals that this developed algorithm is technically viable for real-time identification in ambulatory monitoring to provide sufficient information in evaluating a person’s activity of daily living (ADL) and the status of physical mobility. Possible system integration and applications in the future were also discussed.

Keywords: Physical activity, aging, fall detection, accelerometry, elderly care, ambulatory monitoring

1.     Introduction

Recent advances in sensors, microprocessors and wireless communication technologies have been the driving factors to facilitate remote telemonitoring of physical activity with mobile systems. These systems are potentially able to provide significant information on details of physical activities and resulting energy expenditure, and further to quantify the subject’s mobility level [Aminian et al., 2004].

The related research in recent years has focused on developing body-attached or wearable systems. In a wearable system, the sensor units (e.g., gyroscopes or accelerometers) and the required components are integrated into portable devices which are attached to the belt at waist or chest level [Meijer et al., 1991; Veltink et al., 1996; Bouten et al., 1997; Foerster et al., 1999; Najafi et al., 2002; Najafi et al., 2003; Karantonis et al., 2006], or are even incorporated into clothing [Nyan et al., 2006]. Miniature accelerometers have been considered as the appropriate motion sensor for human movement measurement on wearable systems [Meijer et al., 1991; Bouten et al., 1997; Foerster et al., 1999;].

Most traditional sensor-based monitoring system capitalizes on off-line data processing technique to analyze recorded human movements [Najafi et al., 2002, 2003]. In these system, the motion sensors and data storage medium are incorporated into a portable devices to enable ambulatory monitoring. The recorded data is then processed and analyzed in PC-based programs (e.g., MATLAB) using FFT, wavelet transform or other frequency-domain manipulation to recognize human movements. Sophisticated data processing and manipulation can be applied to yield high accuracy human movement classification if the data is properly acquired. However, except the demanding fall detection procedure, these systems are unable to provide real-time response of identifying several human movements that has been expected in advanced mobility telemonitoring systems [Nyan et al., 2006]. Mathie et al proposed a generic framework for automated human movement classification using accelerometry data [Mathie et al., 2002, 2003]. Karantonis et al also presented a real-time system for physical activity classification [Karantonis et al., 2006]. All the movements are classified in real-time process of wearable system, but identifying walking still required PC-based frequency-domain processing.

This study presents an algorithm design for real-time physical activity identification with accelerometric measurement. The algorithm is implemented in a microprocessor-based portable motion measuring device to identify targeted physical activity items among a subject’s activities in free-living environment. These activities include three still posture (sitting still, standing still and lying still), four postural transitions (sit-to-stand, stand-to-sit, lie-to-sit, sit-to-lie), turn when lying and walking. In addition, fall detection is also featured in this algorithm. All the targeted items identified are processed in real-time process with wearable system. Preliminary performance test was conducted to verify the identification accuracy in laboratory-based phase. Results and further improvement was also discussed.

2.     Algorithm development

2.1 Instrumentation

A wearable motion detection device was designed to measure human activities. The device mainly consists of a PIC microprocessor (PIC18F6722, Microchip Inc.)and a motion sensor module, and is packaged in the size of 100mm×60mm×25mm (excluding the battery cartridge) with 140g in total weight. The motion sensor module utilizes a miniature tri-axial accelerometer (KXM52-1050, Kionix Inc.) which functions on the principle of differential capacitance in response to motion and constant gravity for measuring both acceleration and inclination. The device is attached to the pants’ belt at waist level because this position is close to the center of gravity of the body [Meijer et al., 1991; Bouten et al., 1997; Najafi, et al., 2002; Karantonis et al., 2006].

The analog signals of the sensor outputs are low pass filtered at 50Hz (-3dB) to reject noise spikes and then directed to the PIC microprocessor for data sampling with 10-bit 60Hz A/D conversion. The PIC microprocessor cyclically processes real-time physical activity identification with the programmed algorithm. This device is also equipped with an RF 433.92MHz wireless data transmitter. Each identified item is immediately forwarded to a local base station for data storage.

2.2 Algorithm design

Figure 1 shows the framework of the algorithm which is organized with five processing steps: Data sampling (Cx), pre-processing (Px), dynamic postural transition identification (DBx), still posture identification (DAx) and possible fall detection (DCx). All signals are processed in the time-domain analysis due to the limited computation capability of the PIC microprocessor and the constraints regarding real-time processing. A batch of sampled data is called an “event” to represent one physical activity item. This algorithm identifies one still postures or postural transitions/dynamic movement with 0.5s or 2.5s collected data in a processing cycle. In the case where there is no definite result determined throughout the processes, the event will be recorded as an “Uncertain movement” or an “Uncertain posture”.

Figure 1. Algorithm framework

Acceleration and inclination (tilt) data in each tri-axial channel (x-, y-, and z-axis) are calculated prior to the data sampling process. The data sampling process consists of the primary stage (C1) and the secondary stage (C2) respectively. The use of this dual-stage data sampling strategy ensures that the data of one event can be captured within the same sampling interval. After primary sampling (C1), process D1 determines whether any sign of dynamic movement exists by investigating accelerations in each axis. If no dynamic movement be detected (D1=No), the 0.5s tilt data relative to the vertical axis is used to identify one of the three possible still postures in the processes DAx. If dynamic movement is detected (D1=Yes), the secondary sampling (C2) is immediately activated to collect the subsequent 2.0s data. The data collected in both stages is combined (2.5s) and is then median-filtered (P1, window length n=3) to reject noise spikes. Moving average is further applied to the median-filtered accelerations data series. After the above processes, a dynamic event with six data series (accelerations of x-, y-, and z- axes, and their respective tilts) is to be identified in the following procedure.

The “slope mapping” technique is commonly employed to register apparent changes over the data series by mapping the pre-processed data series into a binary sequence. The slope sequences of each data series are intermediately generated to register the difference between the two neighboring sample values (Equation 1). The binary sequence data is then obtained from the slope sequence as Equation. 2. The entry ci in the binary sequence is assigned “1” if the slope entry si exceeds a specific threshold sthr. Otherwise, ci is “0”. The inherent properties of the binary sequence are the determinants to indicate the possible form of the original data. Figure 2 shows an example of applying slope mapping to a trunk tilt data of a sit-to-stand postural transition. Note that the binary sequence is expressed as a histogram to highlight the entries in “1”.

  i=1,2,3,…,n                                                                     (1)

     i=1,2,3,…,n                                                     (2)

Figure 1. An example of applying slope mapping to the trunk tilt data sequence

2.3 Identification of targeted physical activity items

(1)   Sit-stand postural transitions

The vertical acceleration is used to identify sit-stand postural transitions as its apparent sensitivity over the other two components. The acceleration patterns of sit-stand postural transitions can be characterized by three rules: R1: peak order; R2: peak distance (time interval) and R3: peak values. Figure. 3 shows an example of the vertical acceleration patterns from a test subject during slow, normal and fast sit-stand postural transitions. By comparing the upper (sit-to-stand) and the lower (stand-to-sit) pattern, the two postural transitions have opposite peak orders (a positive peak appears first and is followed by a negative peak for sit-to-stand, and the reverse order for stand-to-sit case). The peak distance (R2) indicates the time interval (in sec.) between that two peaks. Faster transition speeds generate shorter peak distance. The peak values for R3 represent the respective acceleration peaks in positive and negative regions. It is also evident for both sit-stand transitions that faster postural transitions produce shorter peak distance and higher peak amplitudes.

Coherent properties has also been observed in an extensive test with 15 recruited ostensibly healthy subjects of various ages (11 males and 4 females, 5 for young, middle-aged and elder, respectively). Practical threshold values for R2 and R3, were also extracted from test results. Either of sit-stand postural transitions can only be identified when the condition of all the three rules are satisfied.

Figure. 3. Example of vertical acceleration patterns of slow, normal and fast stand-to-sit transition acquired by the same subject

(2)   Walking and body turning when lying

If a dynamic event is not upright (D3=No), the tilt data of the antero-posterior and the medio-lateral directions is used in the decision D4 to determine a body turning movement when lying.As shown in Figure 4, walking is characterized by fast and repeated oscillating changes in the vertical acceleration. Previous study revealed that the frequencies of normal walking are between 0.7Hz to 4Hz with the peak acceleration values between 0.4g to -0.3g were reported [Sekine et al., 2000; Mathie et al., 2003, 2004]. Slope mapping is applied to the vertical acceleration data to recognize walking movement.

Figure 4. An Example of acceleration patterns in vertical and horizontal (antero-posterior) directions at level walking

(3)   Lie-sit postural transition

Lie-sit postural transitions can be identified and further distinguished by investigating both the trunk tilt variation and the final posture orientation. Figure 5 illustrates the coordinate of trunk orientation. Upright stance posture is defined as trunk orientations within -20° to 20° with reference to vertical. Lying posture is regarded as the trunk tilt greater than 70° or less than -70°. By applying slope mapping, a lie-to-sit transition produces positive increments in trunk tilt variation and ends with upright orientation. Similarly, a sit-to-lie transition produces negative increments in trunk tilt variation and ends with lying posture. Note that reverse stance (handstand) posture is not considered in the posture orientation.

Figure 5. Trunk orientation for still posture identification

(4)   Still postures

Distinguishing still postures requires the trunk orientation and the information of previously known postural transitions or walking. A still event can be recognized as a lying still posture according to the trunk orientation or a previous known sit-to-lie postural transition. Sitting still or standing still postures have upright orientation. Therefore, they can be distinguished by the existence of the types of previous sit-stand transitions or walking movement. If a still event is not lying and its previous posture transition is “sit-to-stand” or “walking”, this event is identified as “standing still”. On the other hand, the event is identified as “sitting still” if the previous posture transition is “stand-to-sit” or “lie-to-sit”.

(5)   Possible falls

A fall can be intuitively regarded as a movement accompanied by unusual high acceleration peaks in a very short time interval. A fall is detected with two phases in this algorithm. A “sign of fall” event can be recognized if there exists acceleration greater than Vf=±1.5g. In the second phase, the previously recognized “sign of fall” event could be raised to a “possible fall” if it is followed by a prolonged lying posture of which time duration exceeds TD=20s.

3.     Preliminary tests of the algorithm

3.1 Sensitivity and specificity test

In order to evaluate the sensitivity and specificity of the algorithm in identifying targeted physical activities, 10 subjects were recruited in a laboratory-based test. During the test, the subjects worn the measuring device and meanwhile were asked to perform each test items repeatedly as they habitually do in their free-living condition. They were allowed to be free to vary their movement styles (e.g., speeds or time intervals) arbitrarily. In addition, the test subjects were also informed of avoiding performing ambiguous movements.

The test items and the results are listed in the Table 1. The obtained results also reveal good performance compared with other research [Karantonis et al., 2006]. Note that sitting still or standing still postures were not included in this evaluation phase because this item is associated with other identified movement as described above. In addition, falling was not included because there is no unified form associated with falling.

Table 1. Evaluation of sensitivity and specificity of the algorithm in identifying still postures and dynamic vements


Sensitivity (%)

Specificity (%)

Lying still


















3.2 Demonstration of continuous monitoring at home

Figure 6 is the activity chronograph which chronologically displays more than 9000 recorded physical activity items over the 16-hour monitoring period in his home. The lines with different values represent respective identified items. The subject was not expected to use this system continuously throughout the monitoring period for some situations, such as taking a shower, going outside, etc. A report was made by the subject to register his actual activities/living behaviors during that monitoring period. The result of the monitored data reveals good correlation with reference to the subject’s actual activities.

Figure 6. Activity chronograph of 16-hour continuous monitoring

4.     Discussion and conclusion

The algorithm for real-time physical activity identification was developed and implemented in a portable microprocessor-based measuring device. It achieves good performance in still posture and dynamic activity identification. However, some inherent factors associated with identification accuracy are worth discussing here.

4.1 Instrumental factor

A tri-axial accelerometer was used in this study to measure the acceleration and body orientation caused by human movement. In fact, the most precise tilt sensing can be maintained when the accelerometer is at static, or under constant acceleration. Declined tilt sensing accuracy has been reported in combination of varying acceleration magnitude [Elble, 2005]. However, the measured tilt data still preserves sufficient information of body orientation. The attachment and personal fit of the device as well as power consumption of the device are the major factors affecting the overall performance. Note that two false possible falling events were detected in the continuous monitoring. Such condition might be avoided by lowering the sensing sensitivity to reduce the inference caused by the environment or improper device attachment.

4.2 Personal factor

As for the personal factors regarding the identification accuracy, it is certain that the characteristics of the activities vary from person to person. Even those patterns in a person are not uniformly the same. The algorithm would have difficulty in identifying mixed or ambiguous movement which is the combination of multiple activities in continuous phase. Therefore, identification accuracy of the algorithm could be limited when applied in a in one’s free-living environment, despite that fact that it achieves good performance from the laboratory-set tests.

4.3 Real-time processing factor

The relatively limited functional capability of the microprocessor, coupled with the fact that that real-time data processing must be synchronized within very short time period (e.g., less than 200ms), are the major factors concerning the identification performance. Most off-line systems capitalize on PC-based FFT, fuzzy inference or wavelet transform to analyze the recorded data. Therefore, PC-based data analysis techniques usually have higher identification accuracy over the real-time identification approaches [Najafi et al., 2003]. The vertical acceleration was found to has major significance over both antero-posterior and medio-lateral components. The performance of microprocessor-based real-time processing could be better enhanced if the required processes for the other data are properly reduced.

An accelerometry-based data processing algorithm for real-time human physical activity identification was developed and presented in this paper. This algorithm was specifically developed for microprocessor-based human motion measuring devices to facilitate real-time identification of several targeted physical activities in a home environment. The development work in this study also highlights the advantage of implementing real-time approach for physical activity monitoring. The accuracy of the algorithm was evaluated in a laboratory-based test and the demonstration of continuous monitoring shows the functional feasibility to recognize real-time physical activities. This developed algorithm can be incorporated into activity tele-monitoring applications to evaluate a person’s activity of daily living (ADL) and his status of physical mobility.


This research was sponsored by Medical Mechatronics Education Resource Center in Chang Gung University. This support is gratefully acknowledged.


Aminian, K., Najafi, B., 2004. “Capturing human motion using body-fixed sensors: outdoor measurement and clinical applications,” Comp. Anim. Virtual Worlds, vol.15, pp.75-94.

Bouten, C. V., Koekkoek, K. T. M., Verduin, M., Kodde, R., Janssen, J. D., “A Triaxial accelerometer and portable data processing unit for the assessment of daily physical activity,” IEEE Trans. Biomed. Eng., vol.44, pp.136-147.

Elble, J. R., 2005. “Gravitational artifact in accelerometric measurements of tremor,” Clinical Neurophysiology, vol.116, pp.1638-1643.

Foerster, F., Smeja, M., Fahrenberg, J., 1999.”Detection of posture and motion by accelerometry: A validation study in ambulatory monitoring,” Comput. Hum. Beh., vol.15,  pp.571-589.

Karantonis, D. M., Narayanan, M. R., Mathie, M., Lovell, N. H., Celler, B. G., 2006. “Implementation of a Real-Time Human Movement Classifier Using a Triaxial Accelerometer for Ambulatory Monitoring,” IEEE Trans. Info. Tech Biomed., vol.10, no.1, pp.156-167.

Mathie, M. J., Coster, A. C. F., Lovell, N. H. Celler, B. G., 2003. “Detection of daily physical activities using a triaxial accelerometer,” Medical & Biological Engineering & Computing, vol. 41, pp. 296-301.

Mathie, M. J., Celler, B. G., Coster, A. C. F., Lovell, N. H., 2004. “Classification of basic daily movements using a triaxial accelerometer,” Medical & Biological Engineering & Computing, vol. 42, pp. 679-687.

Meijer, G. A. L., Westerterp, K. R., Verhoeven, F. M. H., Koper, H. B. M., Hoor, F. T., 1991. “Methods to Assess Physical Activity with Special Reference to Motion Sensors and Accelerometers,” IEEE Trans. On Biomed. Eng., vol.38, no.3, pp.221-229.

Najafi, B., Aminian, K., 2002. “Measurement of Stand-Sit and Sit-Stand Transitions Using a Miniature Gyroscope and Its Application in Fall Risk Evaluation in the Elderly,” IEEE Trans. Biomed. Eng., vol.49, no.2, pp.843-851.

Najafi, B., Aminian, K., Paraschiv-Ionescu, A., Loew, F., Bula, C. J., Robert. P., 2003. “Ambulatory system for human motion analysis using a kinematic sensor: Monitoring of daily physical activity in the elderly.”, IEEE Trans. Biomed. Eng., vol. 50, no. 6, pp.711-723.

Nyan, M. N., Tay, F. E. H., Seah, K. H. W., Sitoh, Y. Y., 2006. “Classification of a Gait Patterns in the Time-frequency Domain,” Journal of Biomechanics, vol. 39, pp. 2647-2656.

Scanaill, C. N., Carew, S., Barralon, P., Noury, N., Lyons, D., Lyons, G. M., 2006. “A review of approaches to mobility telemonitoring of the elderly in their living environment,” Annals of biomed. Eng., vol.34, no.4, pp.547-563.

Sekine, M., Tamura T., Togawa T., Fukui Y., 2000. “Classification of waist-acceleration signals in a continuous walking record,” Medical Eng. and Phy. Vol. 22, pp. 285-291.

Veltink, P. H., Bussmann, H. B. J., Vries, W. D., Martens, W. L. J., Lummel, R. C. V., 1996. “Detection of static and dynamic activities using uniaxial accelerometers,” IEEE Trans. Rehab. Eng., vol. 4, pp. 375-385