1 Introduction

The fall in the elderly adults is a serious problem for the family and the community. Fall is the foremost problem for the ageing people since they may result in substantial injury and may even lead to death as mentioned by Tinetti and Williams (1997). The hitches resulting from falls may lead to a substantial reduction in overall efficiency status of the person including grave injury, resulting an increase in the utilisation of medical services as shown by Li et al. (2020). The fall may occur at the indoor (Bathroom, Bedroom, Living room, kitchen etc), on the staircase or at the outdoor. It is not always possible for an economically weak person to afford a caregiver. Often external people are hesitant as well as reluctant in the case of a stranger been fallen down. So, an automated alarming system for the fall is required that can send an urgent notification to the relatives and neighbours quickly to save the life. A frailty index, as specified by Hanlon et al. (2018), is often used to classify the physical condition of the seniors. The phenotype of frailty classifies the ageing people as frail when they possess three or above among five pre-specified conditions. They are at a risk of frailty if they have one or two conditions among: slow walking speed, low physical activity level, weak grip strength, exhaustion, and unintentional weight loss. The quality of life is one of the governing factors for increasing the risk of frailty. Hu and Xingda (2016) showed that the pre-fall posture detection is more important than post-fall posture as the fall prevention systems are designed based on it. Further, Syed et al. (2020) have indicated that the design of intelligent air bags in vehicles are also dependent on pre-fall posture for finer adjustment and improved protection. Additionally, Bloem et al. (2016) showed that the pre-fall pattern can also identify the movement disorder in any person. This aspect is, however, not much explored like normal Fall Detection System (FDS) or Activity of Daily Living (ADL), as stated by Kumar and Madhu (2015).The usual ADL activities may include laying, sitting, walking, running, jumping, climbing staircase etc. depending on the physical condition of the person. A FDS is an automated system to detect human fall using some detection algorithm. A fall may happen from any of the ADL activities. So, for an effective FDS, it is very important to determine the posture of the subject just before s/he fell down.

There are different smart home devices available (both as commercial and experimental) that are capable of detecting a fall as indicated by Van Lam and Yasutaka (2019). However, most of them, like (Srinivasan and Rajesh 2019), do not provide any additional information except that a fall has been detected along with time of fall. A detailed study by Cusimano and Saarela, (2020) on the patients admitted to neurology department due to head injury from fall between 2002 and 2017, indicated that the head injury is the most common and severe after fall incident for seniors(> 65 years) and the amount of traumatic brain injury (TBI) greatly varies depending on initial body posture(Sitting/Laying/Standing/Walking). The tendency of losing balance on a particular posture may provide additional information about the phenotype of the subject and may help in further clinical diagnosis.

Remaining paper is organised as follows: Sect. 2 presents state of the art literature survey to get some ideas of existing works, followed by problem identification and our contribution.

Section 3, illustrates proposed architecture with description of individual modules and their functions.

The detailed algorithms are shown in Sect. 4, followed by data collection and experimental results in Sect. 5.

Finally the accuracy of the model is calculated and the whole work gets concluded in Sect. 6.

2 Earlier works

2.1 Literature survey

The automatic fall detection method may be divided into three types

  1. 1.

    Non-ambulatory (acoustic and ambient sensor based).

  2. 2.

    Detection based on wearable sensors.

  3. 3.

    Detection based on images/visions.

In the fall detection techniques based on acoustic sensors , the detection method is based on the frequency component of vibration of the falling subject. Wearable sensor based techniques depend on kinematic sensors like gyroscope and accelerometer for fall detection during Activities of Daily Living (ADL). The digital image-based techniques perform a continuous monitoring of the subject in realtime using camera, and the postures are analysed by some computer algorithm. It offers greater precision compared to above two methods as indicated by Gutiérrez et al. (2021) in their survey. However they are usually not suitable for outdoor and pose threat to privacy as indicated by Mubashir et al. (2013).

2.1.1 Non-ambulatory sensor based methods

These types of structures usually comprise of microphones and sensors like infrared. Acoustic methods are analogous to the computer image based systems. The construction of such structure is usually less complex and cheap. It comprises of an ambient/acoustic sensor along with a personal computer. The collected data from the sensors are analysed by the PC. A fall event is detected based on certain threshold or using some machine learning techniques.

