1 Introduction

Global Positioning System (GPS) is currently used in smartphones to navigate in outdoor regions. However, it cannot accurately do so in indoor environments [1]. To estimate positions in GPS-denied areas like underground zone, tunnel-regions, and indoor environments, it is the need of an hour to have a navigator which can estimate indoor position accurately. Currently, different types of Indoor Positioning Systems (IPSs) like ranging and localisation [2], camera [3], ultra-wideband (UWB) [4], Radio Frequency Identification (RFID) [5], and WiFi [6], based systems exist.

Fig. 1
figure 1

Reduction of noise by FFT based HPF and Kalman Filter applied on sensor data for training linear regression based model to obtain positional data

Indoor positioning refers to the technology that enables the determination of location of objects or people within a confined space, such as buildings, shopping malls, or airports. Indoor positioning systems encompass a variety of technologies tailored for locating objects or individuals within enclosed environments [7]. These systems can be classified into several categories based on the underlying technology they employ. Wi-Fi-based positioning relies on the triangulation of Wi-Fi signals and access points to determine location. Bluetooth-based systems utilize Bluetooth beacons or Low Energy (BLE) devices for proximity detection and triangulation. Inertial-based systems make use of sensors like accelerometers and gyroscopes to track movement. RFID-based systems employ Radio-Frequency Identification for tracking objects or individuals. Ultrasound-based positioning relies on ultrasound signals and sensors for distance measurement. Magnetic-based positioning utilizes Earth’s magnetic field for location determination. Visual-based systems leverage cameras and computer vision algorithms for recognizing visual landmarks and determining position. These different approaches offer varying levels of accuracy, cost-effectiveness, and suitability for specific indoor environments. To explore further research and citations on indoor-positioning, one can delve into academic databases using keywords such as Indoor Positioning Systems, Wi-Fi-based Indoor Positioning, Bluetooth-based Indoor Localization, Inertial Sensors for Indoor-Tracking, RFID in Indoor Positioning, Ultrasound-based Location Systems, Magnetic-Field-Positioning, and Visual-based Indoor Localization.

The need for accurate indoor positioning has grown with the increasing reliance on location-based services and applications. Several technologies and methods have been explored to address the challenges of indoor positioning. However, they require complex infrastructure and due to reception of unstable radio frequency (RF) signals due to fading, there is degradation in their accuracy and reliability [8].

Research background and related work in indoor positioning systems [9,10,11] have witnessed significant advancements driven by the increasing demand for location-aware services in indoor environments. One notable area of exploration has been the development of Wi-Fi-based positioning systems, leveraging the ubiquity of Wi-Fi infrastructure for indoor localization. Researchers have investigated techniques such as fingerprinting, trilateration, and machine learning algorithms to enhance the accuracy and reliability of Wi-Fi-based indoor positioning. Additionally, Bluetooth Low Energy (BLE) beacons have emerged as another promising technology for indoor localization, offering precise ranging capabilities and low power consumption. Alongside these infrastructure-based approaches, sensor fusion techniques combining data from multiple sensors such as accelerometers, gyroscopes, and magnetometers have been explored to improve positioning accuracy and robustness, particularly in scenarios where GPS signals are unavailable or unreliable. Moreover, advancements in ultra-wideband (UWB) technology have enabled high-precision indoor positioning, with applications ranging from asset tracking to indoor-navigation. Despite these advancements, challenges such as multipath interference, signal attenuation, and privacy concerns persist, motivating ongoing research efforts to develop more efficient and reliable indoor positioning solutions.

Foot-mounted IMUs are cutting-edge devices designed to accurately track individuals’ movements indoors using sensors like accelerometers and gyroscopes. By attaching them to the feet, they provide precise positioning even where GPS signals are unreliable. These IMUs use dead reckoning to estimate position changes based on past movements, overcoming challenges like error accumulation with advanced algorithms. Beyond indoor navigation, they find applications in virtual reality, healthcare, and sports analysis, offering versatile solutions for various industries. In essence, foot-mounted IMUs represent a promising technology for accurate indoor tracking where traditional methods falter [12].

Indoor positioning systems encounter a host of challenges [13], ranging from signal attenuation and multipath interference to limited GPS accuracy within buildings. Diverse building structures, device variations, dynamic environments, privacy concerns, power consumption, and integration issues further complicate the landscape. Overcoming these obstacles demands innovative solutions, emphasizing the need for robust algorithms and adaptable technologies. Researchers underscore the importance of addressing practical hurdles and continuously advancing positioning systems to meet evolving needs. This multifaceted endeavour requires a thorough understanding of the challenges at hand and ongoing efforts to develop effective solutions.

Smartphone sensor-based indoor positioning addresses the navigational hurdles encountered in buildings with weak GPS signals. By harnessing data from accelerometers, gyroscopes, and magnetometers, algorithms can be developed to achieve precise indoor location tracking. This advancement enhances user experience and facilitates the deployment of applications such as indoor navigation and location-based services [14].

