Adaptive treatment control method and system for a wearable insomnia treatment device

CN122805944APending Publication Date: 2026-09-25XIAN NEW HOPE MEDICAL EQUIP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611034823.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-13
Publication Date
2026-09-25

AI Technical Summary

Technical Problem

然而,在实际应用中存在一个难以克服的技术瓶颈:设备在持续输出较高强度治疗脉冲的过程中,无法在不中断当前治疗通路的前提下,直接复用原有的理疗电极片精准捕捉并连续追踪用户前额肌群张力在入睡过渡期发生的微弱动态变化

Benefits of technology

[0051]本申请通过在低频脉冲间隙设定采样窗口并分时切换通路,实现复用理疗电极片采集前额生物电信号。此举有效避免了强电刺激对微弱信号的干扰,无需额外增加传感器,既简化了设备硬件结构,又大幅提升了信号采集纯净度。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122805944A_ABST
    Figure CN122805944A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of medical devices, and particularly discloses a self-adaptive treatment control method and system of a wearable insomnia treatment device, which comprises the following steps: setting a sampling window in the middle section of the interval of adjacent pulses of a low-frequency pulse treatment waveform, collecting a forehead bioelectric signal by multiplexing a physiotherapy electrode sheet; filtering, rectifying and smoothing the collected signal to obtain an electromyographic envelope sequence, and resampling and constructing a trend sequence; extracting an amplitude change rate by segment fitting the trend sequence, and generating a sleep tendency confirmation mark when the rate of a plurality of continuous segments is negative and lower than a stable threshold; then, the system automatically decreases the pulse output amplitude by one cycle to the lowest maintenance level, records the sleep latency by a terminal program, and dynamically corrects the initial mode and time length parameters of subsequent treatment. The application can accurately identify a sleep state and automatically adjust the stimulation intensity, thereby improving treatment comfort and personalized intervention effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of medical device technology, specifically to an adaptive treatment control method and system for a wearable insomnia treatment device. Background Technology

[0002] Wearable insomnia treatment devices typically use low-frequency electrical pulses to modulate the nerves of the user's forehead and other areas. However, in practical applications, there is a difficult technical bottleneck to overcome: while continuously outputting high-intensity treatment pulses, the device cannot directly reuse the original therapeutic electrode pads to accurately capture and continuously track the subtle dynamic changes in the tension of the user's forehead muscles during the sleep transition period without interrupting the current treatment pathway.

[0003] Because existing devices cannot effectively extract continuous electromyographic envelope trends and identify subtle amplitude decrease rates under dense pulse output conditions, they struggle to accurately determine the critical state of a user's transition from wakefulness to sleep. This directly leads to a highly detrimental clinical application flaw: the device cannot adaptively and smoothly reduce pulse amplitude at the moment the user shows signs of falling asleep. This can easily result in the awkward situation where a high-intensity therapeutic pulse intended to aid sleep instantly transforms into a wake-up stimulus just as the user begins to fall asleep. Furthermore, due to the lack of precise sleep confirmation, the device cannot obtain the user's actual sleep latency for a single treatment session. Consequently, it cannot dynamically and personally adjust the initial treatment mode and total duration parameters based on the user's individual daily fluctuations in sleep difficulty, leading to rigid long-term treatment plans, low intervention efficiency, and significantly reduced user compliance.

[0004] In view of this, this application proposes an adaptive treatment control method and system for wearable insomnia treatment devices. Summary of the Invention

[0005] To achieve the above objectives, this application provides an adaptive treatment control method and system for a wearable insomnia treatment device, the specific technical solution of which is as follows:

[0006] In a first aspect, this application provides an adaptive treatment control method for a wearable insomnia treatment device, comprising:

[0007] A sampling window is set in the middle of the gap between adjacent pulses in the low-frequency pulse therapy waveform of the wearable insomnia treatment device. During the sampling window, the pulse output path is disconnected and the differential amplification path is connected, and the bioelectric signal of the forehead area is collected through the physiotherapy electrode pad.

[0008] The bioelectric signals collected in multiple sampling windows were subjected to bandpass filtering, rectification and lowpass smoothing to obtain the frontal electromyography envelope sequence, and the electromyography envelope sequence was resampled to construct a trend sequence.

[0009] The trend sequence is segmented and fitted to extract the rate of change of amplitude in each time period. When the rate of change of amplitude in a consecutive preset number of time periods is negative and the rate amplitude is lower than the preset stability threshold, a sleep trend confirmation mark is generated.

[0010] In response to the sleep trend confirmation flag, the pulse output amplitude is reduced to the preset minimum maintenance level in a cycle-by-cycle manner, and a state transition flag containing the sleep confirmation time is sent to the terminal program;

[0011] After the terminal program receives the state transition flag, it records the effective duration and sleep latency of this treatment, and dynamically adjusts the initial mode and total runtime parameters of the user's subsequent treatments based on the sleep latency.

[0012] Preferably, the wearable insomnia treatment device includes a microcontroller unit, an analog switch, and an analog-to-digital converter built into the microcontroller unit;

[0013] The collection of bioelectric signals from the forehead region includes: the starting time of the sampling window is set after a pre-silent delay following the end of the pulse trailing edge, and the length of the pre-silent delay is determined based on the time constant of the electrode-skin interface impedance;

[0014] The sampling window ends at a time that is set before the next pulse leading edge arrives, with a reserved post-protection interval. The length of the post-protection interval is not less than the sum of the conduction delay time of the analog switch and the interrupt response time of the microcontroller unit.

[0015] During the sampling window, the microcontroller sends a path switching control signal to the analog switch, and the analog-to-digital converter continuously acquires multiple sampling points at a fixed sampling rate within the sampling window.

[0016] When the sampling window ends, the microcontroller sends a reset control signal to the analog switch, disconnecting the differential amplification path and reconnecting the pulse output path.

[0017] Preferably, the bandpass filtering, rectification and lowpass smoothing of the bioelectric signals collected in multiple sampling windows includes: splicing the sampling points obtained in multiple consecutive sampling windows in chronological order, performing linear interpolation filling operation on the data blank segments between adjacent sampling windows, and generating filling sampling points by using the sampling values ​​at the edges of two adjacent sampling windows as interpolation endpoints, so that the filled signal sequence is arranged at equal intervals on the time axis.

[0018] A digital bandpass filter is applied to the filled signal sequence. The lower cutoff frequency of the bandpass filter is set according to the energy distribution characteristics of the electromyographic signal on the surface of the frontal muscle group, and the upper cutoff frequency is used to suppress high-frequency noise. The bandpass filter is implemented in a two-stage cascaded form using a fourth-order Butterworth structure.

[0019] Preferably, the bandpass filtering, rectification and lowpass smoothing of the bioelectric signals collected in multiple sampling windows further includes: performing full-wave rectification on the bandpass filtered signal sequence to convert all negative sampling points to positive values ​​by taking the absolute value;

[0020] A low-pass smoothing filter is applied to the signal sequence after full-wave rectification. The cutoff frequency of the low-pass smoothing filter is set according to the characteristic time scale of the decrease in muscle tone of the frontal muscle during the sleep transition period. The low-pass smoothing filter is implemented using a second-order Butterworth structure.

[0021] An electromyographic envelope sequence is constructed by taking the arithmetic mean of the electromyographic envelope signal output from the low-pass smoothing filter at a fixed extraction interval as the representative value.

[0022] Preferably, the microcontroller unit includes a random access memory; the step of resampling the electromyographic envelope sequence to construct a trend sequence includes:

[0023] Each data point in the electromyographic envelope sequence is assigned a relative timestamp with the treatment initiation time as zero at the time of generation;

[0024] The microcontroller resamples and aligns the electromyographic envelope sequence with a fixed step size, and eliminates the deviation between the actual generation time and the theoretical timestamp by linear interpolation between adjacent data points;

[0025] The data points in the trend sequence obtained after resampling are arranged at equal intervals and stored in the random access memory in the form of an array, with new data points continuously added as the treatment process progresses.

[0026] Preferably, the step of segmenting and fitting the trend sequence to extract the rate of change of amplitude in each time period includes: setting the operation unit of segmented fitting as a time period, each time period containing a fixed number of data points arranged continuously in the trend sequence, and the length of the time period being determined according to the typical rhythmic characteristics of the process of prefrontal muscle tone decrease during the sleep transition period.