Zhang et al. (2013) proposed HONEY (Home healthcare sentinel system), a three-step detection scheme that consists of an accelerometer, audio, image and video clips. The purpose of the system is to detect falls by leveraging a tri-axial accelerometer, speech recognition, and on demand video. The average response time for a detected fall is 46.2 sec, which is also short enough for initiating a first aid. The overall detection accuracy is 94%.

Wang et al. (2017b) have given a model for efficient fall detection system based on WiFi with the pointer to activities using physical layer channel state information with the 3 indoor scenes arrangement of transmitter and receiver links. The system gives improved accuracy compared to other systems for a particular person. The performance is analysed using random forest algorithm involving support vector machine of single classifiers with the precision at the average rate.

Wang et al. (2017a) gave a home environment based fall detection system using WiFi devices. This system provided a cost effective, contactless real time environment. The subject doesnot feel any interruption by the system. It detects the fall and also provides a comfortable state to continue their activities on daily basis.

Tian et al. (2018) proposed a RF Based fall monitoring that used a Convolutional Neural Networks (CNN). This system is named as Aryokee, which uses an FMCW radio equipped with two antenna arrays: a vertical array and a horizontal array. The system could overcome the traditional difficulties of RF based recognition such as identification of proper subject from the crowd. They used two CNNs, one for fall event and the other for stand up event. The system could identify slow fall along with normal fall, minimising false alarms. However, the system requires a pre-setup indoor environment and not suitable for outdoor monitoring.

2.1.2 Wearable sensors based methods

Wearable sensors based method is more preferable than acoustic or ambient sensor based methods due to their low cost, small form factors, accuracy and portability as mentioned by Patel et al. (2012) and Thakur and Suparna (2020). In some detection systems, either an accelerometer or a gyroscope is used. However, some researchers used both the sensors to detect falls during daily activities. The micro-controller or personal computer process the data from the sensors. These wearable sensors are capable to operate independently. Therefore, the activities of elderly people are monitored constantly.

Avvenuti et al. (2018), used a smart shoe based gait phase detection using pressure sensors inside the shoe and a Bluetooth module in the sole for data transmission. They have defined the gait cycle as an event between toe off (TO) and heel strike (HO) of the subject. It could monitor the ADL and gait using wearable sensors in uncontrolled environment. The accelerometers are placed in different parts of the body of the subject. However, like all ambulatory systems, the senior subjects may be reluctant in using the model.

Yoo and Oh (2018), developed an artificial neural network (ANN) based fall detection system that uses accelerometer data from a wearable sensor mounted on the wrist of the subject. They claimed to be successful in removing most of the false positive cases that arises from a wrist mounted system.

Saleh and Jeannés (2019), proposed an accelerometer based fall detection system that uses SVM and a sliding window to extract a 12 point features from the accelerometer data. Then the fall is detected using the posture and threshold. They claimed that the experimental results on a large open data set showed that the accuracy of the proposed algorithm exceeds 99.9% with a computational cost of less than 500 floating point operations per second. Some authors such as Zhang et al. (2020) used smart wearable wristbands and Luna-Perejón et al. (2019) as well as Naeem and Khan (2019) used other wearable fall detectors to detect the fall.

2.1.3 Image and computer vision based methods

Computer vision based systems extract information from raw images for processing or analysing. The data can be video sequences and perspective views from multiple cameras. Computer vision is the science and technology of machines that has the ability to see.

The computer vision technique consists of three parts—the measurement of features, pattern classification based on those features, and pattern recognition.

Castaldo et al. (2017), used a meta model for detection and prediction of fall using HRV analysis on short term ECG data on hypertensive patients. They used Multinomial Naïve Bayes, that could predict first time fallers with sensitivity, specificity and accuracy rates of 72%, 61%, 68% respectively.

Melillo et al. (2017), have developed a method of identification of fall prone subjects from the group of ophthalmic patients ( near blind /Cataract /Glaucoma /Ageing) using various tree based classification methods. The data was collected from 141 patients for 12 months based on fall reporting via telephone. The data was analysed using WEKA.