Smart Phone’s built-in Inertial Measuring Unit (IMU) and pressure sensors-based IPS are comparatively preferable because they are easily accessible. Sensor noise is often affected by time in the sense that noise can accumulate over time due to various factors such as drift, temperature variations, and electronic noise. The longer a sensor operates, the more opportunity there is for noise to affect measurements. The accuracy of inertial-sensors-measurements like position estimates can degrade over distance due to factors like integration errors, drift, and environmental changes [15, 16]. Hence, there is a requirement of an algorithm to reduce the impact of noise and drift for efficiently processing the measured data for the accurate estimation of indoor position. Figure 1 illustrates the required algorithm for noise reduction to obtain the processed positional data.

This paper presents the indoor position estimation algorithm, which uses inbuilt smartphone sensor data to estimate the indoor position. Proposed algorithm utilizes the combination of sensor fusion using Rotational Transformation (RT) and Kalman Filter (KF), filtering with Fast Fourier Transform (FFT), and Linear Regression (LR) based model for training and validation techniques to process sensors data with improvement in indoor position accuracy. In this work proposed approach for obtaining proposed-positional data is based on inbuilt IMU and Pressure Sensor data of smart phone which is processed by the hybrid approach i.e. the combination of processed as-well-as the unprocessed data. In most of the existing methods sensor fusion and different AI approaches are used in different-manners. Approach used in this work is different as it uses both processed and unprocessed data to train the model to predict positions with comparatively higher accuracy.

The organization of the remaining paper is in such a way that Sect. 2 describes the related work, and an illustration of the methodology to implement the proposed method is in Sect. 3, the experimental work: details about the collected data, model performance, and results are in Sect. 4. Finally, this work concluded along with future work in Sect. 5.

2 Related work

Indoor positioning has become quite essential for enormous applications that include location-based services in indoor environments, locating lost items in private homes, indoor mobile-robot-based positioning [17], precise-positioning for robotic surgeries in medical and health care, guiding blind or impaired people to navigate, inspection of civil infrastructure, underground pipes and area, improves logistics and workflow efficiency by monitoring the movement of goods and personnel for manufacturing etc. [18]. Precise positioning is required to accomplish them. Smartphone-based indoor positioning emerges as a favourable solution, taking into account factors such as scalability, simplicity, cost-effectiveness, and widespread availability [19].

Researchers have reported many ideas for improvement of accuracies in position. Inbuilt inertial measuring unit (IMU): accelerometer, magnetometer, and gyroscope sensors data of smart-phone have been used for indoor position estimation using Kalman Filter (KF) based sensor-fusion approach with average positional error of 1.4 m for three different paths [20]. By utilization of Magnetic positioning and fusion of IMU sensors data via Extended Kalman Filter (EKF) for indoor positioning resulted in root mean square error (RMSE) of 1.53 m [21]. For a multi-floor building, to accomplish 3D localization, received signal strength (RSS) is enhanced by integrating it with sensor fusion of barometer, magnetometer, and inertial sensor’s data via Extended Kalman Filter (EKF) with average RMSE of 1.5 m [22]. For improvement in accuracy for the indoor environments, the smart-phones IMU sensor data fused using KF, and then feed-forward back propagation neural network (FFBPNN) based Artificial Neural Network (ANN) has been applied which resulted in RMSE of 2.38 m [23]. To the drift in smart-phones built-in micro-electro-mechanical-system (MEMS) sensors, drift bias, and KF-based approach has been implemented with less than 1.607 m positioning error [24]. Still, there is a broad scope to improve accuracy for various scenarios, environments, methods to obtain ground truth data, and trajectories.

3 Proposed method

In this work, the initial phase involves gathering marked ground-truth positional data (GTPD) for three cases. Subsequently, five updated methods are employed to generate five sets of experimental positional data for each of these three cases. To collect GTPD, coordinates are assigned to each point within the University Institute of Engineering and Technology (UIET) Block II building at Panjab University. The trajectories of three cases are delineated, with two cases maintaining the same altitude, while the third exhibits varying heights. Trajectories for Cases 1 and 2 occur on the first floor, while the trajectory for Case 3 commences from the middle of the first and second-floor stairs and ascends to the next (second) floor, as illustrated in Fig. 2. Ground truth trajectories for all three cases are depicted graphically in Fig. 3.