[0027] For each time period, perform a first-order least squares linear fit on the data points, and solve for the coefficients of a linear function with time as the independent variable and electromyographic envelope amplitude as the dependent variable. The slope of the linear function is the rate of change of amplitude in the current time period.

[0028] The segmented fitting uses a sliding step method, with the step length being less than the time period length, so that there is data overlap between adjacent time periods.

[0029] Preferably, the determination of the preset stability threshold includes: the microcontroller collects the initial segment of the trend sequence within a preset initial time period after the treatment is started, and calculates the average amplitude value of the initial segment as the baseline reference amplitude;

[0030] The preset stability threshold is set as the ratio of the baseline reference amplitude to the preset decay time parameter, which characterizes the time-scale features of the muscle tone decay process during the sleep transition period.

[0031] The baseline reference amplitude is updated with the actual acquisition results at the start of each treatment, and the preset stability threshold is recalculated based on the updated baseline reference amplitude.

[0032] Preferably, the generation of the sleep trend confirmation flag includes: a first constraint and a second constraint; the first constraint for determining the sleep trend is that the amplitude change rate of each consecutive preset number of time periods is negative, and the second constraint is that the amplitude change rate of each time period in the consecutive preset number of time periods is lower than a preset stability threshold.

[0033] When both the first and second constraints are met, the microcontroller generates a sleep trend confirmation flag. Once generated, the sleep trend confirmation flag is locked and will not be reset during the current treatment cycle.

[0034] The microcontroller generates a sleep trend confirmation flag and records the current time's timestamp as the sleep confirmation time.

[0035] Preferably, reducing the pulse output amplitude to a preset minimum maintenance level in a cycle-by-cycle manner includes: the microcontroller reducing the target output voltage of the boost circuit by a single fixed decreasing step in each pulse cycle;

[0036] The decreasing step size is determined based on the current peak output voltage at the time the sleep trend confirmation flag is generated, the peak output voltage corresponding to the preset minimum maintenance level, the pulse repetition frequency in the current treatment mode, and the expected decreasing duration.

[0037] The preset minimum maintenance level is set to a preset percentage of the maximum output amplitude in the current treatment mode;

[0038] Once the output voltage decreases to the preset minimum maintenance level, the decrease stops and the output voltage is locked until the treatment run time ends.

[0039] Preferably, sending a state transition flag containing the sleep confirmation time to the terminal program includes: the state transition flag is a data packet, the payload of which includes a timestamp of the sleep confirmation time, a treatment mode identifier, an output amplitude level value, and a state transition type code, and the state transition flag is sent to the terminal program;

[0040] After receiving the data packet, the terminal program sends back an acknowledgment response. Before receiving the acknowledgment response, the microcontroller retransmits the data packet at fixed intervals. If no acknowledgment response is received after reaching the maximum number of retransmissions, the data packet is temporarily stored in a buffer and retransmitted after the connection is restored.

[0041] Preferably, the step of dynamically correcting the initial mode and total runtime parameters of the user's subsequent treatment based on the sleep latency includes: the terminal program dividing the sleep latency into short latency intervals, medium latency intervals and long latency intervals, and determining the recommended value of the initial mode based on the interval distribution of the effective sleep latency of the most recent preset number of sessions in the treatment history data set;

[0042] The terminal program calculates the corrected total runtime based on the effective sleep latency, minimum effective maintenance duration, and descent buffer margin, and applies upper and lower limits to the corrected total runtime.

[0043] The terminal program sends the revised total runtime and the recommended initial mode value to the microcontroller unit for execution.

[0044] Secondly, this application provides an adaptive treatment control system for a wearable insomnia treatment device, which is based on the aforementioned adaptive treatment control method for a wearable insomnia treatment device, including: an intermittent sampling module, an electromyographic envelope extraction module, a sleep onset trend determination module, an amplitude gradual reduction control module, and a parameter dynamic correction module.

[0045] The gap sampling module is used to set a sampling window in the middle of the gap between adjacent pulses of the low-frequency pulse therapy waveform, disconnect the pulse output path and connect the differential amplification path during the sampling window, and collect the bioelectric signal of the forehead area through the physiotherapy electrode pad.

[0046] The electromyography envelope extraction module is used to perform bandpass filtering, rectification and lowpass smoothing on the bioelectric signals collected in multiple sampling windows to obtain the frontal electromyography envelope sequence, and to resample the electromyography envelope sequence to construct a trend sequence.

[0047] The sleep trend determination module is used to perform segmented fitting on the trend sequence to extract the amplitude change rate of each time period. When the amplitude change rate of a consecutive preset number of time periods is negative and the rate amplitude is lower than the preset stable threshold, a sleep trend confirmation flag is generated.

[0048] The amplitude reduction control module is used to respond to the sleep trend confirmation flag, reduce the pulse output amplitude to a preset minimum maintenance level in a cycle-by-cycle manner, and send a state transition flag containing the sleep confirmation time to the terminal program.

[0049] The parameter dynamic correction module is used to record the effective duration and sleep latency of the current treatment after the terminal program receives the state transition flag, and to dynamically correct the initial mode and total runtime parameters of the user's subsequent treatments based on the sleep latency.

[0050] The beneficial effects of this application are:

[0051] This application achieves the acquisition of forehead bioelectrical signals using multiplexed therapeutic electrode pads by setting a sampling window during low-frequency pulse intervals and switching the path in a time-division manner. This effectively avoids interference from strong electrical stimulation on weak signals, eliminates the need for additional sensors, simplifies the device hardware structure, and significantly improves the purity of signal acquisition.

[0052] This application filters, rectifies, and smooths discrete bioelectrical signals to accurately remove environmental noise and successfully extracts the electromyographic envelope reflecting the true changes in frontal muscle tone. Resampling eliminates temporal bias and constructs a standardized trend sequence with equal intervals, providing high-quality data support for subsequent state determination.

[0053] This application extracts the rate of change of amplitude through piecewise fitting and combines continuous negative values ​​and a stable threshold for judgment to accurately capture the characteristics of decreased muscle tone during the sleep transition period. This mechanism effectively eliminates artifact interference caused by brief relaxation, greatly reduces the false positive rate, and ensures the rigor and accuracy of sleep confirmation.

[0054] After confirming sleep, this application smoothly reduces the pulse amplitude to a minimum maintenance level in a cycle-by-cycle manner, avoiding waking the user who has just fallen asleep due to continuous strong stimulation. This not only ensures sleep continuity but also reduces power consumption; at the same time, it sends state transition markers, providing precise time anchors for subsequent treatment efficacy assessments.

[0055] This application utilizes recorded actual sleep latency to dynamically adjust the initial pattern and total duration of subsequent treatment. This closed-loop feedback mechanism overcomes the drawbacks of rigid parameters, enabling treatment plans to adapt to the user's daily fluctuating insomnia levels, achieving personalized intervention, and improving long-term treatment efficiency and adherence.

[0056] The technical solution of this application resolves the conflict between strong stimulation output and weak signal in-situ acquisition, solves the problem that traditional devices cause sleep aids to turn into awakenings due to continuous strong stimulation, and ensures a seamless sleep experience; at the same time, it evolves a unique treatment strategy through long-term adaptive learning, which greatly improves patient comfort. Attached Figure Description

[0057] Figure 1 A flowchart of an adaptive treatment control method for a wearable insomnia treatment device provided in this application;

[0058] Figure 2 This is a timing diagram of the pulse gap time division multiplexing in this application;

[0059] Figure 3 This is a schematic diagram of the time-division switching circuit of this application.

[0060] Figure 4 This is a flowchart of the signal processing link in this application;

[0061] Figure 5 This is a schematic diagram of the step-by-step transformation of the signal waveform in this application;

[0062] Figure 6 This is a schematic diagram illustrating the logic for determining sleep trends in this application;

[0063] Figure 7 This is a schematic diagram illustrating the cycle-by-cycle decrease of the pulse output amplitude in this application;

[0064] Figure 8 This application provides a structural diagram of an adaptive treatment control system for a wearable insomnia treatment device. Detailed Implementation

[0065] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the specific embodiments of this application will be described in detail below with reference to the accompanying drawings.

[0066] Many specific details are set forth in the following description in order to provide a full understanding of this application. However, this application may also be implemented in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this application. Therefore, this application is not limited to the specific embodiments disclosed below.