Sheryl et al. (2018), designed a fall detection technique based on electromyography (EMG) and electrocardiogram (ECG). They have taken the data of both normal and sick people for this purpose. They have applied a KNN based hybrid classification technique using principal component analysis (PCA) for fall detection and prevention. The accuracy of the technique was moderate (85–87%).

Ferraris et al. (2019), developed a RGB camera based technique using Microsoft Kinect technology for automatic detection of instability among Parkinson patients by recording their joint and limb movements. They have used k-Nearest Neighbours (kNN), Multinomial Logistic Regression (MLR) and Support Vector Machine (SVM) with polynomial kernel on MATLAB for analysis of the posture of the subject. The system could identify the output with upto 95% accuracy with 2-classifiers and up-to 70% with 3-classifiers.

Table 1 Comparison among some state of the art designs

2.2 Problem identification

The analysis of various limitations of some state of the art designs in Table 1 shows that there is a requirement of a system that should be:

  1. 1.

    Economical and portable.

  2. 2.

    Implemented via a day to day usable device.

  3. 3.

    Able to perform some meaningful calculations and produce a part of independent output on the device itself.

  4. 4.

    Able to support a manual mode in case of a non-fall emergency.

  5. 5.

    Usable both at indoor and outdoor.

  6. 6.

    Tested on local data.

Additionally, the standard features supported by most of them should also be supported by the proposed system. Few of such identified features from Table 1 are summarised below.

  • Identify fall and pre-fall posture.

  • Identify fall location and date-time.

  • Send distress SMS with fall location and date-time in text mode.

  • Use state of the art hardware and software.

  • Must be a dedicated simple device suitable for senior adults.

2.3 Proposed system

The design goals specified in 2.2 are accomodated in the proposed system with some of our unique contributions as stated below.

  1. 1.

    It is based on ESP8266 WiFi module with MPU6050 (Accelerometer & Gyroscope) addon that has a small form factor, energy efficient and economical(less than US $10).

  2. 2.

    It supports both manual and auto mode. The manual mode is specifically designed to generate warning in case of non-fall critical events such as chest pain/stroke or any other type of emergency help requirement. It can be activated by a simple press of a switch on the device.

  3. 3.

    It is implemented on a common quadripod walking stick which is more stable and an essential companion for elderly people having the problems related to Parkinsons or freezing of gaits.

  4. 4.

    It is based on live data stream even for the machine learning based module.

  5. 5.

    The fall detection part is independently done on the device itself and posture recognition at server end to provide faster processing and response as well as reliability.

  6. 6.

    Audio-visual warning on the monitoring terminal and single/group SMS to the relative/s of the subject for faster emergency help.

  7. 7.

    Text based location display which is much faster than graphic (Map) based location display using WiFi positioning system (WiPS/WPS). The SMS receiver need not have to carry a smartphone or need to have an internet connection.

  8. 8.

    Identification of fall even if the device become ineffectual after the incident.

  9. 9.

    Minimise the number of warnings by considering only the fall without self-recovery case as the critical one.

  10. 10.

    Store all the data for any clinical diagnosis in future.

  11. 11.

    The ESP8266 device is programmed using micropython and the Raspberry Pi based server in python which are open source and state of the art software for embedded systems.

  12. 12.

    The system is easily portable to cloud and thus can increase the mobility of the subject.

  13. 13.

    Training data are based on local subjects of various age groups and genders for better result. The system has been cross validated across four different classifiers.

3 Proposed architecture

The architecture shown in Fig. 1, consists of two main modules: a threshold based module that detects the fall, based on live acceleration data and a machine learning module that detects the posture of the subject in every 20 seconds.

Fig. 1
figure 1

Proposed architecture

The brief working of each main module as well as the other supporting modules are explained below.

3.1 Fall detection module (FDM)

This module is integrated with SWA itself and operates as an independent module for fall detection and audible warning generation on the spot. It takes the raw live 3 axis accelerometer data and uses the moving average filter to normalise them. Then it applies a minimum and maximum threshold value to detect the fall. We have taken the approach based on Signal Vector Magnitude (SVM) to confirm the fall. The module is capable of ignoring the fall alike cases (Stumble, Fast sitting, Sudden increase in walking speed etc) by analysing the duration and threshold values. The module produces warning only if the subject fails to recover by herself. No warning is generated for Activities of Daily Living (ADL), fell but self recovered and fall alike events.

