Electric bicycle intelligent speed regulation method based on MEMS sensor
Patent Information
- Application Number
- CN202611182973.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-05
- Publication Date
- 2026-09-25
AI Technical Summary
[0002]电动自行车已成为短途出行主流代步工具,骑行过程中车辆行驶速度控制直接决定骑行安全与驾乘体验,传统调速方案多依托转把电压信号完成电机功率调节,仅能依靠人工操作输入调速指令,无法结合车辆真实行驶路况实现自主适配调速,伴随微型传感技术持续发展,MEMS加速度计与陀螺仪逐步搭载于两轮代步车辆,可实时采集车身振动、倾斜、运动相关传感数据,通过数据解算获取车身俯仰姿态、路面颠簸程度、实时行驶速度等状态信息,为车辆智能化调速提供数据支撑,现阶段行业内普遍利用传感模组采集车身运动数据,借助滤波、积分、数据修复类算法处理原始传感信号,提取车辆行驶特征用于辅助整车控制,基于多维度运动传感数据的智能调速方案逐步成为电动自行车电控系统升级的核心研究方向,各类多传感器融合、路况自适应校正的数据处理架构持续迭代优化,用以适配复杂城市道路、乡村坑洼路面、上下坡道等多元化行驶场景
一、本发明通过同源时钟同步采集搭配前置硬件滤波与时序戳存储架构,实现加速度与角速度信号高精度同步采集,依托滑动时序截取与分段多项式拟合完成异常传感数据自主修复,同步输出路况颠簸分级标识,从信号源头削弱路面冲击、振动带来的数据失真问题,整套数据预处理链路可自适应区分平稳行驶与颠簸路面下的传感数据特征,无需人工标定阈值即可识别冲击异常帧,修复后传感数据一致性大幅提升,同时分级颠簸标识可向下游滤波、融合环节持续输出路况特征量,为后续状态解算提供分层路况依据,有效降低杂乱振动噪声对车身姿态、速度解算结果的持续干扰,保障不同路面工况下传感输入数据稳定可靠,减少原始信号畸变引发的调速控制偏差。
Smart Images