[0067] Secondly, the term "an embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of this application. The phrase "in one embodiment" appearing in different places in this specification does not necessarily refer to the same embodiment, nor is it a single embodiment or an embodiment selectively excluded from other embodiments.

[0068] Example 1

[0069] Reference Figures 1 to 7 This is the first embodiment of the present application, such as Figure 1 As shown, an adaptive treatment control method for a wearable insomnia treatment device is provided.

[0070] This embodiment provides an adaptive treatment control method for a wearable insomnia treatment device. The wearable insomnia treatment device is a low-frequency pulse insomnia treatment instrument. The low-frequency pulse insomnia treatment instrument employs transcutaneous electrical nerve stimulation (TENS) therapy. A microcontroller unit controls a boost circuit to generate a treatment waveform, which is then applied to the skin surface via therapeutic electrodes attached to the forehead. The main unit of the low-frequency pulse insomnia treatment instrument integrates a pulse output path and a differential amplification path. These two paths share the therapeutic electrodes as the electrical interface with the skin, and time-division multiplexing switching of the paths is achieved through an analog switch. The low-frequency pulse insomnia treatment instrument is also equipped with a Bluetooth communication module for establishing a bidirectional data link with a program running on a mobile terminal. The adaptive treatment control method includes the following steps S1 to S5.

[0071] Step S1: Set a sampling window in the middle of the gap between adjacent pulses of the low-frequency pulse therapy waveform. During the sampling window, disconnect the pulse output path and connect the differential amplification path to collect bioelectric signals from the forehead area via the physiotherapy electrode pads.

[0072] The low-frequency pulse insomnia treatment device continuously outputs a bidirectional square wave pulse sequence during treatment. The pulse repetition frequency of the bidirectional square wave pulse sequence is determined according to the selected treatment mode: 120Hz in sleep aid mode, 100Hz in soothing mode, and 60Hz in analgesia mode. Taking sleep aid mode as an example, the pulse period is 8.3ms, and the pulse width is 250μs, meaning that the bidirectional square wave pulse occupies only about 500μs of time within each pulse period, with the remaining approximately 7.8ms being a pulse gap. In analgesia mode, the pulse period is 16.6ms, the pulse width is 300μs, and the pulse gap is approximately 16ms. The duration of the pulse gap is much longer than the effective pulse duration, providing ample time for signal acquisition operations to be inserted within the pulse gap.

[0073] The microcontroller defines a sampling window in the middle of the pulse gap in each pulse cycle. The start time of the sampling window is set after a pre-silent delay following the pulse trailing edge. The purpose of the pre-silent delay is to allow the polarization potential at the electrode-skin interface to complete its initial decay after the pulse ends, preventing residual polarization potential from superimposing on the bioelectrical signal and causing baseline drift. The length of the pre-silent delay is determined based on the time constant of the electrode-skin interface impedance. For example, the time constant of the equivalent circuit of the interface formed by the electrode gel and skin is approximately 0.8 ms to 1.5 ms. Using three times the time constant as the pre-silent delay ensures that the polarization potential decays to less than 5% of its initial value; the pre-silent delay is set to 3 ms. The end time of the sampling window is set before the next pulse leading edge, reserving a post-protection interval. The post-protection interval ensures that the analog switch completes the switching action from the differential amplification path to the pulse output path. The length of the post-protection interval is not less than the sum of the analog switch's turn-on delay time and the microcontroller's interrupt response time. For example, the post-protection interval is set to 0.5 ms. In sleep aid mode, the available width of the sampling window is approximately 4.3 ms.

[0074] Figure 2 This demonstrates the time-division multiplexing timing relationship of the low-frequency pulse therapy waveform on the time axis. Figure 2The upper center displays the bidirectional square wave pulse output waveform. Within each pulse cycle, the bidirectional square wave pulse occupies only a very short time width, with the majority of the time spent in pulse gaps. A sampling window (marked by a rectangle) is set in the middle region of each pulse gap. A pre-silent delay is maintained between the start position of the sampling window and the trailing edge of the pulse to allow for polarization potential decay; a post-protection interval is maintained between the end position of the sampling window and the leading edge of the next pulse to ensure that the analog switch completes the path switching. The dashed lines indicate the temporal correspondence between the sampling window and the pulse gap, and the range of a complete pulse cycle is indicated by the double arrows at the bottom.

[0075] During the sampling window, the microcontroller sends a path switching control signal to the analog switch. The analog switch disconnects the boost circuit in the pulse output path from the therapeutic electrode pad, while simultaneously connecting the instrumentation amplifier input in the differential amplification path to the therapeutic electrode pad. During the sampling window, the therapeutic electrode pad transforms from an output electrode for applying stimulation to a pickup electrode for capturing bioelectrical signals. The instrumentation amplifier uses two conductive areas on the therapeutic electrode pad as a differential input pair to pick up the potential difference on the skin surface of the forehead region. The output of the instrumentation amplifier is digitally sampled by the analog-to-digital converter (ADC) built into the microcontroller. The ADC continuously acquires multiple sampling points within the sampling window at a fixed sampling rate of at least 1 kHz to meet the signal bandwidth requirements of subsequent bandpass filtering. For example, the ADC sampling rate is set to 2 kHz, which yields approximately 8 to 9 effective sampling points within a 4.3 ms sampling window.

[0076] Figure 3 The time-division multiplexing switching principle of the two internal pathways of the low-frequency pulse insomnia treatment device was demonstrated. Figure 3 The top center features a therapeutic electrode pad attached to the forehead, with two conductive areas, A and B. The electrode pad is connected to a central analog switch via wires, driven by a switching control signal from a microcontroller unit. Below the analog switch are two pathways: the left is a pulse output pathway connected to a boost circuit to generate a treatment waveform; the right is a differential amplification pathway connected to an instrumentation amplifier to pick up bioelectrical signals, with the amplifier output connected to an analog-to-digital converter for digitization. Dashed boxes indicate the pathway directions for treatment and sampling periods, demonstrating the shared electrode pad interface and the time-exclusive switching mechanism achieved through the analog switch.

[0077] At the end of the sampling window, the microcontroller sends a reset control signal to the analog switch. The analog switch disconnects the differential amplification path and reconnects the pulse output path, restoring the normal output of the pulse therapy waveform. This path switching operation is repeated within each pulse cycle, forming a periodic acquisition process that alternates with the pulse output in time intervals. Because the sampling window is located in the middle of the pulse gap and is equipped with a pre-silent delay and a post-protection interval, the pulse output and signal acquisition are completely isolated in time, ensuring the integrity of the treatment waveform and the purity of the acquired signal.

[0078] Step S2: Bandpass filtering, rectification and low-pass smoothing are performed on the bioelectric signals collected in multiple sampling windows to obtain the frontal electromyography envelope sequence, and the electromyography envelope sequence is resampled according to a unified time base to construct a trend sequence.

[0079] Figure 4 The complete signal processing chain from raw sampling points to trend sequence is illustrated in the form of a vertical flowchart. Figure 4 The left column, from top to bottom, consists of: multi-window original sampling points (periodic discontinuous sequence), linear interpolation filling (eliminating data gaps), bandpass filtering (fourth-order Butterworth structure), full-wave rectification (absolute value of negative values), and low-pass smoothing filtering (second-order Butterworth structure). The low-pass smoothed signal is then processed through fixed-interval representative values ​​to construct the electromyographic envelope sequence, followed by resampling and alignment to finally generate the trend sequence. The trend sequence is highlighted with rounded rectangles, indicating its equally spaced, uniform time base characteristics, and specifying that it is stored in the microcontroller's random access memory. A dashed box annotation next to the bandpass filter explains its suppression target.

[0080] In step S1, the number of digitized sampling points acquired within each sampling window is limited, and the time span of a single sampling window is only a few milliseconds, which is insufficient to independently complete the full characterization of the spectral features of the frontal electromyography signal. The microcontroller unit splices the sampling points acquired in multiple consecutive sampling windows in chronological order to form a quasi-continuous discrete signal sequence. Due to the data gaps during pulse output between adjacent sampling windows, the spliced ​​signal sequence exhibits periodic discontinuities on the time axis. To eliminate the impact of discontinuities on subsequent filtering operations, the microcontroller unit performs linear interpolation filling operations on the data gaps, using the sampling values ​​at the edges of two adjacent sampling windows as interpolation endpoints to generate filled sampling points. The filled signal sequence is arranged at equal intervals on the time axis, and the equivalent sampling rate is consistent with the sampling rate of the analog-to-digital converter.