Ground truth data has been collected using physical measurements with the help of distance measuring tape. In the corridor of the 1st floor of the building, point A is marked with the help of a marker. This is a starting point. 3 coordinates (x, y, z) of point A are taken as (0, 0, 0). East to West horizontal distance is taken as x-coordinate, North to South horizontal distance is taken as y-coordinate, and bottom to top vertical distance is taken as z-coordinate. Then next point B is marked with coordinates (0, 1.16, 0) in meters. Similarly, C (0, 2.32, 0), D (\(-\)1.16, 2.32, 0), and so on... up to point T (\(-\)27.67, 4.9, 0) are marked. Like this through different points from A to T, a trajectory is made by joining all Points. Now voice enabled screen recorder and MultiSenses App (for collecting smart-phone’s in-built sensors data) are switched ON. Then a person holding a Pixel 6A smart-phone is allowed to stand at point A, then with the constant speed, a person moves from point A to point T in a marked trajectory. At every point a person pronounces the letter like A, B, C, and so on. Then after reaching point T, MultiSenses and screen recorder app are switched OFF. So, this experimental data was collected for one of the trajectories. Similarly data for other 2 trajectories have been collected. Time of travelling from point A to T is noted from generated voice enabled screen recorded video for that particular trajectory. Hence each point has its own time value. From this data ground truth trajectories are drawn as shown in Fig. 3a, c.

To meet the large sample size requirement for training a linear regression (LR)-based Artificial Intelligence (AI) model, the necessary number of intercepts from ground truth trajectories at specified time intervals are systematically collected. This effort results in the successful acquisition of the needed samples of ground truth data, with a consistent starting point set at zero for all three cases. For data collection from smartphone sensors, the MultiSenses app was developed https://github.com/Shivash9226/MultiSenses.git. Inertial Measuring Unit (IMU) and pressure sensor data for each trajectory are collected by the Pixel 6A smartphone using the MultiSenses app. In this app, calibrated sensors’ data have been used [25]. Magnetometer measurements are highly subject to indoor magnetic interference. So, Android Sensor framework’s TYPE_MAGNETIC_FIELD has been used for calibrating magnetometer readings. In this sensor type unlike the TYPE_MAGNETIC_FIELD_UNCALIBRATED, the hard iron calibration is already applied periodically by Android’s Sensor’s Framework [26]. Specifications for each smartphone sensor are observed using the MultiSenses app, and the specifications of the required sensors (IMU and pressure sensor) obtained from the MultiSenses app are detailed in Table 1. Figure 4a outlines the procedure for obtaining Positional Data 1 and 2. Linear accelerations and orientations derived from the smartphone’s accelerometer and gyroscope are merged using rotational transformations, as described in Eq. 1 [27].

Fig. 2
figure 2

Path of ground truth trajectories of Block II

Fig. 3
figure 3

Ground truth trajectory

Table 1 Specifications of sensors used to extract data

The utilization of the Fast Fourier Transform (FFT) followed by the Inverse FFT (IFFT) on earth linear accelerations (ELA) yields Inverse FFT-based accelerations (IFba). Thresholds applied for FFT based data using FFT-based High-Pass-Filter (HPF)[28]:

  • Attenuate noise < 10 Hz in the X and Y axes by 10 dB (or multiply signal by 0.1)

  • Attenuate noise > 5 Hz and < 10 Hz in Z axis by 10 dB

Positional Data 1 and 2 are then derived by applying Eqs. 2 and 3 to ELA and IFba data, respectively.

$$\begin{aligned} \left[ \begin{array}{l} x1 \\ y1 \\ z1 \end{array}\right]&=\left[ \begin{array}{ccc} \cos p1 &{} -\sin p1 &{} 0 \\ \sin p1 &{} \cos p1 &{} 0 \\ 0 &{} 0 &{} 1 \end{array}\right] \left[ \begin{array}{ccc} \cos r1 &{} 0 &{} \sin r1 \\ 0 &{} 1 &{} 0 \\ -\sin r1 &{} 0 &{} \cos r1 \end{array}\right] \nonumber \\&\quad \left[ \begin{array}{ccc} 1 &{} 0 &{} 0 \\ 0 &{} \cos a1 &{} -\sin a1 \\ 0 &{} \sin a1 &{} \cos a1 \end{array}\right] \left[ \begin{array}{l} X1 \\ Y1 \\ Z1 \end{array}\right] \end{aligned}$$
(1)

In this context, p1, r1, and a1 represent pitch or azimuth, roll, and yaw, respectively. Meanwhile, X1, Y1, and Z1 signify linear accelerations (LA), and x1, y1, and z1 denote ELA along the x, y, and z directions.

$$\begin{aligned}&v=u+at \end{aligned}$$
(2)
$$\begin{aligned}&s=ut+(1/2)at^2 \end{aligned}$$
(3)

where, v and u represent final and initial velocity, a is the acceleration, t is the time interval, and s is the distance. Figure 4b delineates the procedure adopted to obtain Positional Data 3. Within this process, IFba data, magnetic field data (acquired from the magnetometer) and orientation data (obtained from the gyroscope) are integrated using the Kalman Filter (KF). This integration yields KF-based data, encompassing orientations (w), magnetic field (m), and accelerations (fa) in the x, y, and z coordinates. Subsequently, by applying Eqs. 2 and 3 to the fa data, Positional Data 3 is derived. The mathematical model guiding the data fusion through KF is explicitly detailed by Eqs. 4 to 14 [29].