Figure CN122808874A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electric bicycle electronic control sensing technology, specifically to an intelligent speed control method for electric bicycles based on MEMS sensors. Background Technology
[0002] Electric bicycles have become a mainstream mode of transportation for short-distance travel. During riding, the vehicle's speed control directly determines riding safety and the riding experience. Traditional speed adjustment schemes mostly rely on the throttle voltage signal to adjust the motor power, which can only be done manually by inputting speed adjustment commands. They cannot achieve autonomous speed adjustment based on the actual road conditions. With the continuous development of micro-sensor technology, MEMS accelerometers and gyroscopes are gradually being installed in two-wheeled vehicles. They can collect real-time sensor data related to vehicle vibration, tilt, and motion. Through data calculation, they can obtain state information such as vehicle pitch attitude, road bumpiness, and real-time speed, providing data support for intelligent speed adjustment of the vehicle. At present, the industry generally uses sensor modules to collect vehicle motion data and uses filtering, integration, and data repair algorithms to process the raw sensor signals and extract vehicle driving characteristics to assist in vehicle control. Intelligent speed adjustment schemes based on multi-dimensional motion sensor data are gradually becoming the core research direction for upgrading electric bicycle electronic control systems. Various multi-sensor fusion and road condition adaptive correction data processing architectures are continuously iterated and optimized to adapt to diverse driving scenarios such as complex urban roads, rural potholed roads, and uphill and downhill slopes.
[0003] Existing MEMS-based speed control solutions for electric bicycles suffer from several unavoidable drawbacks. Most sensor acquisition architectures do not employ a unified synchronous clock to process two sensor signals, resulting in timing discrepancies in acceleration and angular velocity data acquisition. Clutter interference from the original analog signal is not uniformly filtered out before analog-to-digital conversion. The storage and data push mechanisms lack standardized timing markings, leading to data timing errors during subsequent feature extraction. Impact signals from road bumps easily generate a large amount of distorted and abnormal data. Conventional processing methods simply remove abnormal frames without data repair mechanisms; directly discarding data would destroy the integrity of the motion timing sequence. The system cannot quantify and distinguish road conditions with different degrees of bumpiness. The sensor elements have been working for a long time and have generated temperature drift zero bias error without a periodic automatic correction mechanism. The noise parameters of the filtering stage are fixed and cannot be dynamically adjusted according to road bumps and component temperature drift. When driving on slopes, it is difficult to completely separate the gravity component. The attitude fusion weights are fixed, and the speed calculation error continues to amplify under slope and bumpy conditions. At the same time, road condition characteristics cannot be used to influence the front-end data processing flow. Each algorithm module is independent and there is no closed-loop linkage. The speed integral calculation depends on additional motor hardware parameters, which increases the computing burden of the controller. Finally, the speed output has a poor match with the actual driving state. Summary of the Invention
[0004] The purpose of this invention is to overcome the shortcomings of existing technologies and provide an intelligent speed control method for electric bicycles based on MEMS sensors. This method involves building a sensing module integrating an accelerometer and a gyroscope, acquiring raw sensor data with time-series markers through synchronous acquisition and hardware filtering, identifying abnormal data caused by road impacts through time-series feature extraction and impact discrimination, and using polynomial fitting to complete data repair and classify bump levels. The method automatically solves for zero-bias compensation values when the vehicle is stationary, dynamically configures Kalman filter noise parameters based on a road condition and temperature drift coupling algorithm, corrects the acceleration signal, obtains the pitch angle through angular velocity integration, and uses a slope-noise dual-parameter adaptive fusion algorithm to remove the gravity component and obtain pure acceleration. The updated bump markers are then loop-wise transmitted back to the front-end processing module. Finally, the instantaneous speed and cumulative mileage are solved using piecewise trapezoidal integration, and motor adjustment commands are generated based on the speed difference to achieve intelligent speed control.
[0005] To solve the above-mentioned technical problems, this invention provides the following technical solution: an intelligent speed control method for electric bicycles based on MEMS sensors, the specific steps of which are as follows: S1. Arrange a sensing module integrating a three-axis piezoresistive MEMS accelerometer and a MEMS gyroscope. Acquire acceleration and angular velocity signals synchronously with the same clock source, a shared analog-to-digital converter (ADC), and a 10ms period. After hardware filtering and timestamp, output the raw acceleration and gyroscope data with timestamps to step S2. In S1, the hardware filtering execution stage only performs amplitude attenuation operation on the components of the analog electrical signal with a frequency greater than 50 Hz. The analog components with a frequency less than or equal to 50 Hz are completely preserved and do not participate in the amplitude attenuation processing. The timing number adopts the decimal continuous natural number encoding rule. The number value corresponding to the first group of acquired samples is set to 1. The number value of each subsequent group of newly acquired samples is increased by 1 based on the number value of the previous group. The circular storage area adopts the first-in-first-out data read and write rule. When the storage capacity reaches the upper limit, the first group of timing samples written is deleted, and the newly acquired samples are added to the end of the storage area. S2. Receive the data from step S1, slide to extract the time-frequency features of the acceleration timing sequence, identify abnormal frames through the multi-feature coupled impact discrimination algorithm; generate replacement values by piecewise polynomial fitting of the abnormal frames, obtain the repair acceleration, generate turbulence level markers according to the number of abnormal frames, and output the repair acceleration, gyroscope data and turbulence level to step S3. S3. Receive the data from step S2, monitor the acceleration to determine if the object is stationary, collect samples when stationary to calculate the zero bias compensation coefficient to compensate for the acceleration; based on the bump level and temperature drift, calculate the Kalman filter noise parameters using the road condition temperature drift coupled noise scaling algorithm, and perform Kalman filtering on the acceleration, outputting the calibration acceleration, noise parameters and gyroscope data to step S4. In S3, all triaxial temperature drift zero-bias compensation values are written to the on-chip non-volatile storage partition. After the electric bicycle is powered off and restarted, the triaxial mean calculation results in the storage partition remain unchanged. The Kalman filter iterative calculation is only performed on the X, Y, and Z triaxial acceleration digital samples after the triaxial compensation values are superimposed. The original digital samples of angular velocity output by the gyroscope are not included in the input data source of the Kalman filter iterative calculation. S4. Receive the data from step S3, integrate the angular velocity to obtain the pitch angle; run the slope-noise dual-parameter adaptive fusion algorithm, calculate the fusion coefficient based on the pitch angle and noise parameters, weight the fusion and remove the gravity component to obtain the pure acceleration, and output the pure acceleration, pitch angle and bump marker to step S5. S5. Receive the data from step S4, update the bump level mark and feed it back to steps S2 and S3; use a 10ms piecewise trapezoidal integral to integrate the pure acceleration, calculate the instantaneous speed and cumulative mileage, generate the speed adjustment control quantity based on the instantaneous speed value, and execute the electric bicycle speed adjustment. In S5, the execution interval of the turbulence level marker reverse push operation is synchronized with the 10ms acquisition cycle. After each round of integral calculation, the current turbulence level marker assignment is updated, and the updated marker data is generated into two independent transmission data streams. The first data stream is pushed to the time series feature extraction calculation entry of S2, and the second data stream is pushed to the temperature drift residual input interface of S3. After receiving the updated turbulence marker data, S2 replaces the original marker input value before the start of the next round of time series interception and feature extraction process. After receiving the updated turbulence marker data, S3 replaces the original marker input value before the start of the next round of noise scaling algorithm calculation.
[0006] Furthermore, in S1, under the same clock synchronization mechanism, the acquisition trigger commands for the accelerometer and gyroscope signals are issued synchronously, and the time difference between the acquisition of the two signals is limited to less than 1 microsecond; the cutoff frequency of the RC circuit corresponding to the hardware filtering operation is fixed at 50 Hz, and the hardware filtering is only performed in the pre-stage of the analog electrical signal input to the ADC conversion unit; all digital samples that have completed analog-to-digital conversion are uniformly written into the circular storage area, and the storage capacity of the circular storage area is configured to accommodate no less than 1000 sets of digital samples generated by the preset acquisition cycle; after each set of digital samples completes the conversion operation, an independent timing number is synchronously generated as a timestamp, and the timing number is continuously incremented according to the order of acquisition execution, and all digital samples carrying the timing number are pushed to S2 in sequence according to the writing timing.
[0007] Furthermore, in S2, the execution rules for the time-series interception operation are as follows: taking the current single-frame sample to be judged as the center position, reading 15 sets of stored historical samples forward and 15 sets of subsequent cached samples backward, and calling 31 sets of continuous time-series samples in a single judgment operation; the piecewise polynomial operation model selects only 20 sets of unlabeled samples before the abnormal frame position and 20 sets after the abnormal frame position as the fitting input data source, the polynomial order is fixed to the third order, and the time interval corresponding to the replacement value generated by the fitting strictly matches the 10ms acquisition cycle; a fixed duration unit of 1 second is used as the statistical interval, and the abnormal frame count value identified within the statistical interval is used as the basis for assigning the bump level label. The repaired complete acceleration dataset, the original angular velocity digital sample, and the assigned bump level label are synchronously packaged and transmitted to S3.
[0008] Furthermore, in S2, the three-segment assignment rules for the bump level marker are as follows: when the abnormal frame count value within a 1-second statistical interval is equal to 0, the bump marker is assigned a value of 0; when the abnormal frame count value within a 1-second statistical interval is greater than or equal to 1 and less than or equal to 5, the bump marker is assigned a value of 1; when the abnormal frame count value within a 1-second statistical interval is greater than or equal to 6, the bump marker is assigned a value of 2. These three fixed assignments are only used as road condition input variables and passed into the temperature drift coupled noise scaling algorithm calculation process in S3.
[0009] Furthermore, in S2, the multi-feature coupled impact discrimination algorithm includes a comprehensive impact index calculation formula and a judgment threshold calculation formula; the comprehensive impact index calculation formula is: The formula for calculating the determination threshold is: in, As a comprehensive impact index, The value assigned is a number corresponding to the bump level label, and this number can be 0, 1, or 2. This is the difference between the current frame's three-axis acceleration amplitude and the average acceleration amplitude of the preceding and following 15 frames. The abrupt change coefficient of the slope of the acceleration data change over three consecutive frames. This represents the abrupt change in the discrete variance of the triaxial acceleration. The threshold is dynamically determined; when the comprehensive impact index... Greater than the dynamic determination threshold When this happens, the current frame is determined to be an abnormal frame.
[0010] Furthermore, in S3, the numerical constraint range for determining stillness is that the absolute values of the X, Y, and Z axis acceleration digital samples are all less than 0.02g. When all 300 consecutive sets of preset acquisition period samples meet this numerical constraint, the zero-bias compensation numerical solution process is initiated. During the zero-bias compensation numerical solution stage, 300 sets of triaxial acceleration samples that meet the stillness determination condition are continuously acquired. The arithmetic mean is calculated independently for all samples on the X-axis, Y-axis, and Z-axis, and the results of the triaxial mean calculation are used as the triaxial-specific temperature drift zero-bias compensation values. When the electric bicycle is not stationary, after accumulating 10 sets of preset acquisition period samples, the triaxial temperature drift zero-bias compensation values are read and added or subtracted from the corresponding axis real-time acquired acceleration digital samples.
[0011] Furthermore, in S3, the mathematical expression for the road condition temperature drift coupled noise scaling algorithm is: in: The scaling factor for the Kalman process noise matrix is... Assign a numerical value to the bump level marker for S2. For triaxial acceleration temperature drift zero residual, This is the absolute value of the zero residual of temperature drift; and after the algorithm is executed, the scaling factor obtained from the solution is... Apply boundary saturation limiting constraints: if Then let ;like Then let After the amplitude limit The numerical values serve as the actual input parameters for the Kalman filter iterative operation.
[0012] Furthermore, in S4, the iteration period of the angular velocity integral operation is consistent with the 10ms unified acquisition period, and a single integration operation only uses the most recent set of angular velocity digital samples from the preset acquisition period as input; after the slope-noise dual-parameter adaptive fusion algorithm completes the weight value solution, it sets an interval constraint on the weight value, with the lower limit of the value fixed at 0.3 and the upper limit of the value fixed at 0.9. The solution values exceeding the interval are truncated according to the boundary values; the gravity component stripping operation is only performed on the X-axis acceleration time series samples. The value to be stripped is generated according to the calculation results of the fixed gravity constant and the pitch angle trigonometric function. The value subtraction operation is completed from the weighted X-axis acceleration samples. All processed time series samples are uniformly marked as a clean acceleration time series dataset and transmitted to S5.
[0013] Furthermore, in S4, the mathematical expression of the slope-noise dual-parameter adaptive fusion algorithm is: The weight calculation rules for gyroscopes are as follows: in: Weights for MEMS acceleration data fusion This is the absolute value of the vehicle body pitch angle. The scaling factor for the Kalman process noise matrix output by S3 and after saturation limiting. The weights for fusion of MEMS gyroscope tilt angle data are used; and before performing weighted fusion, the calculated values are... Apply numerical interval truncation constraints: if Then let ;like Then let After being cut off The numerical values are used in subsequent gravity component stripping calculations.
[0014] Furthermore, in S5, the segmented trapezoidal integration operation uses a single set of pure acceleration samples with a preset acquisition period as the smallest integration segment unit, and the integration operation is performed sequentially from early to late according to the time sequence. After each set of segmented integration operations is completed, the current segmented integration increment is added to the accumulated mileage value stored in the storage area and the original stored value is overwritten. After the instantaneous speed value and the updated accumulated mileage value are generated, a motor pulse width modulation duty cycle adjustment command is generated based on the difference between the instantaneous speed value and the target speed, and the electric bicycle speed is adjusted. The segmented trapezoidal integration operation does not retrieve the corresponding digital samples of motor torque, gear setting, and bus current throughout the entire process.
[0015] Compared with existing technologies, this intelligent speed control method for electric bicycles based on MEMS sensors has the following advantages: I. This invention achieves high-precision synchronous acquisition of acceleration and angular velocity signals through synchronous acquisition using a co-source clock, combined with pre-processed hardware filtering and a time-stamp storage architecture. It autonomously repairs abnormal sensor data by relying on sliding time-series interception and piecewise polynomial fitting, and synchronously outputs road condition bump classification indicators. This reduces data distortion caused by road impacts and vibrations at the signal source. The entire data preprocessing chain can adaptively distinguish sensor data characteristics under smooth driving and bumpy road conditions, identifying impact anomaly frames without manual threshold calibration. The consistency of the repaired sensor data is significantly improved. Simultaneously, the graded bump indicators continuously output road condition features to downstream filtering and fusion stages, providing a layered road condition basis for subsequent state calculations. This effectively reduces the continuous interference of chaotic vibration noise on the vehicle attitude and speed calculation results, ensuring stable and reliable sensor input data under different road conditions and reducing speed control deviations caused by original signal distortion.
[0016] II. This invention employs a zero-bias autonomous compensation mechanism for static states, a road condition temperature drift coupled with noise scaling, and a slope noise dual-parameter adaptive fusion linkage mechanism to correct calculation errors caused by three types of interference factors: temperature drift, bumps, and slopes. Combined with a closed-loop feedback link, it transmits real-time updated bump indicators back to the front-end data processing module, forming a full-process road condition adaptive adjustment logic. It uses piecewise trapezoidal integrals to convert acceleration into speed and mileage, directly generating motor speed control commands based on speed differences. The entire process does not rely on additional hardware parameters such as motor torque and bus current, simplifying the hardware acquisition link at the vehicle control end. Various adaptive algorithms dynamically adjust filter weights and noise parameters, balancing the accuracy of slope driving posture calculation with the anti-interference capability on bumpy roads. This allows the electric bicycle's speed control response to closely match real-world road conditions, improving riding smoothness while reducing the computational load on the vehicle controller, making it suitable for low-cost embedded sensing hardware deployment.
[0017] Other advantages, objectives and features of the invention will be set forth in part in the description which follows, and in part will be apparent to those skilled in the art from the following examination or study, or may be learned from the practice of the invention. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without any creative effort.
[0019] Figure 1 The main flowchart of the intelligent speed control method for electric bicycles based on MEMS sensors is shown below. Figure 2 A detailed flowchart for abnormal frame identification and repair and turbulence level generation in step S2 is provided. Figure 3 The flowchart for step S3, zero bias compensation and Kalman filter parameter solution, is shown in detail. Detailed Implementation
[0020] To further illustrate the technical means and effects of the present invention in achieving its intended purpose, the following detailed description of the specific implementation methods, structures, features, and effects of the present invention, in conjunction with the accompanying drawings and preferred embodiments, is provided below.
[0021] Reference Figure 1One embodiment of the present invention proposes an intelligent speed control method for electric bicycles based on MEMS sensors. It adopts a multi-level data processing mechanism that integrates a triaxial piezoresistive accelerometer and a micron-level vibration gyroscope for synchronous sensing and acquisition, repair of abnormal impact frames coupled with multi-feature coupling, adaptive adjustment of road condition temperature drift coupled with Kalman noise, fusion of slope noise and dual-participant speed tilt angle, and segmented trapezoidal integral speed measurement and control. It can achieve layered suppression of multiple interferences such as road bumps, zero temperature deviation, and vehicle pitch slope without adding external devices for road bump detection and vehicle tilt angle detection. It also outputs motor speed control commands adapted to road conditions in real time based on the actual acceleration of the vehicle body, realizing smooth and adaptive online intelligent speed control of electric bicycles.
[0022] The method described in this embodiment specifically includes: S1, arranging a sensing module integrating a triaxial piezoresistive MEMS accelerometer and a MEMS gyroscope, synchronously acquiring acceleration and angular velocity signals using a common clock, a shared analog-to-digital converter (ADC), and a 10ms period, and outputting raw acceleration and gyroscope data with timestamps after hardware filtering; S2, receiving the raw sensing data with timestamps output in step S1, extracting time-frequency features by sliding and intercepting the acceleration timing sequence, and identifying abnormal frames using a multi-feature coupled impulse discrimination algorithm; and processing the identified abnormal frames. Piecewise third-order polynomial fitting is used to generate replacement values to repair the original acceleration data. Bump level labels are generated based on the number of abnormal frames within a 1-second statistical interval. Repaired acceleration, original gyroscope data, and bump level labels are output simultaneously. In step S3, the output data from step S2 is received, and the vehicle's stationary state is determined based on triaxial acceleration numerical constraints. Sufficient samples are collected under stationary conditions to solve for the triaxial zero-bias compensation coefficient, and temperature drift zero-bias compensation is performed on the real-time acceleration. Combining the bump level label and the temperature drift zero residual, road condition temperature drift coupled noise scaling is calculated. The method calculates the Kalman filter noise scaling factor, performs Kalman filtering on the compensated three-axis acceleration, and outputs the calibrated acceleration, the noise scaling factor after amplitude limiting, and the raw gyroscope data; S4, receives the output data from step S3, integrates the angular velocity frame by frame for a 10ms period to solve for the vehicle pitch angle; runs the slope noise dual-parameter adaptive fusion algorithm, calculates the acceleration fusion weight by combining the absolute value of the pitch angle and the Kalman noise scaling factor and applies interval truncation constraints, and completes the weighted fusion of acceleration and pitch angle data with gyroscope weights, and separates the fused X-axis acceleration. Within a certain range, the gravity component is used to obtain pure acceleration time-series data without gravity interference, and the pure acceleration, pitch angle, and bump marker are output. In step S5, the output data of step S4 is received, the bump level marker is updated synchronously, and the data is pushed back to S2 and S3 as the input for the next round of calculation. The pure acceleration is integrated piecewise using a 10ms segmented trapezoidal integral, and the instantaneous speed and cumulative mileage are updated in real time. The difference between the instantaneous speed and the preset target speed is compared to generate the motor PWM duty cycle adjustment control quantity, which is sent to the drive unit to execute the speed adjustment of the electric bicycle.
[0023] Specifically, the execution logic of this invention's technical process lies in establishing a MEMS sensor signal processing link that features time synchronization, layered noise reduction, and multi-road-condition adaptive correction. This link first relies on a shared clock to synchronously acquire two analog signals: acceleration and angular velocity. The raw sensor data is standardized and preprocessed through hardware filtering at a fixed cutoff frequency, cyclic storage, and time-series numbering. Then, a sliding time window and multi-feature coupled impact discrimination are used to identify and repair abnormal bump and impact frames, simultaneously quantifying the degree of road bumps. Subsequently, layered compensation is applied to compensate for sensor zero-bias drift caused by temperature, and Kalman filter noise parameters are dynamically adjusted based on bumpy road conditions to eliminate internal acceleration temperature drift and random noise interference. Next, gyroscope tilt information is fused to correct the acceleration signal, stripping away the constant gravity component and extracting only the pure acceleration reflecting the rider's motion. Finally, the riding speed is calculated in real-time based on piecewise trapezoidal integrals, and the motor output power is dynamically adjusted according to the speed deviation. The entire speed control process relies on MEMS single-module sensor data, eliminating the need for external slope and bump detection sensors, thus balancing hardware cost and speed adjustment smoothness.
[0024] Optionally, the step S1 of arranging the sensing module and synchronously collecting raw sensing data includes: A triaxial piezoresistive MEMS accelerometer and MEMS gyroscope are integrated into the same PCB sensing module. The module is equipped with a unified clock module and a single-channel analog-to-digital converter (ADC) chip. Under the same clock synchronization mechanism, the acquisition trigger commands for the accelerometer and gyroscope signals are issued synchronously, and the time difference between the acquisition of the two signals is limited to less than 1 microsecond. Before the analog electrical signal enters the ADC conversion unit, it passes through an RC hardware filter circuit. The cutoff frequency of the hardware filter RC circuit is fixed at 50 Hz. The hardware filter only performs amplitude attenuation calculation on the components of the analog electrical signal with a frequency greater than 50 Hz. The analog components with a frequency less than or equal to 50 Hz are completely preserved and do not participate in the amplitude attenuation processing.
[0025] All digital samples that have completed analog-to-digital conversion are written to the on-chip circular storage area. The storage capacity of the circular storage area is configured to accommodate no less than 1000 sets of digital samples acquired at a 10ms cycle. The circular storage area adopts a first-in, first-out (FIFO) data read / write rule. When the storage capacity reaches the upper limit, the first set of timing samples written is deleted, and newly acquired samples are added to the end of the storage area. After each set of digital samples completes the ADC conversion operation, an independent timing number is generated synchronously as a timestamp. The timing number adopts a decimal consecutive natural number encoding rule. The number value corresponding to the first set of acquired samples is set to 1. The number value of each subsequent newly acquired sample is incremented by 1 based on the number value of the previous set. All digital samples carrying timing numbers are pushed to S2 sequentially according to the writing timing sequence.
[0026] For example, during the S1 sensing acquisition process, after the electric bicycle is powered on, the sensing module's synchronous clock starts, and it synchronously sends accelerometer and gyroscope acquisition trigger signals at a fixed period of 10ms. The time difference between the acquisition of the two signals in a single acquisition is stably maintained in the range of 0.3~0.7 microseconds, which meets the timing constraint of less than 1 microsecond. The wheel generates a 65Hz high-frequency vibration simulation signal when it passes over a gravel road surface. After being filtered by RC hardware at a 50Hz cutoff frequency, the amplitude of the 65Hz high-frequency component is attenuated by 80%. Riding at a constant speed generates a 30Hz low-frequency body vibration. The motion signal is completely preserved without attenuation; the cyclic storage area is configured with 1020 sets of sample storage space, which can store 1020 sets of 10ms periodic acquisition data. When the 1020th set of samples is written, the earliest sample numbered 1 is automatically deleted when the next new set of samples is written, and the new sample number is sequentially extended to 1021; a time sequence number is generated immediately after each set of sensor data is converted. The data of the first frame is numbered 1, the data of the 100th frame is numbered 100, and all numbered triaxial acceleration and triaxial angular velocity digital samples are packaged and pushed to the S2 time sequence feature extraction module.
[0027] Optionally, the S2 sliding truncation timing, multi-feature coupled impact discrimination, abnormal frame repair, and turbulence level marker generation include: The execution rules for the time-series extraction operation are as follows: Using the current single-frame sample to be judged as the center position, read 15 sets of stored historical samples forward and 15 sets of subsequent cached samples backward. A single judgment operation consistently calls 31 sets of continuous time-series samples. The multi-feature coupled impact discrimination algorithm is then called to calculate the comprehensive impact index and the dynamic judgment threshold. The algorithm has a built-in formula for calculating the comprehensive impact index. Calculation formula for the judgment threshold: in, As a comprehensive impact index, The value assigned is a number corresponding to the bump level label, and this number can be 0, 1, or 2. This is the difference between the current frame's three-axis acceleration amplitude and the average acceleration amplitude of the preceding and following 15 frames. The abrupt change coefficient of the slope of the acceleration data change over three consecutive frames. This represents the abrupt change in the discrete variance of the triaxial acceleration. The threshold is dynamically determined; when the comprehensive impact index Greater than the dynamic judgment threshold When this happens, the current frame is determined to be an abnormal frame.
[0028] in: This formula is used to calculate the difference between the triaxial acceleration amplitude of the current frame and the average acceleration amplitude of the preceding and following 15 frames. This represents the composite amplitude of the three-axis acceleration in the current frame. , , These are the acceleration values along the X, Y, and Z axes for the current frame. , , These represent the three-axis acceleration values corresponding to the position offset by i frames from the current frame. The average value of the composite acceleration amplitude represents the sum of 30 frames of samples, 15 frames before and 15 frames after. This formula is used to calculate the abrupt change coefficient of the slope of acceleration data changes over three consecutive frames. , , These are the composite acceleration amplitudes for three consecutive frames. The sampling period is fixed at 10ms. This formula is used to calculate the abrupt change in the discrete variance of triaxial acceleration, where... , , These are the average three-axis acceleration values corresponding to the 15 frames before and after the current frame.
[0029] For the identified abnormal frames, the piecewise polynomial operation model selects only 20 groups of unlabeled samples before and 20 groups after the abnormal frame position as the fitting input data source. The polynomial order is fixed at third order, and the time interval of the replacement value generated by fitting strictly matches the 10ms acquisition cycle. The fitted value is used to replace the original acceleration data of the abnormal frame to complete the acceleration dataset repair.
[0030] Using a fixed duration unit of 1 second as the statistical interval, the abnormal frame count value identified within the statistical interval is used as the basis for assigning the bump level label. The three-segment assignment rules for the bump level label are as follows: when the abnormal frame count value within the 1-second statistical interval is equal to 0, the bump label is assigned a value of 0; when the abnormal frame count value within the 1-second statistical interval is greater than or equal to 1 and less than or equal to 5, the bump label is assigned a value of 1; when the abnormal frame count value within the 1-second statistical interval is greater than or equal to 6, the bump label is assigned a value of 2. The three fixed assignments are only used as road condition input variables and are passed into the S3 temperature drift coupled noise scaling algorithm calculation process. The assigned values do not participate in other calculation branches. The repaired complete acceleration dataset, the original angular velocity digital samples, and the assigned bump level labels are synchronously packaged and transmitted to S3.
[0031] For example, when executing the S2 abnormal frame identification and repair process, the sample with time sequence number 120 is taken as the center frame, 15 sets of historical samples numbered 105-119 are retrieved forward, and 15 sets of cached samples numbered 121-135 are retrieved backward, for a total of 31 sets of continuous time sequence data participating in the calculation; at this time, the previous round output turbulence mark The current frame is calculated. , , Substituting into the comprehensive impact index formula: Dynamic threshold determination: This time The frame is determined to be a normal frame and no fitting repair is needed; when riding over a speed bump, a certain frame is calculated. For frames deemed abnormal, 40 normal acceleration samples (20 sets before and 20 sets after the frame) are selected and fitted using a third-order polynomial. The fitted values, matching a 10ms period, are then used to replace the original acceleration values for that frame. A total of 7 abnormal frames are identified within this 1-second interval, and turbulence markers are assigned. This will repair acceleration, triaxial angular velocity, Synchronously distributed to the S3 module, such as Figure 2 As shown.
[0032] Optionally, the S3 vehicle stationary determination, three-axis zero-bias compensation, road condition temperature drift coupled noise scaling, and Kalman filtering include: The numerical constraint range for determining static conditions is that the absolute values of the X, Y, and Z axis acceleration digital samples are all less than 0.02g. When all 300 consecutive sets of 10ms periodic samples meet this numerical constraint, the zero-bias compensation numerical solution process is initiated. During the zero-bias compensation numerical solution stage, 300 sets of triaxial acceleration samples that meet the static condition are continuously collected. The arithmetic mean is calculated independently for all samples on the X-axis, Y-axis, and Z-axis, and the results of the triaxial mean calculations are used as the triaxial-specific temperature drift zero-bias compensation values. All triaxial temperature drift zero-bias compensation values are written to the on-chip non-volatile storage partition. After the electric bicycle is powered off and then powered on again, the triaxial mean calculation results in the storage partition remain unchanged. When the electric bicycle is not stationary, after every 10 sets of 10ms periodic samples are collected, the triaxial temperature drift zero-bias compensation values are read and added or subtracted from the corresponding axis real-time collected acceleration digital samples to obtain the compensated acceleration data.
[0033] in: , , This set of formulas is used for triaxial acceleration temperature drift zero bias compensation calculation, where , , To collect raw triaxial acceleration values in real time, , , The mean value of triaxial temperature drift zero bias obtained from static calibration. , , To obtain the triaxial acceleration values after zero bias compensation; This formula is used to calculate the temperature drift zero residual of triaxial acceleration, where For triaxial acceleration temperature drift zero residual, , , This is the mean value of the three-axis temperature drift zero bias.
[0034] The compensated triaxial acceleration and bump level markings will be displayed. Triaxial acceleration temperature drift zero residual The input road condition temperature drift coupled noise scaling algorithm has the following mathematical expression: in: The scaling factor for the Kalman process noise matrix is... Assign a numerical value (0, 1, or 2) to the bump level indicator output by S2. This is the triaxial acceleration temperature drift zero residual, and its unit is gravitational acceleration. , This is the absolute value of the zero residual of temperature drift; and after the algorithm is executed, the scaling factor obtained from the solution is... Apply boundary saturation limiting constraints: if Then let ;like Then let After the amplitude limit The numerical values serve as the actual input parameters for the Kalman filter iterative calculation. The Kalman filter iterative calculation is performed only on the X, Y, and Z-axis acceleration digital samples after superimposing the triaxial compensation values; the raw angular velocity digital samples output by the gyroscope are not included in the input data source for the Kalman filter iterative calculation. After filtering, the output is the calibrated acceleration and the noise scaling factor after amplitude limiting. The raw gyroscope data is sent to S4.
[0035] For example, when executing the S3 zero-bias compensation and noise figure calculation process, the electric bicycle was parked and stationary, and 300 sets of samples were continuously collected. The absolute values of all three-axis accelerations were less than [a certain value]. Trigger zero-biased solution; collect 300 sets of static samples and calculate the three-axis mean, X-axis mean - Y-axis mean Z-axis mean Three sets of values are stored in the on-chip Flash non-volatile partition; the vehicle resumes riding, and every 10 sets of samples are collected, the real-time three-axis acceleration is subtracted from the mean of the corresponding axis zero bias to complete compensation; the current bump is marked. absolute value of zero residual during temperature drift Substitute into the scaling factor formula: The calculated result of 1.966 falls within the range of 1.0 to 5.0, requiring no amplitude limiting. This value can be directly used as the Kalman filter noise parameter. Kalman iterative noise reduction is performed only on the compensated triaxial acceleration; gyroscope angular velocity data is not included in the filtering calculation. The final output is the noise-reduced calibrated acceleration. , triaxial angular velocity to S4, such as Figure 3 As shown.
[0036] Optionally, the S4 angular velocity integral for pitch angle calculation, slope noise dual-parameter adaptive fusion, and gravity component stripping include: The iteration period for the angular velocity integral calculation is consistent with the 10ms unified acquisition period. Each integration calculation uses only the most recent set of 10ms periodic angular velocity digital samples as input, and the vehicle pitch angle is solved by integrating and iterating frame by frame. The unit is radians (rad). This formula is used to solve for the integral of the vehicle body pitch angle, where The pitch angle for the current frame. The pitch angle of the previous frame. The gyroscope outputs the pitch axis angular velocity for the current frame. The acquisition period is fixed at 10ms; the absolute value of the pitch angle is... S3 output after limiting The input slope-noise dual-parameter adaptive fusion algorithm is expressed as follows: The weight calculation rules for gyroscopes are as follows: ;in: Weights for MEMS acceleration data fusion This is the absolute value of the vehicle body pitch angle. The scaling factor for the Kalman process noise matrix output by S3 and after saturation limiting. The weights for fusion of MEMS gyroscope tilt angle data are used; and before performing weighted fusion, the calculated values are... Apply numerical interval truncation constraints: if Then let ;like Then let After being cut off The numerical values are used in subsequent gravity component stripping calculations.
[0037] in: This formula is used for weighted fusion calculation of X-axis acceleration, where The X-axis acceleration after fusion. Acceleration fusion weights The X-axis acceleration after Kalman filtering calibration. For gyroscope weight fusion, The X-axis acceleration reference component is obtained by converting the pitch angle of the gyroscope; This formula is used to obtain the pure X-axis acceleration by stripping away the X-axis gravity component, where... This represents the pure X-axis acceleration after removing gravity. The weighted and fused X-axis acceleration. This is the standard gravitational acceleration constant. This represents the absolute value of the vehicle's pitch angle. The gravity component stripping operation is performed only on the X-axis acceleration time series samples. The values to be stripped are generated based on the trigonometric function calculations using a fixed gravity constant and the pitch angle. The subtraction operation is then performed from the weighted X-axis acceleration samples. Y, The axial acceleration retains the original values after fusion. All processed time series samples are uniformly labeled as a clean acceleration time series dataset and transmitted to S5, with pitch angle and bump labels added simultaneously.
[0038] For example, during the S4 tilt fusion and gravity stripping process, the current vehicle pitch angle is calculated by integrating the angular velocity frame by frame with a 10ms period. , Previous output Substitute into the acceleration weight formula: The calculated value of 0.70029 falls within the range of 0.3 to 0.9, so no truncation is needed. (Gyroscope weights) Two sets of weights are used to weight and fuse the acceleration and gyroscope tilt data; based on the standard gravity constant. and Calculate the X-axis gravity component and subtract it from the merged X-axis acceleration to eliminate acceleration interference caused by ramp gravity. (Y-axis...) The axes are not stripped; the triaxial data is integrated to generate clean acceleration, along with pitch angle and bump markers. They were pushed to S5 together.
[0039] Optionally, the S5 bump mark reverse feedback, segmented trapezoidal integral speed measurement, and motor speed control include: The execution interval of the turbulence level marker reverse push operation is synchronized with the 10ms acquisition cycle. After each round of integration calculation, the current turbulence level marker assignment is updated, and the updated marker data is generated into two independent transmission data streams. The first data stream is pushed to the time series feature extraction calculation entry of S2, and the second data stream is pushed to the temperature drift residual input interface of S3. After receiving the updated turbulence marker data, S2 replaces the original marker input value before the start of the next round of time series interception and feature extraction process. After receiving the updated turbulence marker data, S3 replaces the original marker input value before the start of the next round of noise scaling algorithm calculation.
[0040] in: This formula is a piecewise trapezoidal integral formula for solving instantaneous velocity, where... The instantaneous velocity of the current frame. The instantaneous velocity of the previous frame. , These are the clean X-axis accelerations for the current frame and the previous frame, respectively. The data acquisition period is 10ms. This formula is used for cumulative mileage update calculation, where This represents the total cumulative mileage after the current update. The cumulative mileage stored in the previous frame is used, and the remaining parameters remain consistent with the instantaneous speed formula definition; This formula is used to generate the motor PWM duty cycle adjustment command, where This refers to the final output motor duty cycle. Based on the steady-state duty cycle, This is the speed closed-loop proportional control coefficient. Set a target riding speed for the entire vehicle. The instantaneous riding speed is calculated in real time.
[0041] The piecewise trapezoidal integration operation uses a single 10ms period pure acceleration sample as the smallest integration segment unit, and the integration operation is performed sequentially from earliest to latest according to the time sequence. After each segment integration operation is completed, the current segment integration increment is added to the cumulative mileage value stored in the storage area and the original stored value is overwritten. After the instantaneous speed value and the updated cumulative mileage value are generated, the motor pulse width modulation duty cycle adjustment control quantity is generated according to the difference between the instantaneous speed value and the preset target speed, and the speed of the electric bicycle is adjusted. The piecewise trapezoidal integration operation does not retrieve the corresponding digital samples of motor torque, gear setting, and bus current throughout the entire process, and only relies on the pure acceleration time sequence data to solve for speed and mileage.
[0042] For example, during the execution of the S5 feedback and speed regulation process, the current round of calculation bump markers are maintained. Two data streams are generated simultaneously, one of which is sent to the S2 impact detection module to replace the next round of calculations. The input is sent to the S3 noise scaling module to update road condition parameters. Using 10ms as the minimum integration unit, trapezoidal integration is performed frame by frame on the pure X-axis acceleration. The speed increment is obtained from each integration, and the instantaneous riding speed is obtained by superimposing the historical speed in the storage area. The integrated displacement increment is accumulated simultaneously, and the stored value of the cumulative mileage in the chip is refreshed. If the current instantaneous speed is 18km / h and the preset target speed of the whole vehicle is 15km / h, the speed difference is considered positive overspeed. The system reduces the motor PWM duty cycle and reduces the motor output torque to achieve deceleration. If the instantaneous speed is 12km / h, which is lower than the target speed, the duty cycle is increased to accelerate. The entire integration calculation process only calls the pure acceleration data and does not read the motor torque, gear, or bus current parameters, simplifying the controller's computational load.
[0043] Optionally, the method further includes: When the vehicle is powered off and restarted, it automatically reads the triaxial temperature drift zero bias compensation values stored in the on-chip non-volatile storage partition, without needing to collect 300 sets of samples again to solve the zero bias; during riding, it automatically triggers a stationary state detection every 5 minutes. If 300 consecutive sets of stationary samples are detected, it automatically updates the triaxial zero bias compensation average value and overwrites the old values in the storage partition, dynamically correcting the sensor drift error caused by long-term temperature changes.
[0044] Specifically, after prolonged outdoor riding of electric bicycles, the ambient temperature rises, causing the temperature drift of the MEMS accelerometer to slowly shift. The zero-bias value calibrated by a single power-on and static setting will gradually generate residuals. The system is equipped with a 5-minute timed detection mechanism, which activates the static judgment logic every 5 minutes. When the vehicle temporarily stops and waits, and 300 consecutive sets of samples meet the constraint that the absolute value of the triaxial acceleration is less than 0.02g, the system automatically collects 300 sets of static samples, recalculates the triaxial mean, and writes the new zero-bias compensation value into non-volatile storage, overwriting the initial power-on calibration value, and continuously corrects the measurement error caused by temperature drift. When the vehicle is driven on the road again, the updated compensation value is directly used to correct the acceleration signal, reducing the interference of long-term temperature drift on bump recognition and speed integral calculation.
[0045] For example, an electric bicycle is powered on in an environment of 20°C in the morning and left to calibrate its three-axis zero bias. After riding for 2 hours, the outdoor temperature rises to 38°C, triggering a 5-minute timer. The bicycle stops at an intersection and waits for 10 seconds, continuously collecting 300 sets of static samples. The mean zero bias values of the X, Y, and Z axes are recalculated, and a temperature drift residual of 0.003g is generated compared with the initial calibration values. The new mean value is automatically stored in the Flash partition. After the bicycle starts moving, the S3 module reads the updated zero bias value to correct the acceleration and the temperature drift residual. Significantly reduced, the scaling factor of road condition temperature drift coupling noise is simultaneously lowered, the Kalman filter noise parameters are adapted to low drift sensor data, and the speed integral calculation error is reduced.
[0046] Optionally, before S1 synchronously acquires the raw sensing data, the method further includes: The sensor module undergoes a power-on initialization self-test process, sequentially verifying the triaxial accelerometer, gyroscope communication bus, analog-to-digital converter (ADC) conversion channel, synchronous clock timing accuracy, and cyclic storage read / write function. If the self-test detects any fault such as a clock synchronization time difference greater than 1 microsecond, ADC channel data overflow, or storage read / write error, the controller reports a sensor module fault, stops the data acquisition process, and locks the motor speed control output, prohibiting electric bicycle riding. After all hardware modules have passed the self-test without any abnormalities, the 10ms cycle synchronous data acquisition process is initiated.
[0047] Specifically, after the electric bicycle is powered on, the main control chip first sends a self-test command to the MEMS sensing module. The first step is to verify the connectivity of the I2C / SPI communication bus and confirm that the accelerometer and gyroscope data can be read normally. The second step is to continuously collect 10 sets of synchronous sampling data, calculate the time difference between the acquisition of the two sensing signals, and determine whether it is less than 1 microsecond. The third step is to input a full-scale analog test signal to verify that the ADC conversion value has no overflow or jump. The fourth step is to write 1000 sets of test samples to the circular storage area, and then read the verification data integrity in sequence to verify that the first-in-first-out read-write logic is normal. If there are no errors in all verification items, the 10ms periodic synchronous acquisition is officially started. If any self-test fails, the main control locks the motor drive, the instrument pops up a sensor fault prompt, and cannot output speed control commands.
[0048] For example, when the vehicle is powered on and starts its self-test, the first three items—bus, ADC, and time difference verification—are all qualified. However, when reading the test sample from the cyclic storage, a data loss error occurs, and the system determines that the sensor module's storage unit is faulty. It directly locks the motor output, and the instrument displays an abnormal MEMS sensor, prohibiting riding. After repairing and replacing the sensor module, the vehicle is powered on again, and all four self-tests pass. The module starts synchronous data acquisition at a 10ms cycle, and the entire intelligent speed control process runs normally.
[0049] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any simple modifications, equivalent changes and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.
Claims
1. A method for intelligent speed control of electric bicycles based on MEMS sensors, characterized in that, The specific steps of this method are as follows: S1. Arrange a sensing module integrating a three-axis piezoresistive MEMS accelerometer and a MEMS gyroscope. Synchronously acquire acceleration and angular velocity signals using the same clock source, a shared analog-to-digital converter (ADC), and a preset acquisition period. After hardware filtering and timestamp, output the raw acceleration and gyroscope data with timestamps to step S2. S2. Receive the data from step S1, extract time-frequency features by sliding and intercepting acceleration timing, and identify abnormal frames through a multi-feature coupled impact discrimination algorithm. Piecewise polynomial fitting is performed on the abnormal frames to generate replacement values, the repair acceleration is obtained, and a turbulence level label is generated based on the number of abnormal frames. The repair acceleration, gyroscope data and turbulence level are output to step S3. S3. Receive the data from step S2, monitor the acceleration to determine if the object is stationary, collect samples when stationary to calculate the zero bias compensation coefficient to compensate for the acceleration; based on the bump level and temperature drift, calculate the Kalman filter noise parameters using the road condition temperature drift coupled noise scaling algorithm, and perform Kalman filtering on the acceleration, outputting the calibration acceleration, noise parameters and gyroscope data to step S4. S4. Receive the data from step S3 and integrate the angular velocity to calculate the pitch angle. Run the slope-noise dual-parameter adaptive fusion algorithm, calculate the fusion coefficient based on the pitch angle and noise parameters, weight the fusion and remove the gravity component to obtain the pure acceleration, and output the pure acceleration, pitch angle and bump marker to step S5; S5. Receive the data from step S4, update the bump level marker and feed it back to steps S2 and S3; use a 10ms piecewise trapezoidal integral to integrate the pure acceleration, calculate the instantaneous speed and cumulative mileage, generate the speed adjustment control quantity based on the instantaneous speed value, and execute the speed adjustment of the electric bicycle.
2. The intelligent speed control method for electric bicycles based on MEMS sensors according to claim 1, characterized in that, In S1, under the same clock synchronization mechanism, the acquisition trigger commands for the accelerometer and gyroscope signals are issued synchronously, and the time difference between the acquisition of the two signals is limited to less than 1 microsecond; the cutoff frequency of the RC circuit corresponding to the hardware filtering operation is fixed at 50 Hz, and the hardware filtering is only performed in the pre-stage of the analog electrical signal input to the ADC conversion unit; all digital samples that have completed analog-to-digital conversion are uniformly written into the circular storage area, and the storage capacity of the circular storage area is configured to accommodate no less than 1000 sets of digital samples generated by the preset acquisition cycle. After each set of digital samples completes the conversion operation, an independent time sequence number is generated synchronously as a timestamp. The time sequence number is continuously incremented according to the order of collection and execution. All digital samples carrying the time sequence number are pushed to S2 in sequence according to the writing time sequence to complete the data push.
3. The intelligent speed control method for electric bicycles based on MEMS sensors according to claim 1, characterized in that, In S2, the execution rules for the time-series interception operation are as follows: taking the current single-frame sample to be judged as the center position, reading 15 sets of stored historical samples forward and 15 sets of subsequent cached samples backward, and calling 31 sets of continuous time-series samples in a single judgment operation; the piecewise polynomial operation model selects only 20 sets of unlabeled samples before the abnormal frame position and 20 sets of unlabeled samples after the abnormal frame position as the fitting input data source, the polynomial order is fixed to the third order, and the time interval corresponding to the replacement value generated by fitting strictly matches the 10ms acquisition cycle; a fixed duration unit of 1 second is used as the statistical interval, and the abnormal frame count value identified within the statistical interval is used as the basis for assigning the bump level label. The repaired complete acceleration dataset, the original angular velocity digital sample, and the assigned bump level label are synchronously packaged and transmitted to S3.
4. The intelligent speed control method for electric bicycles based on MEMS sensors according to claim 1, characterized in that, In S2, the three-segment assignment rules for the turbulence level marker are as follows: when the abnormal frame count value within a 1-second statistical interval is equal to 0, the turbulence marker is assigned a value of 0; when the abnormal frame count value within a 1-second statistical interval is greater than or equal to 1 and less than or equal to 5, the turbulence marker is assigned a value of 1; when the abnormal frame count value within a 1-second statistical interval is greater than or equal to 6, the turbulence marker is assigned a value of 2. The calculation process of the temperature drift coupled noise scaling algorithm for S3 is based on three fixed assignments that are only used as road condition input variables.
5. The intelligent speed control method for electric bicycles based on MEMS sensors according to claim 1, characterized in that, In S2, the multi-feature coupled impact discrimination algorithm includes a comprehensive impact index calculation formula and a judgment threshold calculation formula; the comprehensive impact index calculation formula is: The formula for calculating the determination threshold is: in, As a comprehensive impact index, The value assigned is a number corresponding to the bump level label, and this number can be 0, 1, or 2. This is the difference between the current frame's three-axis acceleration amplitude and the average acceleration amplitude of the preceding and following 15 frames. The abrupt change coefficient of the slope of the acceleration data change over three consecutive frames. This represents the abrupt change in the discrete variance of the triaxial acceleration. The threshold is dynamically determined; when the comprehensive impact index Greater than the dynamic determination threshold When this happens, the current frame is determined to be an abnormal frame.
6. The intelligent speed control method for electric bicycles based on MEMS sensors according to claim 1, characterized in that, In S3, the numerical constraint range for static determination is that the absolute values of the digital samples of acceleration in the X, Y, and Z axes are all less than 0.02g. When all 300 sets of samples from the preset acquisition period meet this numerical constraint, the zero bias compensation numerical solution process is started. During the zero-bias compensation numerical solution stage, 300 sets of triaxial acceleration samples that meet the static judgment conditions are continuously collected. The arithmetic mean is calculated independently for all samples of the X-axis, Y-axis, and Z-axis. The results of the triaxial mean calculation are used as the triaxial exclusive temperature drift zero-bias compensation values. When the electric bicycle is not stationary, after collecting 10 sets of samples for a preset collection period, the triaxial temperature drift zero-bias compensation values are read and added or subtracted from the corresponding axis real-time collected acceleration digital samples.
7. The intelligent speed control method for electric bicycles based on MEMS sensors according to claim 1, characterized in that, In S3, the mathematical expression for the road condition temperature drift coupled noise scaling algorithm is: in: The scaling factor for the Kalman process noise matrix is... Assign a numerical value to the bump level marker for S2. For triaxial acceleration temperature drift zero residual, This is the absolute value of the zero residual of temperature drift; and after the algorithm is executed, the scaling factor obtained from the solution is... Apply boundary saturation limiting constraints: if Then let ;like Then let After the limit The numerical values serve as the actual input parameters for the Kalman filter iterative operation.
8. The intelligent speed control method for electric bicycles based on MEMS sensors according to claim 1, characterized in that, In S4, the iteration period of the angular velocity integral operation is consistent with the 10ms unified acquisition period. Each integration operation only uses the most recent set of angular velocity digital samples from the preset acquisition period as input. After the slope-noise dual-parameter adaptive fusion algorithm completes the weight value solution, it sets an interval constraint on the weight value. The lower limit of the value is fixed at 0.3, and the upper limit of the value is fixed at 0.
9. The solution value exceeding the interval is truncated according to the boundary value. The gravity component stripping operation is performed only on the X-axis acceleration time series samples. The values to be stripped are generated according to the calculation results of the fixed gravity constant and pitch angle trigonometric function. The numerical subtraction operation is performed from the weighted X-axis acceleration samples. All processed time series samples are uniformly marked as pure acceleration time series datasets and transmitted to S5.
9. The intelligent speed control method for electric bicycles based on MEMS sensors according to claim 1, characterized in that, In S4, the mathematical expression of the slope-noise dual-parameter adaptive fusion algorithm is: The weight calculation rules for gyroscopes are as follows: in: Weights for MEMS acceleration data fusion This is the absolute value of the vehicle body pitch angle. The scaling factor for the Kalman process noise matrix output by S3 and after saturation limiting. The weights for fusion of MEMS gyroscope tilt angle data are used; and before performing weighted fusion, the calculated values are... Apply numerical interval truncation constraints: if Then let ;like Then let After being cut off The numerical values are used in subsequent gravity component stripping calculations.
10. The intelligent speed control method for electric bicycles based on MEMS sensors according to claim 1, characterized in that, In step S5, the segmented trapezoidal integration operation uses a single set of pure acceleration samples with a preset acquisition period as the smallest integration segment unit. The integration operation is performed sequentially from early to late according to the time sequence. After each segmented integration operation is completed, the current segmented integration increment is added to the accumulated mileage value stored in the storage area and the original stored value is overwritten. After the instantaneous speed value and the updated accumulated mileage value are generated, a motor pulse width modulation duty cycle adjustment command is generated based on the difference between the instantaneous speed value and the target speed to adjust the speed of the electric bicycle. The piecewise trapezoidal integral operation does not retrieve the corresponding digital samples of motor torque, gear setting, and bus current throughout the entire process.