[0081] The microcontroller applies a digital bandpass filter to the filled signal sequence. The lower and upper cutoff frequencies of the bandpass filter are set based on the energy distribution characteristics of the electromyographic (EMG) signals on the surface of the frontalis muscle group. The frontalis muscle is part of the facial expression muscles, and in the states of wakefulness / relaxation and sleep transition, the effective energy of the EMG signals on the surface of the frontalis muscle is mainly concentrated in the frequency range of 20Hz to 150Hz. The lower cutoff frequency of the bandpass filter is set to 20Hz to suppress respiratory motion artifacts, oculomotor drift, and low-frequency components of power frequency interference. The upper cutoff frequency of the bandpass filter is set to 150Hz to suppress high-frequency thermal noise introduced by the instrumentation amplifier and analog-to-digital converter, as well as residual radio frequency interference from the external electromagnetic environment. The bandpass filter is implemented using a fourth-order Butterworth structure, which performs differential equation operations in a two-stage entrained manner within the microcontroller. The fourth-order Butterworth structure has the flattest amplitude-frequency response within the passband, avoiding distortion of the energy distribution within the effective frequency band of the EMG signal.

[0082] The bandpass-filtered signal sequence retains the effective frequency components of the frontal muscle electromyography (EMG) signal, and the signal waveform exhibits an alternating oscillation around a zero baseline. To extract amplitude information reflecting muscle activation levels, the microcontroller performs full-wave rectification on the bandpass-filtered signal sequence, converting all negative sampling points to positive values ​​by taking the absolute value. All sampling points in the full-wave rectified signal sequence are non-negative, and the instantaneous amplitude of the signal directly reflects the superposition intensity of the frontal muscle motor unit discharges.

[0083] The microcontroller applies a low-pass smoothing filter to the full-wave rectified signal sequence. The cutoff frequency of the low-pass smoothing filter determines the trade-off between the temporal resolution and the smoothness of the electromyographic envelope. If the cutoff frequency is set too high, the envelope curve fluctuates wildly, making it difficult to reflect the macroscopic trend of muscle tone changes; if the cutoff frequency is set too low, the envelope curve responds sluggishly to changes in muscle tone, potentially missing the time point of rapid muscle tone decrease during the sleep transition period. The characteristic timescale of the prefrontal cortex muscle tone decrease process during the sleep transition period is on the order of several seconds to tens of seconds. The cutoff frequency of the low-pass smoothing filter is set to 4Hz, corresponding to a time resolution of approximately 0.25 seconds, which can preserve the amplitude change details on the second-level time scale while maintaining the smoothness of the envelope curve. The low-pass smoothing filter is also implemented using a second-order Butterworth structure.

[0084] The output of the low-pass smoothing filter is the frontal electromyography (EMG) envelope signal. The microcontroller extracts representative values ​​from the EMG envelope signal at fixed time intervals to construct an EMG envelope sequence. The representative values ​​are extracted by taking the arithmetic mean of the EMG envelope signal within each extraction interval. The length of the extraction interval determines the temporal resolution of the EMG envelope sequence. For example, the extraction interval is set to 1 second, meaning one representative EMG envelope value is generated per second, and the effective sampling rate of the EMG envelope sequence is 1 Hz. During a 20-minute treatment cycle, the EMG envelope sequence contains approximately 1200 data points.

[0085] Each data point in the electromyography (EMG) envelope sequence is assigned a relative timestamp with the treatment initiation time as zero at the moment of generation. The microcontroller resamples and aligns the EMG envelope sequence in fixed 1-second steps. If there is a slight deviation between the actual generation time and the theoretical timestamp of individual data points, the deviation is eliminated through linear interpolation between adjacent data points. The resulting resampled sequence is a trend sequence, in which data points are arranged at strictly equal intervals with a unified time reference, and can be directly used for subsequent piecewise fitting and rate extraction calculations. The trend sequence is stored in the random access memory of the microcontroller in array form, and new data points are continuously added as the treatment progresses.

[0086] Figure 5 The transformation process of bioelectrical signals from raw acquisition to trend sequence is visually illustrated from top to bottom using five waveform layers. The first layer is the raw, intermittent signal, exhibiting an alternating pattern of short signal clusters and data gaps generated by each sampling window. The second layer is the bandpass filtered signal, which, after interpolation and filtering, presents a continuous alternating waveform oscillating around the zero baseline. The third layer is the full-wave rectified signal, with all waveforms flipped to the positive half-axis, presenting a rapidly fluctuating positive envelope. The fourth layer is the electromyographic envelope curve extracted after low-pass smoothing, with a smooth waveform that gradually decreases, reflecting the macroscopic trend of muscle tone changes. The fifth layer is the final trend sequence, with discrete data points represented by equally spaced black dots, and the ordinate of the dots showing a gradually decreasing trend.

[0087] This step transforms the weak bioelectrical signals from the skin surface into a one-dimensional trend sequence reflecting the evolution of frontal muscle tone over time, providing a data foundation for determining the sleep trend in subsequent steps. The bandpass filtering effectively suppresses residual impulse stimulation and environmental interference, while the low-pass smoothing sufficiently reduces transient fluctuations, enabling the trend sequence to accurately reflect the macroscopic changes in frontal muscle tone without being affected by local disturbances.

[0088] Step S3: Perform segmented fitting on the trend sequence to extract the rate of change of amplitude for each time period. When the rate of change of amplitude for a consecutive preset number of time periods is negative and the rate amplitude is lower than the preset stable threshold, a sleep trend confirmation mark is generated.

[0089] The microcontroller performs a sliding piecewise fitting operation on the continuously updated trend sequence in step S2. The unit of operation for piecewise fitting is a time period, and each time period contains a fixed number of data points arranged consecutively in the trend sequence. The length of the time period is determined based on the typical rhythmic characteristics of the prefrontal cortex tone decrease process during the sleep transition period.

[0090] Sleep medicine research shows that during the process of entering light sleep with the assistance of transcutaneous electrical nerve stimulation (TENS), the prefrontal muscle tone in patients with non-organic insomnia exhibits a phased decreasing characteristic, with each decreasing phase lasting approximately 15 to 45 seconds. A time interval of 30 seconds was set, meaning each interval contained 30 trend sequence data points. The 30-second interval length is near the median of the typical decreasing phase duration range, allowing for the complete capture of the amplitude changes of a single decreasing phase within a single time interval.

[0091] The microcontroller performs a first-order least-squares linear fit on 30 data points within each time period. The first-order least-squares linear fit uses time as the independent variable and the amplitude of the electromyographic envelope as the dependent variable to find the coefficients of a linear function that minimizes the sum of squared residuals. The slope of the linear function represents the rate of change of the electromyographic envelope amplitude within the current time period. The physical meaning of the rate of change of amplitude is the increase or decrease in prefrontal muscle tone per unit time, measured in microvolts per second. A positive rate of change indicates an increasing trend in prefrontal muscle tone within the current time period, suggesting that the user is still awake or experiencing an arousal response; a negative rate of change of amplitude indicates a decreasing trend in prefrontal muscle tone within the current time period, suggesting that the user is transitioning to a sleep state.

[0092] Segmented fitting employs a sliding step approach, with the starting position between two adjacent time segments offset by a step length. The step length is set to half the time segment length, i.e., 15 seconds. A step length shorter than the time segment length ensures 50% data overlap between adjacent time segments. This overlap improves the temporal continuity of the amplitude change rate sequence and avoids rate estimation distortion caused by time segment boundaries falling precisely at the inflection point of muscle tone change. As the treatment progresses, the microcontroller calculates the amplitude change rate for the current time segment every step length, generating an amplitude change rate sequence.

[0093] The microcontroller executes sleep trend determination logic on the amplitude change rate sequence. The determination logic includes two constraints: the first constraint is that the amplitude change rate is negative for a consecutive preset number of time periods; the second constraint is that the amplitude change rate amplitude of each time period within the preset number of time periods is lower than a preset stability threshold. The preset number is chosen because a single, occasional decrease in muscle tone may stem from the disappearance of blink artifacts or temporary relaxation after minor postural adjustments, and does not represent a true sleep transition. However, a continuous negative change rate across multiple time periods reflects a systematic decrease in muscle tone, consistent with the physiological characteristics of the sleep transition period. The preset number is set to 4, corresponding to a determination window time span consisting of one complete preceding time period plus the length of the subsequent three steps, totaling [value missing]. The 75-second decision window ensures the robustness of sleep trend assessment results and avoids misjudging transient muscle tone fluctuations.