$$\begin{aligned}&dt=0.01 \end{aligned}$$
(4)
$$\begin{aligned}&x=\left[ \begin{array}{lllllllll} a_x&a_y&a_z&w_x&w_y&w_z&m_x&m_y&m_z \end{array}\right] \nonumber \\&F=\left[ \begin{array}{rrrrrrrrr} 1 &{} dt&{} 0&{}0&{}0&{}0&{}0.5 \times dt^2 &{} 0&{}0 \\ 0&{}1&{}0&{}0&{}0&{}0&{} dt &{} 0&{}0 \\ 0&{}0&{}1&{} dt&{} 0&{}0&{}0&{}0.5 \times dt^2&{} 0 \\ 0&{}0&{}0&{}1&{}0&{}0&{}0&{} dt&{} 0 \\ 0&{}0&{}0&{}0&{}1&{} dt&{} 0&{}0&{}0.5 \times dt^2 \\ 0&{}0&{}0&{}0&{}0&{}1&{}0&{}0&{}dt \\ 0&{}0&{}0&{}0&{}0&{}0&{}1&{} dt&{} 0 \\ 0&{}0&{}0&{}0&{}0&{}0&{}0&{}1&{} dt \\ 0&{}0&{}0&{}0&{}0&{}0&{}0&{}0&{}1 \end{array}\right] \end{aligned}$$
(5)

Here, \(a_x\), \(a_y\), and \(a_z\) represent accelerations in the x, y, and z axes, while \(w_x\), \(w_y\), and \(w_z\) denote orientations in the x, y, and z axes. Similarly, \(m_x\), \(m_y\), and \(m_z\) represent magnetic fields in the x, y, and z axes. The state vector x has initial values [0 0 0 0 0 0 0 0 0], and P, Q, R, H, and I are matrices representing State Covariance, Process Noise Covariance, Measurement Noise Covariance, Observation, and the Identity matrix, respectively. These matrices are initialized with values from a \(9 \times 9\) identity matrix. The State Transition matrix is denoted as F. The control input matrix (B) is defined by Eq. 6.

$$\begin{aligned} B&=\left[ \begin{array}{lllllllll} 1&{}0&{}0&{}0&{}0&{}0&{}0&{}0&{}0 \\ 0&{}1&{}0&{}0&{}0&{}0&{}0&{}0&{}0 \\ 0&{}0&{}1&{}0&{}0&{}0&{}0&{}0&{}0 \\ 0&{}0&{}0&{}0&{}0&{}0&{}1&{}0&{}0 \\ 0&{}0&{}0&{}0&{}0&{}0&{}0&{}1&{}0 \\ 0&{}0&{}0&{}0&{}0&{}0&{}0&{}0&{}1 \\ 0&{}0&{}0&{}0&{}0&{}0&{}0&{}0&{}0 \\ 0&{}0&{}0&{}0&{}0&{}0&{}0&{}0&{}0\\ 0&{}0&{}0&{}0&{}0&{}0&{}0&{}0&{}0 \end{array}\right] \end{aligned}$$
(6)
$$\begin{aligned} U&=\left[ \left[ a_x\right] ,\left[ a_y\right] , \left[ a_z\right] ,\left[ \omega _x\right] , \left[ w_y\right] ,\right. \nonumber \\&\quad \left. \left[ \omega _z\right] ,\left[ m_x\right] , \left[ m_y\right] ,\left[ m_z\right] \right] \end{aligned}$$
(7)

Considering U as the input variable.

Prediction Step: In this step, values of the next state are predicted based on the previous state according to Eqs. 8 and 9.

$$\begin{aligned}&x=x \cdot F+B \cdot U \end{aligned}$$
(8)
$$\begin{aligned}&P=(F \cdot P) \cdot (F ^ T)+Q \end{aligned}$$
(9)

Measurement Step: In this step, predicted values are updated by referring to the respective sensor data measurements according to Eqs. 10, 11, 12, 13, and 14.

$$\begin{aligned} y&=\left[ \left[ a_x\right] ,\left[ a_y\right] , \left[ a_z\right] ,\left[ \omega _x\right] , \left[ \omega _y\right] ,\left[ \omega _z\right] \right. \nonumber \\&\quad \left. [m x],\left[ m_y\right] , \left[ m_z\right] \right] -H \cdot x \end{aligned}$$
(10)
$$\begin{aligned} S&=(H \cdot P) \cdot (H ^ T)+R \end{aligned}$$
(11)
$$\begin{aligned} K&=(P \cdot (H ^ T))\cdot S^{-1} \end{aligned}$$
(12)
$$\begin{aligned} x&=x+R \cdot y \end{aligned}$$
(13)
$$\begin{aligned} P&=[I-K \cdot H] \cdot P \end{aligned}$$
(14)

In this regard, y is the Measurement vector, S is the Measurement Covariance, and K is the Kalman Gain.

Figure 4c describes the method for obtaining Positional Data 4 using the Linear Regression (LR) model, as defined by Eq. 15 [30].

$$\begin{aligned} y_{0i}=f_0\left( x_{0i}, \beta _0\right) +e_{0i} \end{aligned}$$
(15)