3.2 Posture identification module (PIM)

This module takes the live three axis accelerometer and 3 axis gyroscope data from MPU6050 and combines them using the complementary filter. The combined data is then analysed using Random Forest machine learning algorithms to detect the posture of the subject against the training data set of 20,000 data of each activity. The training set is based on a mixed aged volunteer data of Indian male and females from the age group of (10–15 years), (20–30 years), (35–45 years), (50–60 years) and (60–70 years) each performing four activities—Walking, Standing, Sitting and Laying. The posture is refreshed in every 20 seconds based on the live stream. The identified posture is sent as output. The module is tested with four different classifiers—KNN, SVM, Random Forest and Decision Tree and it is found out that Random Forest performed best with 99% overall accuracy.The detail accuracy calculation is shown in Section 6.

3.3 Location handling module (LHM)

This module is responsible for taking the location of the SWA from the ESP8266 WiFi module and using WiFi positioning system (WPS) to send the coordinates to Google cloud to obtain the corresponding address. The module automatically detects and updates the location when the subject moves from one location to another via the available hotspots. The output of this module is the location of the subject. The last location is stored in a file whenever a new location is detected. So later it is possible to track the entire movement of the subject for a particular period, if required. This module has a sensing frequency of 2 minutes in general (normal mode) and an immediate sensing in case of a fall, irrespective of time (event triggered mode). The module returns the last stored location in case it does not receive the device data, and timestamp of last location is not older than 10 minutes, attaching a special message.This module works as GPS module and eliminates the requirement of a separate GPS module for location detection. This reduces the cost and form factor as well as design complexity.

3.4 Integration module (IM)

This module integrates the input from FDM, PIM and LHM and prepares the output warning message if there is a fall or remains silent otherwise. In the event of a fall (Fall without self-recovery), the IM sends a popup warning to the monitoring station along with an audible alert. The warning message consists of the date-time stamp, last posture before the fall and the fall location. A copy of the same is sent to the SMS gateway that passes it on to the phone of the relative/s of the subject. A group messaging option can be used to send the message to multiple recipients to accelerate the emergency help.

The system operates in two modes- manual and auto.

  • In manual mode, the person can manually send emergency alarm in case of non-fall emergencies such as chest pain, nausea, stroke etc. A DPDT (Double pole-double throw)switch mounted on the SWA, toggles between manual and auto mode. When this switch is pressed upwards, a high decibel(100 dB) buzzer mounted on SWA alerts nearby people. Additionally, it disconnects the power supply of the ESP module making the device non-responsive. This invokes the non-responsive device handling module of algorithm 2 on remote RPi server forcing it to trigger alarm and send distress SMS.

  • When the DPDT switch is pressed downwards, the device operates in auto mode and monitors the movement of the person.

  • When the device is not in use, the DPDT switch is kept in the middle position to switch off the power and save energy.

Figure 2 shows the implementation of the system with one of our volunteers and the other auxiliary devices used.

Smartphone based FDS and ADL detectors are quite popular among researchers due to their matured technology, hardware and software support. However, the senior adults are not very comfortable with this platform and a dedicated device specifically designed for fall detection and ADL monitoring would have been much easier for them to use. So, we avoided all smartphone based approaches for our work.

An aspect worth to be mentioned here is that the newer MPU with MCU based monitoring systems are not only cheaper than smartphone based systems but also have several other advantages. A comparison between popular smartphone based monitoring and newer MPU+MCU device based monitoring is listed in Table 2.

Fig. 2
figure 2

Smart walking stick, the connection diagram, WiFi Router with internet connectivity, one of our volunteers with the prototype

Table 2 Comparison between smartphone and MPU+MCU based monitoring

4 Proposed algorithm

The live fall detection system proposed here uniquely records the immediate last posture before fall. It takes care of fall with recovery or fall without recovery to identify the intensity of the fall for timely support to avoid any casualty or criticality as discussed before. In case of  a fall with recovery, no alert message is sent. However, in case of a fall without recovery, an alert message goes to the relative or caregiver for a quick rescue of the person in distress. Now, the accuracy of this entire system is dependent on MPU data and it’s proper analysis. If sensor data collected drives towards some erroneous identification then a false alert may be generated causing people to unnecessary rush to the subject’s location.