[0094] Figure 6 The complete logic for determining sleep trends is presented in two parts. Figure 6 The upper part presents the rate of change of amplitude in the form of a bar chart. Above the zero line are positive rate bars (representing increased muscle tone during wakefulness), and below the zero line are negative rate bars (representing decreased muscle tone). The left wakefulness area fluctuates between positive and negative values, while the right sleep transition area shows continuous negative values ​​with amplitudes all below the preset stability threshold indicated by the dashed line. The bottom brackets mark the judgment windows for four consecutive time periods. Figure 6 The lower half is the decision logic flow: the first constraint (all rates are negative) and the second constraint (amplitude is lower than the stability threshold) are output as a sleep trend confirmation flag after a logical AND operation. The flag is a Boolean latch type and cannot be reset once generated. At the same time, the timestamp of the sleep confirmation time is recorded.

[0095] The preset stabilization threshold is physically defined as the dividing line between the steady-state decrease in muscle tone during the sleep transition and the rapid decrease in muscle tone caused by voluntary relaxation during wakefulness. When a user actively closes their eyes and relaxes while awake, the prefrontal muscle tone also decreases, but at a faster rate, typically stabilizing quickly after a drop in amplitude within seconds. During the sleep transition, the decrease in muscle tone is characterized by a continuous, slow decay, with the absolute value of the rate of change in amplitude remaining at a low level. The preset stabilization threshold is set based on the baseline amplitude level of the electromyographic signal on the surface of the prefrontal muscle. The microcontroller acquires the initial segment of the trend sequence within the first 60 seconds after treatment initiation and calculates the average amplitude value of the initial segment as the baseline reference amplitude. The preset stabilization threshold is set as the ratio of the baseline reference amplitude to a preset decay time parameter. The preset decay time parameter is physically defined as the time required for the prefrontal muscle tone to monotonically decay from the baseline level to zero at a constant rate, measured in seconds. The preset decay time parameter characterizes the timescale characteristics of the muscle tone decay process during the sleep transition. For example, the preset decay time parameter is set to 150 seconds. If the baseline reference amplitude is 30 microvolts, then the preset stability threshold is 30 microvolts divided by 150 seconds, which equals 0.2 microvolts per second. This means that the absolute value of the amplitude change rate does not exceed a decrease of 0.2 microvolts per second. The preset decay time parameter ranges from 100 seconds to 200 seconds. The lower bound of the range corresponds to the muscle tone decay time scale for individuals who fall asleep quickly, and the upper bound corresponds to the muscle tone decay time scale for individuals who fall asleep slowly. The specific value can be calibrated based on the differences between the user's individual electromyography baseline level and the characteristics of the sleep transition period.

[0096] The first constraint ensures that the direction of muscle tone change within the judgment window is consistently downward, eliminating interference from repeated fluctuations in muscle tone between rises and falls. The second constraint ensures that the rate of decrease in muscle tone is within the slow decay range characteristic of the sleep transition period, eliminating rapid drops in muscle tone caused by external stimuli. When both constraints are simultaneously satisfied, the microcontroller generates a sleep trend confirmation flag, which is a Boolean state variable whose value flips from logic zero to logic one. Once generated, the sleep trend confirmation flag is latched and not reset within the current treatment cycle to prevent repeated triggering or revocation of sleep judgments due to random fluctuations in electromyographic signals.

[0097] The microcontroller generates a sleep trend confirmation flag and records the current time as the sleep confirmation time. The difference between the sleep confirmation time and the treatment initiation time is the estimated sleep latency. Sleep latency is a key clinical indicator for assessing the severity of insomnia symptoms and treatment effectiveness, and will be used for dynamic adjustment of treatment parameters in subsequent steps.

[0098] The design of the segmented fitting and sleep trend determination logic described above strikes a balance between determination sensitivity and determination specificity. The 30-second time interval and the requirement for continuity across four time intervals ensure that the determination results have sufficient sensitivity to the actual sleep transition, while also providing adequate resistance to occasional muscle tone fluctuations. The preset stability threshold, based on an adaptive ratio setting of the individual baseline amplitude and preset decay time parameter, allows the determination logic to adapt to differences in electromyographic baselines between different users and between different treatment sessions for the same user, eliminating the need for manual parameter calibration for each user.

[0099] Step S4: In response to the sleep trend confirmation flag, reduce the pulse output amplitude to the preset minimum maintenance level in a cycle-by-cycle manner, and send a state transition flag containing the sleep confirmation time to the terminal program via Bluetooth channel.

[0100] After the microcontroller detects the sleep trend confirmation flag flipping from logic zero to logic one, it enters the pulse output amplitude gradual reduction control phase. During the treatment run before the sleep trend confirmation flag is generated, the pulse output amplitude remains at a constant voltage value corresponding to the level set by the user through the terminal program. Taking the sleep aid mode as an example, the output amplitude is divided into 5 levels, with the maximum output amplitude being a 7V peak value. After the sleep trend confirmation flag is generated, the microcontroller no longer maintains a constant output amplitude, but instead gradually decreases the output amplitude pulse by pulse from the current level value.

[0101] The meaning of cycle-by-cycle decrease is that in each pulse cycle, the microcontroller reduces the target output voltage of the boost circuit by a fixed decrease step size compared to the previous pulse cycle. The size of the decrease step size determines the total number of cycles and the total time span required for the output amplitude to decrease from the current value to the preset minimum maintenance level. If the decrease step size is too large, the output amplitude decreases too quickly, and the user may experience an awakening response due to the sudden change in stimulation intensity, thus interrupting the established sleep trend; if the decrease step size is too small, the output amplitude decreases too slowly, and it may not be able to reach the preset minimum maintenance level within the remaining treatment time, resulting in the output intensity remaining too high before the end of treatment. The decrease step size is calculated based on three parameters: the current output voltage value, the preset minimum maintenance level, and the desired gradual decrease duration.

[0102] The microcontroller determines the decrement step size according to the following relationship: ,in The output voltage decreases by a step size for each pulse cycle. The peak value of the current output voltage of the pulse output path at the moment the sleep trend confirmation flag is generated. The peak output voltage corresponding to the preset minimum sustaining level. This refers to the pulse repetition frequency in the current treatment mode. This represents the desired descent duration. For example, in sleep aid mode, if the user sets the output amplitude to level 4, the current peak output voltage is 5.6V, the preset minimum maintenance level corresponds to a peak output voltage of 1.4V, the pulse repetition frequency is 120Hz, and the desired descent duration is 180 seconds, then the descent step size is approximately 0.19mV per pulse cycle.

[0103] Figure 7 This demonstrates the complete evolution of the pulse output amplitude from a constant output stage to a cycle-by-cycle decreasing stage and then to a locked-and-maintain stage. The vertical axis represents the output voltage, and the horizontal axis represents time. Figure 7 The horizontal solid line segment on the left represents the constant output phase before the sleep trend is confirmed, during which the output voltage remains at the current level. The vertical dashed line in the middle indicates the moment the sleep trend confirmation flag is generated, after which the output voltage decreases smoothly along a curve. A magnified view within the dashed box shows the step-like decrease in detail per pulse cycle, with a fixed step size decrease per pulse cycle. The horizontal dashed line indicates the preset minimum maintenance level. When the output voltage drops to Then it enters the lockout maintenance phase on the right until the treatment ends. The double arrows at the bottom indicate the expected duration of the gradual decrease. The vertical double arrow on the left indicates and The voltage difference between them.

[0104] It should be noted that the preset minimum maintenance level is set based on the following: During the transition from sleep onset to light sleep, the skin sensory threshold rises, and weak electrical stimulation is no longer easily perceived, but it can still exert a background modulation effect on the central nervous system through peripheral nerve pathways. The preset minimum maintenance level is set to 20% of the maximum output amplitude in the current treatment mode. In sleep aid mode, the maximum output amplitude is 7V peak, and the output voltage peak corresponding to the preset minimum maintenance level is 1.4V. The preset minimum maintenance level ensures that the current density at the electrode is still higher than the lower limit of the sensory threshold of peripheral nerve type C fibers but lower than the user's conscious perception threshold, maintaining background modulation efficiency without generating tactile stimulation that may trigger awakening.