where:

$$\begin{aligned}&y_{0i} = \text {dependent variable} \end{aligned}$$
(16)
$$\begin{aligned}&f_0 = \text {function} \end{aligned}$$
(17)
$$\begin{aligned}&x_{0i} = \text {independent variables} \end{aligned}$$
(18)
$$\begin{aligned}&\beta _0 = \text {unknown parameters} \end{aligned}$$
(19)
$$\begin{aligned}&e_{0i} = \text {error terms} \end{aligned}$$
(20)

Here, an independent variables dataset is constructed using data from linear accelerations, ELA, magnetic fields, atmospheric pressure, angular velocity, and orientations obtained from the accelerometer, magnetometer, pressure sensor, and gyroscope. This dataset is both trained and validated using a Linear Regression (LR) model, randomly partitioned into training and validation data. The LR model is trained with actual positions as the dependent variable, utilizing separate x, y, and z components for each case.

Predicted positions (x, y, and z coordinates) for each case, generated exclusively from the independent variables using the trained LR model, are denoted as Positional Data 4. Figure 4d illustrates the method adopted for obtaining the proposed Positional Data 5. This involves forming an LR model-based dataset of independent variables by combining Inertial Measuring Unit (IMU) and Pressure Sensor data, Positional Data 1, Kalman Filter (KF) based: accelerations, magnetic fields, and orientations, IFba data and the previous values of Positional Data 3. This combined dataset is randomly split into training and validation data, with actual positions serving as the dependent variable during LR model training for each case.

Separate x, y, and z components are used in this LR-based model to generate predicted positions (x, y, and z coordinates) based solely on independent variables in each case, referred to as Positional Data 5. The extracted 3-dimensional Positional Data: 1, 2, 3, 4, and 5 undergo successive updates, culminating in the final proposed Positional Data 5. This method, termed as the proposed method, is detailed in Algorithm 1.

3.1 Explanation of the algorithm in the form of mathematical derivation and formulas

In this section algorithm 1 is explained step-by-step mathematically as:

Step 1–2. Beginning and gathering of data: In these steps, inbuilt sensors data of smart-phone: linear accelerations (LA) data from accelerometer, magnetic field (MF) data from magnetometer, Angular velocity (AV) and orientations (O) data from gyroscope, and atmospheric-pressure (A) data from pressure sensor have been collected.

Step 3. Rotational-Transformations: Rotational Transformation (RT) using Eq. 1 is applied on LA and O to obtain earth linear acceleration (ELA) data as in Eq. 21.

$$\begin{aligned} ELA = RT \cdot (LA, O) \end{aligned}$$
(21)

Step 4. Extract Positional-Data-1: Positional Data 1 is extracted by applying Eq. 2 and 3 on ELA data as mentioned in Eq. 22.

$$\begin{aligned} \text {Positional Data 1} = Equation\,3 (Equation\,2(\text {ELA})) \end{aligned}$$
(22)

Step 5. Apply FFT on ELA Data and then IFFT on FBA and then obtain PD-2: Apply Fast Fourier Transform (FFT) at frequency less than 10 Hz to suppress noise variations [8], to obtain FFT based accelerations (FBA) data as in Eq. 23.

$$\begin{aligned} FBA = \text {FFT}(ELA) \end{aligned}$$
(23)

Inverse FFT (IFFT) is applied on FBA to convert the frequency-domain based FFT acceleration data with eliminated low frequency noise variations below 10 Hz back to time domain as in Eq. 24.

$$\begin{aligned} IFBA = \text {Inverse FFT}(FBA) \end{aligned}$$
(24)

Positional Data 2 is obtained by applying Eqs. 2 and 3 on IFBA data as in Eq. 25.

$$\begin{aligned} \text {Positional Data 2} = Equation\,3(Equation\,2(\text {IFBA})) \end{aligned}$$
(25)

Flow chart in Fig. 4a shows the details of about the steps involved to obtain Positional Data 1 and 2 named as PD1 and PD2.

Step 6. Apply Kalman-Filtering: Kalman Filtering is applied on O, MF, and LA data to obtain Kalman Filter based: acceleration (KFA), magnetic field (KFMF), and orientation (KFO) data as in Eq. 26 using Eqs. 4 to 14.

$$\begin{aligned} KFA, KFMF, KFO = \text {Kalman Filtering}(O, MF, LA) \end{aligned}$$
(26)

Step 7. Obtain Positional-Data 3: Positional Data 3 is obtained by applying Eqs. 2 and 3 on KFA as mentioned in Eq. 27.

$$\begin{aligned} \text {Positional Data 3} = Equation\,3(Equation\,2(\text {KFA})) \end{aligned}$$
(27)

Flow-chart in Fig. 4b shows the steps involved to obtain Positional Data 3.

Step 8. Obtain previous-values of Positional-Data-3: Previous values of Positional Data 3 (PVPD3) are obtained by deleting the 1st row and shifting the remaining cells upward in Positional Data 3 which is the data to be provided as one of the training-dataset used for training LR model.

