Prediction of Cyclists Movement in Different Terrain Conditions

In Malaysia, most of the accidents involving a bicycle and another vehicle are due to either the driver or rider ‘failing to look properly’. This is more significant with the government initiatives to support the use of bicycle making the carbon-free environment, a vision of TN50. This research addresses the safety aspect of the cyclists in terms of the driver’s point of view which improves cyclist visibility during driving. The proposed helmet system implements a rule-based algorithm which predicts the turning and braking movement of the cyclists. With this system, additional illumination and signaling are provided for the cyclists. The major challenge faced is the implementation of an algorithm for various situations of cycling. To ensure the system could be used on the road, the accuracy and speed of the automatic signaling system need to adhere. Situations that affects the output of the indicators include bicycle speed, the angle of turning, body tilt, duration of turn and random body movements. This paper implements a 3-axis accelerometer and a microcontroller in a data logger to acquire the required data which are analyzed in MATLAB. Using filtering technique, the acquired data are then be cleaned to remove noise due to vibration during cycling. The characteristics of braking and turning are then analyzed in the time domain as well as frequency domain to ensure the optimum algorithm used for gesture recognition and movement prediction. The algorithm is based on sliding window, FFT and threshold-based rule algorithm. The output based on the rule-based algorithm then illuminate the corresponding signals which provide the safety feature of the system.


Introduction
70-80% of accidents between a bicycle and another vehicle is found to be mainly due to human error.Through initiatives raised from various governing bodies, the improved usage of the bicycle is supported to reduce carbon emissions from the motorized vehicle [1].Therefore the safety aspect of a cyclist must be improved to encourage usage of a bicycle while reducing the statistic of accidents.Automated helmet signals are proposed to improve the safety aspect of.This is due to an observation that road users tend to neglect the usage of safety signals which could lead to serious repercussions.
At the initial stages, as the technology for automation is still improving, the addition of automated safety signals on the helmet is affected in terms of speed and accuracy due to low speeds of cycling as compared to a motorized vehicle.Therefore, this research intends to provide automatic signaling and illumination such as brake signal and turning signal acquired from inertial sensors mounted on the helmet.The main challenge of the research is to implement movement prediction algorithm.This is implemented by using an accelerometer.The accelerometer has an advantage over other inertial measurement unit are cheaper and accurate as compared to gyroscope and magnetometer with a wide frequency range.This effect is demonstrated in Siti Sarah et.al. (2017) [2].The accelerometer directly measures the movement of the cyclists, but this recorded raw data has limitations in which if there is excessive noise in the signal, the analysis of the raw data in the time domain is used.Therefore, a reliable prediction technique is required if the system is to be implemented on the road.An accelerometer-only system is designed due to its low power consumption, low cost, and ease of usage.This is further backed by its capability to measure acceleration, orientation, rotation, and motion.By combining the stated characteristics, an accurate and robust prediction system could be achieved with a specifically designed algorithm for prediction.Figure 1 shows a typical 3-axis accelerometer.The efficiency of an accelerometer-only solution is explored from its ability to measure movement, orientation and rotation changes by O. Incel.The efficiency is then compared with a combination of accelerometer, gyroscope and magnetic field sensor.It is found that the performance of an accelerometer-only solution can achieve up to an 80% recognition which doesn't differ much from a combination of accelerometer, gyroscope and magnetic field sensor.When the gyroscope and magnetic field sensor are used alone, they do not reach the capabilities of the accelerometer.It is also found that when the motion, orientation and rotation information from the accelerometer are combined in a specifically designed algorithm, it provides a much higher accuracy as compared to using the motion information alone.Therefore, the accelerometer only system is preferred due to its low power consumption and accuracy [3].To ensure minimal noise affecting the output of the accelerometer due to vibration during cycling, low pass filter is introduced to be incorporated to the measurement system.The low-pass filter functions by smoothing the measured signals to clean and remove noise while performing data averaging.A method for cleaning of noisy signal through low pass filter is explained in Suresh Manic et.al (2014) [4].Furthermore, important patterns and trend within a signal could be made more vivid as the frequencies due to noise are removed.The filter functions by attenuating signals above a predetermined cut-off frequency which is manually set after obtaining necessary data from tests done.Figure 2(a) shows an example of the low pass filter applied to a noisy signal.The noisy signal is denoted by the green line whereas the low pass filtered signal is shown by the blue line.[5] Implementation of sliding window function applied for easier extraction of the acceleration data in time series.The sliding window is a continuous function whereby the window length is determined after analyzing the data sets recorded by the data logger.An example of a sliding window is shown in figure 2 (b) [6].An implementation of FFT analysis is used next to determine the frequency domain of the data.From the frequency domain features, the frequency and frequencies amplitude of data of the accelerometer could be then calculated.The analysis of repetitive signals obtained from vibrations along with any harmonics within the signal could then be obtained.An example of FFT implementation with a time-series signal is seen in Fig. 1.3 (a) [7].A rule-based system consists of if-then statements whereby the rules are implemented to act upon specific proclamations.The rule-based system often provides answers determined by validation and verification of each manually constructed rules.Such systems provide the output for any given problems automatically in place of human experts.The data is analyzed in MATLAB to determine peak accelerations.From the peak accelerations, rules are introduced using threshold techniques.As seen in Fig. 1.3(b), the amplitude of acceleration for the movement analyzed is large for a typical fall.The threshold for the fall is determined by the green dotted line whereby the rule is set to be above a predetermined threshold [8][9].There are variations of helmet implemented with inertial sensors, but it is proven to be bulky due to multiple inertial sensors and suitable for usage in the field.Therefore, this paper addresses the gap by implementing an accelerometer on the helmet.From the data measure real-time, sliding window function is applied to the data whereby FFT is implemented in the window length.From the frequency domain, a threshold based rule algorithm implements the output related to the rule.The development of the movement prediction system incorporates a single 3-axis accelerometer in the helmet to estimate the orientation or position of a body.Because of the advantages of using an accelerometer has over other Inertial Measurement Unit (IMU) which are its low power consumption, low cost, and small size, the accelerometer is used.For problems related to measurement biasing and noise, it is determined from above reviews that low-pass filter is easy to implement and accurate.Various limitations such as memory constraint, sensor constraint, cost constraint and microcontroller constraint are determined.