[0105] It should be noted that the expected descent duration is set based on the following: there is usually a transition and consolidation phase between the generation of the sleep trend confirmation sign and the user entering a stable light sleep. The duration of the transition and consolidation phase varies among individuals but generally does not exceed 5 minutes. The expected descent duration is set at 180 seconds, or 3 minutes, which is close to the median duration of the transition and consolidation phase, so that the output amplitude smoothly decreases to the minimum maintenance level during the sleep consolidation phase.

[0106] At the pulse leading edge of each pulse cycle, the microcontroller updates the digital-to-analog converter control word of the boost circuit, decreasing the target output voltage by one step. The constant current feedback circuit adjusts the output current according to the updated target voltage value, ensuring that the actual output current continues to evolve along a predetermined decreasing trajectory even when the electrode-skin impedance changes. Once the output voltage decreases to a preset minimum maintenance level, the microcontroller stops decreasing, locks the output voltage at the preset minimum maintenance level, and maintains it until the end of the treatment run.

[0107] Simultaneously with the activation of the output amplitude descent control, the microcontroller unit sends a state transition flag to the terminal program via the Bluetooth communication module. The state transition flag is a data packet, and its payload includes the following information fields: a timestamp of the sleep confirmation moment, the treatment mode identifier corresponding to the sleep confirmation moment, the output amplitude level value corresponding to the sleep confirmation moment, and a state transition type code. The state transition type code is used to distinguish the sleep confirmation event from other possible state transition events. The Bluetooth communication module encapsulates the state transition flag data packet into a Bluetooth Low Energy (BLE) feature value notification frame and sends it to the terminal program. Upon receiving the feature value notification frame, the terminal program sends an acknowledgment response back to the Bluetooth communication module. Before receiving the acknowledgment response, the microcontroller unit retransmits the state transition flag data packet at fixed intervals, with a maximum of three retransmissions. If no acknowledgment response is received after three retransmissions, the microcontroller unit temporarily stores the state transition flag data packet in a buffer and retransmits it after the Bluetooth connection is restored.

[0108] The cycle-wise decreasing output amplitude control method ensures a smooth and continuous decrease in stimulation intensity, avoiding the abrupt changes that might occur with step-wise downsampling. The decreasing step size is calculated based on the pulse repetition frequency using normalization, ensuring consistency in the rate of decrease across different treatment modes at the subjective level. Synchronization of treatment status between the device and the terminal program is achieved through Bluetooth transmission of state transition markers, providing an event-driven triggering mechanism for recording and dynamically correcting execution parameters in subsequent steps.

[0109] Step S5: After the terminal program receives the state transition flag, it records the effective duration and sleep latency of this treatment, and dynamically corrects the initial mode and total runtime parameters of the user's subsequent treatments based on the sleep latency.

[0110] The terminal program receives the state transition marker data packet sent by the microcontroller unit in step S4 via the Bluetooth Low Energy protocol's feature value notification callback interface. The terminal program parses the state transition marker data packet, extracting the timestamp of the sleep confirmation moment and the treatment mode identifier. Starting from the treatment start time recorded at the beginning of this treatment, the terminal program calculates the difference between the timestamp of the sleep confirmation moment and the treatment start time; this difference is the sleep latency for this treatment. The terminal program also records the effective duration of this treatment, defined as the total duration from the treatment start time to the treatment end timestamp. Under the default settings of the low-frequency pulse insomnia treatment device, the single treatment session lasts 20 minutes, but the total duration in subsequent treatments may be adjusted to different values ​​after dynamic correction.

[0111] The terminal program writes the sleep latency, effective duration, treatment mode identifier, and output amplitude level of each treatment session as a treatment record into the local treatment history dataset. This treatment history dataset resides in the terminal program's runtime memory as an array, arranged chronologically according to the treatment sessions. After each treatment session, the terminal program performs statistical analysis on the sleep latency of the most recent sessions in the treatment history dataset to assess the evolution trend of the user's insomnia symptoms and drive dynamic adjustments to subsequent treatment parameters.

[0112] The terminal program assesses the user's current sleep status based on the range of sleep latency values. The grading boundaries are set according to the correlation between sleep latency and insomnia severity in the Clinical Insomnia Severity Scale. Sleep latency is divided into three intervals: short latency, medium latency, and long latency. The upper limit of the short latency interval is set at 5 minutes; a sleep latency falling within this interval indicates that the user falls asleep quickly with electrical stimulation, and the current treatment intensity is sufficient. The lower limit of the medium latency interval is 5 minutes, and the upper limit is set at 12 minutes; a sleep latency falling within this interval indicates that the user's sleep onset speed is within the normal range. The lower limit of the long latency interval is 12 minutes; a sleep latency falling within this interval indicates that the user has significant difficulty falling asleep with electrical stimulation, and the current treatment parameters need to be increased.

[0113] It should be noted that the grading boundaries are set based on the following: In clinical sleep assessments, a sleep latency of 30 minutes or more is typically defined as the clinical threshold for difficulty falling asleep. Transcutaneous electrical nerve stimulation (TENS) can shorten the sleep latency to 30% to 50% of that without assistance. Therefore, the clinical reference range for sleep latency in assisted treatment scenarios is approximately 5 to 15 minutes. 5 minutes, as the upper limit of the short latency range, corresponds to situations where assisted treatment is significantly effective, while 12 minutes, as the upper limit of the medium latency range, corresponds to situations where the assisted treatment is moderately effective but still within an acceptable range.

[0114] The terminal program adjusts the initial mode parameters for subsequent treatment based on the user's assessment results. These initial mode parameters include the selection of the treatment mode. The low-frequency pulse insomnia treatment device has three treatment modes: sleep aid, soothing, and analgesia. These three modes differ in pulse repetition frequency and pulse width, corresponding to different neural regulation mechanisms and varying degrees of sedation. The sleep aid mode has a pulse repetition frequency of 120Hz, suitable for users with moderate sleep latency; the soothing mode has a pulse repetition frequency of 100Hz, suitable for users with short sleep latency who only require maintenance regulation; and the analgesia mode has a pulse repetition frequency of 60Hz and a pulse width increased to 300μs, suitable for users with high difficulty falling asleep who require a stronger sedative effect.

[0115] When a user initiates treatment for the next time, the terminal program determines the recommended initial mode value based on the rating results of the three most recent sessions with effective sleep latency in the treatment history dataset. The logic for determining the recommended initial mode value is as follows: if two or more of the three most recent sessions with effective sleep latency fall within the short latency range, the recommended initial mode value is set to soothing mode; if two or more of the three most recent sessions with effective sleep latency fall within the long latency range, the recommended initial mode value is set to analgesic mode; otherwise, the recommended initial mode value is set to sleep aid mode. The terminal program presents the recommended initial mode value as the default selected treatment mode to the user on the operation page, allowing the user to accept the recommended value or switch to another mode independently.

[0116] The terminal program adjusts the total duration of subsequent treatments based on the user's assessment results. The default value for the total duration is 20 minutes. The adjustment logic for the total duration is based on the relationship between sleep latency and the effective duration of treatment: the longer the sleep latency, the greater the proportion of time the user is awake during treatment, and the shorter the time for maintenance stimulation after falling asleep. Insufficient effective duration of treatment may affect the consolidation of sleep quality. To ensure that the maintenance stimulation time after falling asleep is not less than a minimum effective maintenance duration, the total duration needs to be extended accordingly based on the sleep latency.

[0117] The terminal program calculates the corrected total runtime according to the following relationship: ,in This is the corrected total runtime. The sleep latency is the most recent session with an effective sleep latency. For the minimum effective maintenance duration, This is a descent buffer margin. The minimum effective maintenance duration is the shortest time required to maintain a low level of stimulus output after falling asleep, set to 8 minutes. The descent buffer margin is the time required for the output amplitude to gradually decrease from the current value to the preset minimum maintenance level, i.e., the expected descent duration in step S4, set to 3 minutes. For example, if the sleep latency of the most recent session with an effective sleep latency is 10 minutes, then the corrected total runtime is... minute.