Step 9: Dataset Formation: Datasets for obtaining Positional Data 4 and 5 are named as PD4DS and PD5DS respectively which are shown in Fig. 4c, d explained in Eqs. 28 and 29 respectively.

$$\begin{aligned} PD4DS&= (LA, MF, AV, O, ELA, A) \end{aligned}$$
(28)
$$\begin{aligned} PD5DS&= (LA, MF, AV, O, ELA, A, IFBA, PD1, PVPD3) \end{aligned}$$
(29)

Step 10. Dataset Division: Data-set formed is divided into training and validation. From this dataset x, y, and z components have been used separately for both training and testing.

Step 11. Train Linear-Regression-based AI Model: Linear Regression (LR) models based on Eq. 15, are both Positional Data 4 and 5 as in Eqs. 30 and 31.

$$\begin{aligned} LR4&= \text {Train} (\text {Training Dataset of Positional Data 4}) \end{aligned}$$
(30)
$$\begin{aligned} LR5&= \text {Train} (\text {Training Dataset of Positional Data 5}) \end{aligned}$$
(31)

where LR4 is Linear Regression Model for Positional Data 4 and LR5 is Linear Regression Model for Positional Data 5 based datasets.

Step 12. Test LR model: Testing of LR model is done for both testing-dataset of Positional Data 4 and 5 based datasets named as TDPD4 and TDPD5 respectively as explained in Eq. 32 and 33.

$$\begin{aligned}&\text {Testing Results 4} = \text {Test LR4}(\text {TDPD4}) \end{aligned}$$
(32)
$$\begin{aligned}&\text {Testing Results 5} = \text {Test LR5}(\text {TDPD5}) \end{aligned}$$
(33)

where Testing Results 4 and 5 are the testing results obtained by applying LR4 and LR5 models on Test Datasets for obtaining Positional Data 4 and 5.

Step 13. Prediction of Positions based on LR Model: Positional Data 4 and 5 are obtained by predicting positions from trained LR4 and LR5 model as in Eqs. 34 and 35.

$$\begin{aligned}&Positional Data 4 = LR4(\text {Positional Data 4 data-set}) \end{aligned}$$
(34)
$$\begin{aligned}&Positional Data 5 = LR5(\text {Positional Data 5 data-set}) \end{aligned}$$
(35)

Positional Data 4 and 5 are the predicted positions obtained by applying LR4 and LR5 models on Dataset used for Positional Data 4 and 5. Procedures for obtaining Positional Data 4 and 5 are depicted in figures Figs. 4c, d.

4 Experimentation

To evaluate the performance of position estimation methods, three distinct cases have been examined. Each case involves a different path for data acquisition, as illustrated in Fig. 2.

4.1 Collection of data

Experimental data were collected using the MultiSenses app installed on a Pixel 6A smartphone. Graphs depicting the collected data for all three cases are presented in Figs. 5, 6, 7, 8 andd to 9. The graphs for Atmospheric Pressure Data, obtained using the ICP10101 Pressure Sensor, are shown in Fig. 5. Figures 6 and 7 display the graphs for Angular Velocity and Orientation data collected using the LSM6DSR Gyroscope. The graphs for Linear Acceleration data are depicted in Fig. 8, while Fig. 9 illustrates the Magnetic Field data graphs obtained using the MMC56X3X Magnetometer.

4.2 Measurement of model performance

The performance of five different methods for all three cases has been assessed based on the Root Mean Square Error (RMSE), calculated using Eq. 36 [31].

$$\begin{aligned} \text {RMSE}(y, \hat{y}) = \sqrt{\frac{\sum _{i=0}^{N - 1} (y_i - \hat{y}_i)^2}{N}} \end{aligned}$$
(36)

Where \(y_i\) represents the ground truth or actual positional data, \(\hat{y_i}\) depicts the experimentally generated positions, and N represents the number of samples.

Trajectories derived from both ground truth (GT) and calculated positional data, incorporating five distinct methods across all three cases, are illustrated in Figs. 10 and 11. Notably, trajectories for Positional Data 1, 2, and 3 deviate from the ground truth trajectories due to inherent noise. Positional Data 4 aligns with the ground truth data to a limited extent, attributed to the utilization of directly collected sensor data, introducing noise into its Linear Regression (LR)-based training model. In contrast, the hybrid proposed Positional Data 5 demonstrates improved accuracy across all three cases. Its LR-based model is trained not only from sensor data but also incorporates sensor fusion-based data, effectively reducing noise. Consequently, the trajectory of Positional Data 5 closely approximates the ground truth data trajectory in each case.

The notable disparities observed in the trajectories between GPS and GT data underscore the limitations of GPS accuracy in indoor environments. This discrepancy arises from signal blockage caused by building walls, highlighting the challenges of relying on GPS for precise indoor positioning.

4.3 Experimental results