4.1 Basic assumptions

The solution is proposed based on following assumptions–

  1. 1.

    The subject under monitoring must be accompanied with a smart walking assistant duly connected to a home WiFi with internet connection.

  2. 2.

    SWA is carried by the subject himself. The case, if the subject is not able to recover after a fall but someone else picks up the SWA causing change in accelerometer data which will falsely be identified as fall with recovery, is not considered.

  3. 3.

    After a fall, if no data comes to the local server for a stipulated period of time then it is considered that the device became unresponsive after fall with assumption that data disruption is caused only from the impact of fall and not by poor or no network connectivity.

  4. 4.

    Only the fall without self-recovery is critical.

The algorithm is divided into three components—Data acquisition, Data processing and output integration. The acceleration and gyroscope data are captured by the data acquisition server and sent to the appropriate modules for processing. The outputs are then combined to produce final output.

  • The \(SVM_\mathrm {acc}(threshold)>=2g\) is considered to be fall condition where g = 9.81 m/\(sec^2\).

  • \(A_x, A_y, A_z, G_x, G_y, G_z\) are the acceleration and gyroscope values along x,y and z axis.

  • Function check_loc () returns the location of the subject.

  • Function response_check () checks for non-responsive device.

  • Function fall_check \((A_x, A_y, A_z)\) checks for possible fall of the subject using the accelerometer data. It combines the accelerometer data using the signal vector magnitude. This function returns true if \(SVM_\mathrm {acc}>SVM_\mathrm {acc}(threshold)\) along with the other conditions stated earlier, using the formula

    $$\begin{aligned} SVM\mathrm {acc}=\sqrt{(A_x)^2+(A_y)^2+ (A_z)^2} \end{aligned}$$
  • Function pos_detect \((A_x, A_y, A_z, G_x, G_y, G_z)\) detects the posture of the subject using Random Forest algorithm.

figure a
figure b

5 Data collection and processing

The data capturing module receives the accelerometer and gyroscope data at a rate of 40 data per second for a duration of 500 seconds per activity. We have used an overlapping window of 2 seconds for synchronization. The FDM receives only the live acceleration data which is analysed using a threshold based approach on the device. The PIM receives both the live acceleration and gyroscope data and identifies the posture from four possible alternatives- Laying, Sitting, Standing and Walking through an already trained machine learning (ML) module.

We have trained the module with 20,000 local data for each activity, collected from five volunteers of both the genders and a wide range of age group from 10–15, 20–30, 35–45, 50–60 and 60–70 years. We have collected the localised data set to obtain a better result on 10 unknown subjects who are also the local users. We have tested the model with four classifiers- Decision Tree, SVM, Random Forest and KNN and found that the Random forest and KNN (with K = 3) yielded a good recognition result. The module refreshes itself in every 20 seconds based on the live data stream.

Fig. 3
figure 3

Fall without self-recovery

Figure 3 shows the warning at the monitoring terminal when a fall without self-recovery is detected (Fig. 3a) and an immediate SMS (Fig. 3b) is sent to the relative/s mobile phone/s specifying the posture, location and date-time along with the regular fall warning message as a text.

Fig. 4
figure 4

Ineffectual device after a fall

Figure 4 shows a response against an ineffectual device after a fall that sends the warning to both the terminal and to the relative/s via SMS.

Fig. 5
figure 5

True fall vs Fall alike cases

In Fig. 5, we have evaluated the cases of ‘Stumble’ and ‘Fast sitting’ which may generate the similar acceleration values as fall.

  1. 1

    Stumble: Even though we got the threshold values that are higher than the highest value of the fall, but the duration is well below the minimum threshold time that is required to record it as a fall. So, no warning was generated.

  2. 2

    Fast sitting: The fast sitting generated the acceleration values whose peak differences are (Max–Min) well below the required threshold value (2g), hence this case was also not recorded as a fall, which is the correct interpretation.

Fig. 6
figure 6

Accelerometer readings for different fall postures using SVMacc