[0118] The terminal program imposes upper and lower limits on the modified total runtime. The upper limit is set at 30 minutes to prevent the battery from running out of power to complete a single treatment session due to excessive runtime. The lower limit is set at 15 minutes to prevent insufficient maintenance stimulation time after sleep onset due to excessive runtime. When the modified total runtime exceeds the upper limit, the terminal program truncates the total runtime to 30 minutes; when the modified total runtime falls below the lower limit, the terminal program increases the total runtime to 15 minutes.

[0119] When the user initiates treatment for the next time, the terminal program encapsulates the revised total runtime and the initial mode recommended value into a treatment parameter configuration command, which is then sent to the microcontroller unit of the low-frequency pulse insomnia treatment device via Bluetooth. Upon receiving the treatment parameter configuration command, the microcontroller unit updates the final value of the current treatment's run timer to the revised total runtime and switches the pulse output parameters to the frequency and pulse width configuration corresponding to the initial mode recommended value. After treatment begins, the microcontroller unit executes pulse output according to the updated parameters and automatically stops outputting and shuts down the device when the run timer reaches its final value.

[0120] If the terminal program has fewer than three sessions with effective sleep latency stored in the treatment history dataset, it cannot perform statistical analysis based on the three most recent effective sessions. During periods with fewer than three sessions with effective sleep latency, the terminal program uses the default sleep aid mode and a total runtime of 20 minutes, without performing dynamic correction operations. After the third session with effective sleep latency ends, the terminal program updates the treatment history dataset and performs dynamic correction logic after each treatment session to generate corrected parameters for the next treatment.

[0121] If the terminal program does not receive a state transition flag during the entire running cycle when the treatment ends, it is determined that this treatment session was without sleep confirmation. The sleep latency record for sessions without sleep confirmation is null, but the effective duration is still recorded according to the actual running time and written to the treatment history data set with a null latency flag. When executing the dynamic correction logic, the terminal program skips sessions with null sleep latency and only performs statistical analysis based on the most recent sessions with effective sleep latency; the three most recent sessions required by the mode recommendation logic are counted based on sessions with effective sleep latency. If the number of effective sessions is less than three, mode correction is not performed, and the currently set treatment mode is used. The total running time correction is based on the most recent session with effective sleep latency. As input for calculation; if there are no sessions with valid sleep latency in the treatment history dataset, the current total runtime is extended by 3 minutes, and any portion exceeding the 30-minute upper limit is truncated to 30 minutes. This process ensures that the dynamic correction logic can still make reasonable parameter adjustments based on valid historical data when sessions without sleep confirmation occur, avoiding interference from sleep-deprivation events with the correction direction.

[0122] The aforementioned dynamic correction mechanism enables the low-frequency pulse insomnia treatment device to adaptively adjust the treatment process based on the user's individual sleep characteristics and treatment response, eliminating the need for the user to manually try different modes and duration combinations. Sleep latency, as the core driving indicator of dynamic correction, directly reflects the degree of match between the current treatment parameters and the user's sleep needs. With the accumulation of treatment sessions, the dynamic correction mechanism gradually converges the treatment parameters to a stable configuration range suitable for the user's individual characteristics, improving treatment efficiency while reducing unnecessary overstimulation.

[0123] This embodiment's adaptive treatment control method embeds three functional levels—bioelectric signal sensing, sleep state determination, and parameter adaptive adjustment—into the routine treatment operation of a low-frequency pulse insomnia treatment device. Step S1 utilizes pulse gaps to achieve time-division multiplexing of treatment output and signal acquisition, obtaining electromyographic information from the forehead region without the need for additional independent sensing electrodes. Step S2 transforms weak raw bioelectric signals into stable and reliable muscle tone trend representations through a cascaded signal processing link. Step S3 achieves robust detection of the sleep transition state through piecewise fitting and multi-time period consistency constraints. Step S4 achieves a seamless transition of output amplitude through a cycle-by-cycle decreasing method, avoiding disruption of established sleep trends by sudden stimulus changes. Step S5 achieves cross-session parameter optimization through statistical learning of treatment history via the terminal program, allowing the treatment plan to adaptively adjust according to the user's sleep status improvement or change. The five steps of this embodiment synergistically constitute a closed-loop control from signal sensing to decision execution to parameter optimization, transforming the low-frequency pulse insomnia treatment device from a fixed-parameter open-loop stimulation device into an intelligent treatment device with autonomous judgment and adaptive adjustment capabilities.

[0124] Example 2

[0125] Reference Figure 8 This is the second embodiment of the present application, which provides an adaptive treatment control system for a wearable insomnia treatment device.

[0126] The system includes: a gap sampling module, an electromyography envelope extraction module, a sleep trend determination module, an amplitude descent control module, and a parameter dynamic correction module.

[0127] The gap sampling module is used to set a sampling window in the middle of the gap between adjacent pulses of the low-frequency pulse therapy waveform. During the sampling window, the pulse output path is disconnected and the differential amplification path is connected to collect the bioelectric signal of the forehead area through the physiotherapy electrode pad.

[0128] The electromyography envelope extraction module is used to perform bandpass filtering, rectification and lowpass smoothing on the bioelectric signals collected in multiple sampling windows to obtain the frontal electromyography envelope sequence, and to resample the electromyography envelope sequence to construct a trend sequence.

[0129] The sleep trend determination module is used to perform segmented fitting on the trend sequence to extract the amplitude change rate of each time period. When the amplitude change rate of a consecutive preset number of time periods is negative and the rate amplitude is lower than a preset stability threshold, a sleep trend confirmation flag is generated. The amplitude reduction control module is used to respond to the sleep trend confirmation flag by reducing the pulse output amplitude to a preset minimum maintenance level in a cycle-by-cycle manner, and sending a state transition flag containing the sleep confirmation time to the terminal program.

[0130] The parameter dynamic correction module is used to record the effective duration and sleep latency of the current treatment after the terminal program receives the state transition flag, and to dynamically correct the initial mode and total runtime parameters of the user's subsequent treatments based on the sleep latency.

[0131] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the displayed or discussed mutual couplings or direct couplings or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.

[0132] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments under the guidance of this application without departing from the spirit and scope of protection of the claims. All of these variations are within the protection scope of this application.

[0133] It should be noted that the collection, storage, and use of all personal information involved in the technical solution of this invention must be carried out only after obtaining the explicit authorization and separate consent of the information subject. The processing of personal information-related data strictly complies with the requirements of currently effective national laws, regulations, and relevant standards and specifications. The collected personal information is limited to use within the specific purpose necessary to achieve the technical solution of this invention, and no processing beyond that purpose is performed. Necessary technical and management measures are taken to ensure the security of personal information.

Claims

1. An adaptive treatment control method for a wearable insomnia treatment device, characterized in that, include: A sampling window is set in the middle of the gap between adjacent pulses in the low-frequency pulse therapy waveform of the wearable insomnia treatment device. During the sampling window, the pulse output path is disconnected and the differential amplification path is connected, and the bioelectric signal of the forehead area is collected through the physiotherapy electrode pad. The bioelectric signals collected in multiple sampling windows were subjected to bandpass filtering, rectification and lowpass smoothing to obtain the frontal electromyography envelope sequence, and the electromyography envelope sequence was resampled to construct a trend sequence. The trend sequence is segmented and fitted to extract the rate of change of amplitude in each time period. When the rate of change of amplitude in a consecutive preset number of time periods is negative and the rate amplitude is lower than the preset stability threshold, a sleep trend confirmation mark is generated. In response to the sleep trend confirmation flag, the pulse output amplitude is reduced to the preset minimum maintenance level in a cycle-by-cycle manner, and a state transition flag containing the sleep confirmation time is sent to the terminal program; After the terminal program receives the state transition flag, it records the effective duration and sleep latency of this treatment, and dynamically adjusts the initial mode and total runtime parameters of the user's subsequent treatments based on the sleep latency.

2. The adaptive treatment control method for the wearable insomnia treatment device according to claim 1, characterized in that, The wearable insomnia treatment device includes a microcontroller unit, an analog switch, and an analog-to-digital converter built into the microcontroller unit; The collection of bioelectric signals from the forehead region includes: the starting time of the sampling window is set after a pre-silent delay following the end of the pulse trailing edge, and the length of the pre-silent delay is determined based on the time constant of the electrode-skin interface impedance; The sampling window ends at a time that is set before the next pulse leading edge arrives, with a reserved post-protection interval. The length of the post-protection interval is not less than the sum of the conduction delay time of the analog switch and the interrupt response time of the microcontroller unit. During the sampling window, the microcontroller sends a path switching control signal to the analog switch, and the analog-to-digital converter continuously acquires multiple sampling points at a fixed sampling rate within the sampling window. When the sampling window ends, the microcontroller sends a reset control signal to the analog switch, disconnecting the differential amplification path and reconnecting the pulse output path.