The proposed Positional-Data (PD)-5 exhibits the closest alignment with the ground truth data trajectory in each case. To provide a detailed perspective of this trajectory, a comparison is conducted between its x, y, and z-axis components as-well-as the corresponding ground truth (GT) data in each case. The analyses for these components can be observed in Fig. 12.

Error graphs between Positional Data 5 and the ground truth data in the x, y, and z axes for each case are presented in Fig. 13. The summary of Root Mean Square Error (RMSE) values in position across all three cases, comparing the Global Positioning System (GPS) and various Positional Data (PD) against the Ground Truth (GT) data, is presented in Table 2. This comprehensive analysis aims to elucidate the necessity of employing multiple sensors and progressively incorporating processed data in a step-by-step experimental approach. The ultimate objective is to discern the underlying reasons contributing to the notably minimal error observed in proposed PD-5. The table reveals that in Case 1, the RMSE values from left to right are 26.11 m, 7.82 m, 16.64 m, 2.76 m, 0.79 m, and 36.3 m for PD-1, PD-2, PD-3, PD-4, PD-5, and GPS Data, respectively. The highest RMSE is observed in GPS Data due to signal blockage by indoor walls, resulting in reduced accuracy. PD-1 exhibits comparatively lower RMSE than GPS Data, attributed to its derivation from Rotation Transformation (RT)-based sensor fusion of orientations (\(\omega\)) and linear accelerations (a) data. However, it lacks proper direction, leading to some drift from the original trajectory. The RMSE for PD-2 is lower than that of PD-1 because in PD-2, a Fast Fourier Transform (FFT) based High Pass Filter (HPF) is applied to Rotational Transformation (RT) based \(\omega\) and a for the reduction of low-frequency noise. The resulting data undergoes Inverse FFT (IFFT), making PD-2 less noisy than PD-1. RMSE for PD-3 is greater than PD-2 but less than PD-1 because magnetic field (m) data has been incorporated using a Kalman Filter (KF)-based sensor fusion approach along with \(\omega\) and a to improve the direction of the resultant trajectory formed by PD-3. However, due to magnetic drift, the RMSE value of PD-3 is greater than that of PD-2. RMSE for PD-4 is very small, only 2.76 m. This is attributed to PD-4 consisting of predicted positions obtained from a Linear Regression (LR) based model trained from mobile’s IMU, pressure sensor’s data, as-well-as earth linear accelerations data obtained from RT. This has minimized noise and drift to the maximum extent,

Algorithm 1
figure d

Data Collection and Processing for obtaining proposed Positional Data 5

Fig. 4
figure 4

Flowchart showing procedure adopted to obtain different Positional Data

Fig. 5
figure 5

Atmospheric Pressure Data

Fig. 6
figure 6

Gyroscope Angular Velocity Data

Fig. 7
figure 7

Orientation Data

Fig. 8
figure 8

Linear Acceleration Data

Fig. 9
figure 9

Magnetic field Data

Fig. 10
figure 10

Ground Truth, GPS, and Positional Data trajectories for case 1

Fig. 11
figure 11

Ground Truth, GPS, and Positional Data trajectories for cases 2 and 3

Fig. 12
figure 12

Ground Truth and Positional Data 5 Trajectories in x, y, and z axis

Fig. 13
figure 13

Error in Positional Data 5

Table 2 Root Mean Square Error (RMSE) for positional data of 3 cases
Table 3 Comparison of RMSE for the proposed method with the existing literature

The RMSE of the proposed PD-5 is the least at 0.79 m because its LR model has been trained not only from unprocessed data obtained from the mobile’s IMU and pressure sensor’s data but also from processed data, i.e., PD-1, previous values of PD-3, KF-based accelerations, magnetic field, and orientation data, ELA, and IFFT-based acceleration data. The reduction of noise and drift from the processed data is more extensive than that from the unprocessed data. Increase in processed data for the generation of PD-5 leads to its least error. A similar explanation can be applied to cases 2 and 3.

From Table 2, the vertical movement reveals that the RMSE for Case 2 is notably smaller than that for Case 1 in PD-1, PD-3, PD-5, and GPS Data. This discrepancy is attributed to the larger trajectory length in Case 1, where noise and drift tend to increase with trajectory length. However, for PD-2 and PD-4 of Case 2, the RMSE exceeds that of Case 1. This is because the FFT-based HPF filter utilized in Case 2 to filter out low-frequency noise in PD-2 inadvertently filters out useful signal data points due to the smaller trajectory size in this case. The RMSE for PD-4 in Case 1 is less than that of PD-4 in Case 2 due to the availability of larger data points in Case 1 than Case 2 for training the LR-based model, as the length of the Case 1 trajectory is larger than that of Case 2. The RMSE of PD-3 is highest in Case 2 due to the smaller length of the trajectory, leading to high magnetic drift in proper direction estimation. GPS Data remains almost constant, and only one or a few points get changed even after traveling along a larger part of the trajectory. So, for the larger trajectory in Case 1, GPS data shows a larger RMSE than that of Case 1. In the Case 3 trajectory, vertical distance has also been covered while climbing stairs. Among all three cases, the RMSE of PD-1, PD-2, PD-3, PD-5, and GPS Data in Case 3 is comparatively smaller because for the Case 1 and Case 2 trajectories, which do not have any vertical distance, the error due to drift persisting because of noise is high. As the horizontal distance increases, sensor noise further gets increased, resulting in enhanced drift in the negative z-direction. In Case 3, the RMSE in PD-4 and PD-5 is comparatively less because these positional data have been obtained from their respective LR-based models in which Pressure Sensor’s data have also been used for training them.