Data Logging
The data logger is built to record the head movement in conjunction with the bicycle movement of the rider.The system includes an accelerometer, SD module, microcontroller and power supply mounted to a helmet.For bicycle movement logging, a switch and potentiometer are connected to the bicycle handle and is wired to the microcontroller on the helmet.The system connection is represented and connected based on Figure 5 which shows the outline of the system.The data recorded includes three outputs of the accelerometer an output of the switch and the potentiometer output which is then be stored in the SD card and further analyzed in MATLAB.The schematic design of the data logger is as seen in Figure 6.The microcontroller is powered by a 9V battery whereby it provides a 5V to the SD card module and 3.3V to the accelerometer.For turning prediction, two types data are recorded which are the head movement acquired from the accelerometer and handle angle movement which is obtained from the potentiometer connected to the pivot of the handle bar.The handle movement data obtained is from the variation of voltages based on the turning of a potentiometer which is due to the turn of the bicycle handles.The working operation is by setting the middle of the potentiometer in position with the center of the handle angle.During straight cycling movement, the voltage is half of the supply voltage.As the bicycle turns left or right, the voltage decreases or increase corresponding to the turn.This value is then recorded in conjunction with the recorded head movement of the accelerometer.
For braking prediction, two types of data are recorded as well, which are the head movement obtained throughout the cycle and position of brake handles which is obtained from connected switches.During braking, the output of the switch is high and vice versa.The accelerometer data, handle movement and braking movement is recorded simultaneously to ensure the analysis in MATLAB is much easier and smoother.Figure 7 (a) shows the connected data logger is installed on a helmet.The reason of applying the data logger on the helmet is due to the need of analysing head movement during cycling.As there is a right turn, left turn or brake, the head move accordingly, therefore the data recorded then be analysed to determine the characteristics of the data.For the logging of movement of bicycle, the system designed and is shown in Figure 7 (b).

Analysis of accelerometer data
The analysis of the raw data obtained from the data logger is done in MATLAB which provides all the required functions and algorithm along with an extensive online support.The initial stage is to plot the raw data and analyse the characteristics of the braking and turning raw data.For the braking data, it can be seen in figure 8 Figure 10 shows the frequency spectrum within the sliding window.Furthermore, for braking the FFT mainly applied at the X-axis as the change in braking is more prominent.Therefore, by analysing the frequency domain, there is a peak in the braking signal at around 2 Hz.During constant straight cycling which is from 252-257.03 sec, it is seen that there is no peak in the frequency domain.

Results and Discussion
From the methods stated, the results are processed up to the implementation of thresholdbased rule algorithm for braking analysis and turning analysis.

Braking analysis
In table 1, a braking signal recorded which is from the X-axis.The data are then converted to the time domain and frequency domain.In the time domain, the analysis of impulse and transient accelerometer signals is possible.With the addition of external noise such as vibrations, it is more difficult.Therefore, FFT algorithm is applied to the time domain signal to convert it into the frequency domain for spectrum analysis.In the frequency domain, each individual frequency and its amplitude is displayed which enable the analysis of repetitive signals.As seen, the peak n frequency is at 2hz.This shows that the changes in frequency during braking is very small but at a high rate.In Table 2, a data for cycling on a road bump is recorded.It is found that by plotting the data, the main axis which displays a vivid road bump cycling is mainly at the Z-axis.The data are then converted to the time domain and frequency domain.In the time domain, it is seen that the signal peak followed by an instantaneous drop and then return to its previous position.This shows that the accelerometer moves up and down along the z-axis while in this cycling movement.When FFT algorithm is applied to the time domain and the signal is converted to the frequency domain, the frequency cluster at an average of 10 Hz.In table 3, a data for constant cycling are recorded.During constant cycling, not many changes occur on all 3 axes.The data sets are then converted to the time domain and frequency domain.In the time domain, it is seen that the signal maintains a constant level throughout the duration When FFT algorithm is applied to the time domain and the signal is converted to the frequency domain, the frequency is found to be at a very low amplitude.As seen in the y-axis of the frequency domain, the magnitude doesn't exceed 110 −4 .