Figure 6 shows the comparison result of the four cases of fall from different postures considering 300 data from each of the four cases. The SVM values of acceleration are distinctly higher (SVMacc > 40) in case of lay to fall and stand to fall. It is minimum in case of sit to fall (SVMacc < 35).

6 Performance and accuracy of the model

The Decision Tree (DT), Support Vector Machine (SVM), Random Forest (RF) and K-Nearest neighbour are the four most popular supervised learning methods for human activity recognition as indicated by Gomaa (2021). So, we have tested our model using these four classifiers- Decision Tree (Fig. 7a), SVM (Fig. 7b), Random Forest (Fig. 7c) and KNN (K = 3) (Fig. 7d). The stored data is split into training set and test set in a ratio of 70:30. A cross validation is performed and the split was done in a pure random manner using shuffling.

Fig. 7
figure 7

Accuracy under the four classifiers

The accuracy of the model is directly dependent on true positive, true negative, false positive and false negative. The Precision, Recall and f1-score may be obtained by

$$\begin{aligned} Precision(P)= & {} \displaystyle \frac{True~positives}{True~positives+False~positives}\\ Recall(R)= & {} \displaystyle \frac{True~positives}{True~positives+False~negatives}\\ f1-score= & {} \displaystyle \frac{2PR}{P+R} \end{aligned}$$

The accuracy that was generated by model validation system of each method is given Fig. 7 for a test data size of 1350 consisting of four activities- Laying, Sitting, Standing and Walking with a purely random distribution of frequency and location of each. The confusion matrix (Fig. 8) generated by the system is based on the above data. It is seen that the SVM gives the worst performance (16% accuracy for walking identification) while Random Forest is the best. The data from Fig. 8 shows that most error occurs between the posture standing and walking. However, while the Random forest(Fig. 8c) detects 269 out of 270 ‘Walking’ data correctly, the SVM (Fig. 8d) could identify only 45 walking data correctly out of 288 actual walking data.

Fig. 8
figure 8

Confusion Matrix for four classifiers

The activity wise performance comparison can be found out from the following graph. The four basic activities-Stand, Sit, Walk and Lay are considered for each subject. Each activity is tested against the four classifiers [Decision Tree, SVM, Random Forest and KNN] and the result is plotted in Fig. 9.

Fig. 9
figure 9

Activity wise accuracy comparison under different classifiers

7 Conclusion

With intensive advancement and success of sensors, Internet of Things, Machine Learning etc., the smart healthcare is now an affordable, user friendly and proactive solution that can ensure timely support. Micro Electro Mechanical System (MEMS) based sensors are exploited to detect fall and posture in elderly people who are prone to failure due to age related ailments while roaming outside or at indoors. Impact of a fall often gets unrecognized or untreated due to the negligence by elderly people, mostly living alone without any attendant, most of the time. Sometimes it is due to the forgetfulness of the people suffering from diseases like Alzheimer, Parkinson etc., causing memory loss. The SWA with WiFi connectivity is serving like a reliable, realtime attendant. The accelerometer, gyroscope sensor data are recorded and processed at local server live, to identify fall event and both static and dynamic postures like sitting, laying, walking, standing. Unlike most state of the art fall detection systems, our system is able to identify fall analyzing live stream of accelerometer sensor and also the last posture just before the fall to aid caregivers in diagnosing probable cause of a fall. Real data set of 20,000 samples for each activity is collected from local subjects irrespective of gender, age etc. This is used to train and test the proposed algorithm that is implemented in real test bed, applying four popular classifiers such as KNN, SVM, Random forest and Decision Tree, to find that Random forest outperforms the others with an accuracy of 98%. This work is worthwhile in extending smart health support to a person who falls but cannot recover immediately, by sending an alert message to the relative/s and thus minimizing the delay in initiation of necessary care. Timestamp, date and location of fall event is provided in the alert message. This work promises to provide an economic and smarter health care in near future. It may be possible to extend it into a disease prediction system, exploiting its unique feature of recording the last posture just before the fall, every time. This will help to analyse the proneness of fall of a subject from a particular posture. Disease prediction can extensively be done involving medical practitioners directly and also other vital physiological parameters may be considered such as pulse rate, heart rate, body temperature, blood pressure etc. to draw an inference or to predict cause of fall.