The increase in sensor count for both sensor fusion and Linear Regression-based Artificial Intelligence (AI) model training notably enhances accuracy. This is evident in the superior precision of PD-4 and PD-5 compared to PD-1, PD-2, and PD-3. A closer examination of PD-5 against PD-4 reveals a reduced Root Mean Square Error (RMSE), highlighting the positive impact of training with large processed datasets on overall accuracy. This underscores the significance of sensor count augmentation and the utilization of extensive processed data, forming a comprehensive strategy for improving accuracy in positional data analysis.

4.4 Results

In indoor environments, several factors can significantly influence positioning accuracy, as identified in the literature [32]. These factors include power levels and battery status, where low-battery-levels or fluctuating power-levels can compromise the performance of device sensors and positioning modules. Additionally, the quality of device-hardware plays a crucial role, as variations in sensor precision and sensitivity, as well as overall build quality, can affect accuracy. Environmental conditions such as temperature, humidity, and atmospheric-conditions also contribute to positioning inaccuracies, impacting certain positioning-technologies differently. Furthermore, the choice and implementation of data fusion techniques are pivotal, as they determine how data from different sensors and sources are integrated, ultimately influencing the overall accuracy and reliability of the positioning system.

The validity of data is ensured through rigorous processes. Ground truth data is obtained directly from physical measurements using distance measuring tape, ensuring accuracy in the reference values. Moreover, a substantial sample size was utilized, comprising of various samples for 3-different trajectories: 5051 for 1st-trajectory, 4598 2nd-trajectory, and 4238 samples for the 3rd-trajectory, enhancing the reliability of findings. To assess accuracy, Root Mean Square Error (RMSE) is computed by comparing the ground truth values with the calculated ones, providing a quantitative measure of the model’s performance.

A comparison of Root Mean Square Error (RMSE) between the existing positional data obtained from the literature and the proposed Positional Data 5 (PD-5), along with the corresponding techniques, is presented in Table 3. The table clearly illustrates the RMSE values reported by different authors: 1.4 m [20], 1.53 m [21], 1.5 m [22], 2.38 m [23], and 1.61 m [24] along with their techniques. The proposed method is based on the combination of KF, RT based sensor fusion (SF), filtering via FFT and LR based technique i.e. hybrid approach to obtain PD-5. The results obtained for PD-5 can be analysed from graphs in figures 10f for case-1, 11f in 2nd-case, and 11l for case-3. The trajectories obtained from proposed predicted PD-5 matches with ground-truth-trajectories to larger extent. The individual comparison between x, y, and z axes of PD-5 and ground truth based positions for all 3 cases have been indicated in graphs of figure 12.

The data derived from the innovative 3D multi-floor-based method, PD-5, has been analysed, revealing an average error of merely 0.51 m across three distinct cases. This remarkably low Root Mean Square Error (RMSE) value establishes PD-5 as a frontrunner in accuracy when compared to the findings reported in existing literature. The superior precision of PD-5, evident in its RMSE value being the smallest among those documented, underscores its potential to significantly advance the state-of-the-art in positional data accuracy.

5 Conclusion and future work

In conclusion, this paper presents an effective method for indoor positioning, utilizing the inherent pressure and IMU sensors of smartphones. The stepwise generation of four positional data types culminates in the proposed Positional Data (PD)-5, achieved through a hybrid approach. This method incorporates Rotational Transformation, Kalman Filtering, FFT-based High Pass Filtering followed by Inverse FFT, and Linear Regression models. PD-5 demonstrates minimal noise and drift, boasting high accuracy with an average Root Mean Square Error (RMSE) of 0.51 m across three cases. Comparisons with existing algorithms reveal a notable 19.49%\(-\)78.57% improvement. This outcome not only highlights the effectiveness of PD-5 but also positions it as a promising and reliable approach for achieving more precise location tracking in various applications, surpassing the performance of previously established methods. Looking forward, future advancements can focus on enhancing the accuracy of initial position determination from mobile sensors data. This can be achieved by extending the hybrid approach to incorporate advanced sensor fusion techniques such as Particle Filter, Extended Kalman Filtering, FFT-based High Pass Filtering, and advanced regression-based AI techniques like Kernelized Ridge Regression, Support Vector Machine, Random Forest, and Neural Network Regression. This expanded methodology aims to minimize errors not only for specific data types but also for diverse and larger datasets, considering non-linearity factors.