3. The adaptive treatment control method for the wearable insomnia treatment device according to claim 1, characterized in that, The process of bandpass filtering, rectification and lowpass smoothing of bioelectric signals acquired in multiple sampling windows includes: splicing the sampling points obtained in multiple consecutive sampling windows in chronological order, performing linear interpolation filling operation on the data blank segments between adjacent sampling windows, and generating filling sampling points by using the sampling values ​​at the edges of two adjacent sampling windows as interpolation endpoints, so that the filled signal sequence is arranged at equal intervals on the time axis. A digital bandpass filter is applied to the filled signal sequence. The lower cutoff frequency of the bandpass filter is set according to the energy distribution characteristics of the electromyographic signal on the surface of the frontal muscle group, and the upper cutoff frequency is used to suppress high-frequency noise. The bandpass filter is implemented in a two-stage cascaded form using a fourth-order Butterworth structure.

4. The adaptive treatment control method for the wearable insomnia treatment device according to claim 1, characterized in that, The process of bandpass filtering, rectification, and lowpass smoothing of bioelectric signals collected within multiple sampling windows further includes: performing full-wave rectification on the bandpass-filtered signal sequence to convert all negative sampling points to positive values ​​by taking the absolute value of each negative value. A low-pass smoothing filter is applied to the signal sequence after full-wave rectification. The cutoff frequency of the low-pass smoothing filter is set according to the characteristic time scale of the decrease in muscle tone of the frontal muscle during the sleep transition period. The low-pass smoothing filter is implemented using a second-order Butterworth structure. An electromyographic envelope sequence is constructed by taking the arithmetic mean of the electromyographic envelope signal output from the low-pass smoothing filter at a fixed extraction interval as the representative value.

5. The adaptive treatment control method for the wearable insomnia treatment device according to claim 1, characterized in that, The microcontroller unit includes random access memory; The process of resampling the electromyographic envelope sequence to construct the trend sequence includes: Each data point in the electromyographic envelope sequence is assigned a relative timestamp with the treatment initiation time as zero at the time of generation; The microcontroller resamples and aligns the electromyographic envelope sequence with a fixed step size, and eliminates the deviation between the actual generation time and the theoretical timestamp by linear interpolation between adjacent data points; The data points in the trend sequence obtained after resampling are arranged at equal intervals and stored in the random access memory in the form of an array, with new data points continuously added as the treatment process progresses.

6. The adaptive treatment control method for the wearable insomnia treatment device according to claim 1, characterized in that, The step of segmenting and fitting the trend sequence to extract the rate of change of amplitude in each time period includes: setting the operation unit of segmented fitting as a time period, each time period containing a fixed number of data points arranged continuously in the trend sequence, and the length of the time period being determined according to the typical rhythmic characteristics of the process of prefrontal muscle tone decrease during the sleep transition period. For each time period, perform a first-order least squares linear fit on the data points, and solve for the coefficients of a linear function with time as the independent variable and electromyographic envelope amplitude as the dependent variable. The slope of the linear function is the rate of change of amplitude in the current time period. The segmented fitting uses a sliding step method, with the step length being less than the time period length, so that there is data overlap between adjacent time periods.

7. The adaptive treatment control method for the wearable insomnia treatment device according to claim 1, characterized in that, The determination of the preset stability threshold includes: the microcontroller collects the initial segment of the trend sequence within a preset initial time period after the treatment is started, and calculates the average amplitude value of the initial segment as the baseline reference amplitude; The preset stability threshold is set as the ratio of the baseline reference amplitude to the preset decay time parameter, which characterizes the time-scale features of the muscle tone decay process during the sleep transition period. The baseline reference amplitude is updated with the actual acquisition results at the start of each treatment, and the preset stability threshold is recalculated based on the updated baseline reference amplitude.

8. The adaptive treatment control method for the wearable insomnia treatment device according to claim 1, characterized in that, The generated sleep trend confirmation flag includes: a first constraint and a second constraint; the first constraint for determining the sleep trend is that the amplitude change rate of each consecutive preset number of time periods is negative, and the second constraint is that the amplitude change rate of each time period in the consecutive preset number of time periods is lower than a preset stability threshold. When both the first and second constraints are met, the microcontroller generates a sleep trend confirmation flag. Once generated, the sleep trend confirmation flag is locked and will not be reset during the current treatment cycle. The microcontroller generates a sleep trend confirmation flag and records the current time's timestamp as the sleep confirmation time.

9. The adaptive treatment control method for the wearable insomnia treatment device according to claim 1, characterized in that, The step of reducing the pulse output amplitude to a preset minimum maintenance level in a cycle-by-cycle manner includes: the microcontroller reducing the target output voltage of the boost circuit by a single fixed decreasing step in each pulse cycle; The decreasing step size is determined based on the current peak output voltage at the time the sleep trend confirmation flag is generated, the peak output voltage corresponding to the preset minimum maintenance level, the pulse repetition frequency in the current treatment mode, and the expected decreasing duration. The preset minimum maintenance level is set to a preset percentage of the maximum output amplitude in the current treatment mode; Once the output voltage decreases to the preset minimum maintenance level, the decrease stops and the output voltage is locked until the treatment run time ends.

10. The adaptive treatment control method for the wearable insomnia treatment device according to claim 1, characterized in that, The step of sending a state transition flag containing the sleep confirmation time to the terminal program includes: the state transition flag is a data packet, the payload of which includes the timestamp of the sleep confirmation time, the treatment mode identifier, the output amplitude level value and the state transition type code, and the state transition flag is sent to the terminal program. After receiving the data packet, the terminal program sends back an acknowledgment response. Before receiving the acknowledgment response, the microcontroller retransmits the data packet at fixed intervals. If no acknowledgment response is received after reaching the maximum number of retransmissions, the data packet is temporarily stored in a buffer and retransmitted after the connection is restored.

11. The adaptive treatment control method for the wearable insomnia treatment device according to claim 1, characterized in that, The dynamic correction of the initial mode and total runtime parameters of the user's subsequent treatment based on the sleep latency includes: the terminal program divides the sleep latency into short latency intervals, medium latency intervals and long latency intervals, and determines the recommended value of the initial mode based on the interval distribution of the effective sleep latency of the most recent preset sessions in the treatment history data set; The terminal program calculates the corrected total runtime based on the effective sleep latency, minimum effective maintenance duration, and descent buffer margin, and applies upper and lower limits to the corrected total runtime. The terminal program sends the revised total runtime and the recommended initial mode value to the microcontroller unit for execution.

12. An adaptive treatment control system for a wearable insomnia treatment device, implemented based on the adaptive treatment control method for a wearable insomnia treatment device according to any one of claims 1 to 11, characterized in that, include: Interval sampling module, electromyographic envelope extraction module, sleep trend determination module, amplitude descent control module, and parameter dynamic correction module; The gap sampling module is used to set a sampling window in the middle of the gap between adjacent pulses of the low-frequency pulse therapy waveform, disconnect the pulse output path and connect the differential amplification path during the sampling window, and collect the bioelectric signal of the forehead area through the physiotherapy electrode pad. The electromyography envelope extraction module is used to perform bandpass filtering, rectification and lowpass smoothing on the bioelectric signals collected in multiple sampling windows to obtain the frontal electromyography envelope sequence, and to resample the electromyography envelope sequence to construct a trend sequence. The sleep trend determination module is used to perform segmented fitting on the trend sequence to extract the amplitude change rate of each time period. When the amplitude change rate of a consecutive preset number of time periods is negative and the rate amplitude is lower than the preset stable threshold, a sleep trend confirmation flag is generated. The amplitude reduction control module is used to respond to the sleep trend confirmation flag, reduce the pulse output amplitude to a preset minimum maintenance level in a cycle-by-cycle manner, and send a state transition flag containing the sleep confirmation time to the terminal program. The parameter dynamic correction module is used to record the effective duration and sleep latency of the current treatment after the terminal program receives the state transition flag, and to dynamically correct the initial mode and total runtime parameters of the user's subsequent treatments based on the sleep latency.