Turning analysis
Compared to the braking implementation of prediction and gesture recognition, the turning implementation is significantly harder.This is due to various situations such as duration of the turn, speed during a turn and head movement during the turn.In Table 4, a data set for left turn cycling are recorded.It is found that when the time domain of the left cycling data is converted to the frequency domain, there is not much difference with the braking frequency domain.This is due to the change in frequency during turning is too small, therefore the data sets are clustered around the 1Hz frequency.The only difference this frequency domain has over braking frequency domain is that braking frequency is derived from the X-axis while turning frequency is derived from Y-axis.By analyzing the time domain data which is in Y-axis, an initial rule for turning is derived.The rule is derived when sliding window is applied on all 3-axis separately.When there is a large change in the frequency domain for Y-axis as compared to the X and Z-axis, the algorithm can output an initial turning condition.In table 5, a data for right turn is shown.Similarly, for a left turn, right turn output the same frequency in the frequency domain.By following the rule stated earlier which is to apply sliding window on all 3-axis and then analyze the changes in the axis.If the change in the frequency domain for Y-axis is much larger than the other axis, a turn is occurring.

Conclusion
A concept for movement prediction is presented using an accelerometer.The algorithm is based on the sliding window function, FFT and threshold-based rule algorithm.In terms of the accuracy for the turning indication, it is not up to the safety standards yet.The processing speed is not to be tested as the suitable microcontroller for the final product is not implemented.With the completion of this research, a significant improvement in the safety standards related to cycling is achieved.For future work, the improvement in algorithm is a must to keep up with the safety and automated standards in the society.To further increase the efficiency of the system, a GPS and mapping software is implemented alongside this system.Another method to improve this system is to implement the algorithm within a smart phone due to it containing all the necessary IMU such as an accelerometer, gyroscope, GPS, magnetometer etc.With the constant improvement and advancement in technology, the efficiency of this IMU within the smart phone keeps improving as well.This reduces the cost of the overall system and implementation will be easier due to decrease in components.

Fig. 2 .
Fig. 2. Comparison of low-pass filtered signal and the sliding window of 10 secs.

Fig. 3 . 2 Figure 4 Fig. 4 . 4 MATEC
Fig. 3. Time domain and frequency domain and the application of a threshold to the data.

Fig. 5 .Fig. 6 .Fig. 7 .
Fig. 5. System connection of the data logger (a).A vivid indication of the braking is seen along the X-axis whereby there is sharp drop in the data.Not much changes occur in the Y and Z axis during braking.The braking signal is provided by the connected switch and indicates a high when braking and low in non-braking conditions.visible change is caused by the vibration during stopping.The turning raw data as in figure 8(b) and figure 9(a) whereby they represent left turn and right turn respectively.During turning, the most affected axis is the Y-axis.When turning to the left, the voltage of potentiometer increases while the Y-axis signal increase towards the negative Y-axis.When turning to the right, the voltage of the potentiometer decrease while the Y-axis signal increases towards the positive Y-axis.Figure 9 (b) shows the sliding window function by 2 parallel red lines.The window length of the sliding window is 150 which equates to 5 seconds.With this function, the data points is analysed easily with the implementation of FFT within the window.As seen, the frequency domain is extracted from the two-different window time.By analysing the time domain graph, it is seen that from 261 -265 secs, a change in amplitude occurs which is generated due to turning or braking.For this set of data, from 261 -265 secs braking occurs and from 252 -257.03secs the cyclist is in a constant straight motion.Figure 2.7, indicates the application of FFT for two different sets of data which are from 261 -265 secs and 252 -257.03sec.

Table 1 .
Comparison of brake data in time domain and frequency domain Brake data in time domainBrake data in frequency domain

Table 2 .
Comparison of road bump data in time domain and frequency domainRoad bump data in time domainRoad bump data in frequency domain

Table 3 .
Comparison of constant cycling data in time domain and frequency domainConstant cycling data in time domainConstant cycling data in frequency domain

Table 4 .
Comparison of left turn cycling data in time domain and frequency domain Left turn cycling data in time domainLeft turn cycling data in frequency domain

Table 5 .
Comparison of constant cycling data in time domain and frequency domainRight turn cycling data in time domainRight cycling data in frequency domain