Sleep improvement electrical stimulation method, system and computer program product

CN122805942APending Publication Date: 2026-09-25SHANGHAI KONGSHANCI TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610889223.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-18
Publication Date
2026-09-25

AI Technical Summary

Technical Problem

这种做法不仅引入了无线通信延迟、功耗及连接不稳定性,导致系统在无网络或终端故障时完全失效,也带来了生理数据隐私泄露的潜在风险

Benefits of technology

[0042]通过在穿戴式组件上集成多模态传感器,并赋予分期模块质量感知的动态决策路径选择能力,本方案使系统在单一模态信号质量因电极移位或其他干扰而恶化时,能够智能地退避并依赖其他冗余生理信息维持高质量的分期输出。这种硬件冗余与算法自适应的结合,显著提升了系统在复杂睡眠环境下的功能稳健性和决策可靠性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122805942A_ABST
    Figure CN122805942A_ABST
Patent Text Reader

Abstract

The patent relates to the technical field of biomedical engineering, in particular to a sleep improvement electrical stimulation method, system and computer program product. The method comprises: generating at least two middle frequency carrier signals for electrical stimulation; applying electrical stimulation and synchronously collecting electroencephalogram signals superimposed with the middle frequency carrier signals through electrodes; making the electroencephalogram signals pass through a hybrid analog filter network to physically attenuate the superimposed middle frequency carrier signals in an analog domain; analog-digital converting the electroencephalogram signals; identifying a current sleep period based on the signals after the physical attenuation and analog-digital conversion; and regulating the electrical stimulation parameters according to the identification result of the sleep period. By implementing physical attenuation on interference signals in an analog domain before analog-digital conversion, the physical bottleneck that strong carrier interference leads to saturation of a rear-stage analog-digital converter is solved from the root, and it is ensured that weak electroencephalogram signals can be synchronously collected with high fidelity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This patent relates to the field of biomedical engineering technology, specifically to a sleep improvement method that can acquire and analyze high-fidelity electroencephalogram (EEG) signals while applying electrical stimulation, and adjust electrical stimulation parameters in a closed loop based on the analysis results; a computer program product that implements the method; and a sleep improvement electrical stimulation system that executes the method. Background Technology

[0002] Sleep disorders are a prevalent health problem, and deep sleep is crucial for physical recovery, memory consolidation, and immune function. Among physical therapy methods, transcranial electrical stimulation (TCS) has gained attention due to its non-invasive nature. Existing technologies include electrical stimulation systems for improving sleep, which apply specific patterns of current to the brain via electrodes placed on the scalp to modulate neural activity and promote deep sleep. In these systems, temporal interference stimulation (TIS) is typically used to stimulate target areas deep within the brain (such as the ventromedial prefrontal cortex). This technique involves injecting two carrier signals with a high frequency (at least 2 kHz based on the neuronal cell superthreshold) and a small frequency difference into the scalp via two pairs of electrodes. The interference effect at the intersection of these two signals in deep brain regions generates a low-frequency envelope electric field (0.5-200 Hz) with a frequency equal to the frequency difference, thus achieving non-invasive, focused stimulation of deep target areas while avoiding excessive influence on cortical regions.

[0003] However, constructing a closed-loop system capable of monitoring real-time sleep states and dynamically optimizing electrical stimulation parameters presents a fundamental physical challenge. To acquire EEG signals used to determine sleep stages, electrodes must maintain extremely high sensitivity to weak physiological potentials at the microvolt level on the scalp. However, during the synchronous cycle of applying time-interference electrical stimulation, the same or adjacent acquisition electrodes inevitably couple to intermediate-frequency carrier signals with amplitudes reaching hundreds of millivolts. This extremely strong interference signal differs from the target EEG signal by several orders of magnitude in amplitude, and its spectrum partially overlaps with the EEG frequency band due to modulation effects. If such mixed signals are directly fed into the subsequent analog-to-digital converter, it will immediately cause the converter's input stage to saturate, resulting in the complete loss of the weak EEG signal. One type of existing system attempts to circumvent this contradiction by employing an open-loop control mode, performing sleep assessment only before stimulation or during stimulation intervals, but this sacrifices the real-time performance and accuracy of regulation. Another type of closed-loop system adopts an architecture that wirelessly transmits data to external smart terminals (such as mobile phones or cloud platforms) for processing and decision-making. In this type of architecture, wearable components act merely as signal relay stations, lacking local signal processing and decision-making capabilities. This approach not only introduces wireless communication latency, power consumption, and connection instability, causing the system to completely fail when there is no network or the terminal malfunctions, but also poses a potential risk of leakage of physiological data privacy.

[0004] Therefore, how to achieve a complete closed-loop chain in local equipment, from the non-destructive acquisition of microvolt-level EEG signals and high-precision sleep staging to the dynamic control of electrical stimulation parameters, in the harsh electromagnetic environment of strong carrier interference, is a key technical problem that urgently needs to be solved in this field. Summary of the Invention

[0005] To solve, or at least partially solve, the technical problems existing in the background art described above, the present invention provides a method for electrical stimulation to improve sleep, comprising: Generate at least two intermediate frequency carrier signals for electrical stimulation; Electrical stimulation is applied, and an electroencephalogram (EEG) signal superimposed with the intermediate frequency carrier signal is simultaneously acquired through electrodes; The EEG signal is passed through a hybrid analog filter network to physically attenuate the superimposed intermediate frequency carrier signal in the analog domain; The electroencephalogram (EEG) signal was converted from analog to digital. Based on the signal after physical attenuation and analog-to-digital conversion, the current sleep stage is identified; The electrical stimulation parameters are adjusted based on the identification results of the sleep period.

[0006] The overall benefit of this method lies in its ability to fundamentally solve the physical bottleneck of strong carrier interference causing saturation of the subsequent analog-to-digital converter by physically attenuating the interference signal in the analog domain before analog-to-digital conversion. This ensures that weak EEG signals can be acquired synchronously with high fidelity. This enables subsequent sleep staging algorithms to obtain high-quality, lossless input data, ultimately providing the physical prerequisite for dynamic closed-loop regulation that relies on accurate sleep state interpretation, and guaranteeing the real-time performance, accuracy, and safety of the regulation.

[0007] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the aforementioned method.

[0008] The present invention also provides a sleep-improving electrical stimulation system, comprising: Wearable components integrate acquisition electrodes for acquiring electroencephalogram (EEG) signals and stimulation electrodes for applying time-interference electrical stimulation deep within the brain. A host controller is electrically connected to the wearable component via a wired connection, the host controller comprising: A carrier signal generation module is used to generate at least two intermediate frequency carrier signals required for the time-interference electrical stimulation. The output terminal of the carrier signal generation module is electrically connected to the stimulation electrode to output the intermediate frequency carrier signal to the stimulation electrode. A hybrid analog filter network, whose input is electrically connected to the acquisition electrode, is used to physically attenuate the EEG signal synchronously acquired by the acquisition electrode and superimposed with the intermediate frequency carrier signal in the analog domain; An analog-to-digital converter, whose input is electrically connected to the output of the hybrid analog filter network, is used to perform analog-to-digital conversion on the EEG signal after physical attenuation. The sleep staging module has its input terminal electrically connected to the output terminal of the analog-to-digital converter, and is used to identify the current sleep stage based on the high-fidelity signal after physical attenuation and analog-to-digital conversion. The closed-loop control module has its input terminal electrically connected to the output terminal of the sleep staging module and its control output terminal electrically connected to the control input terminal of the carrier signal generation module. It is used to adjust the parameters of the time-interference electrical stimulation according to the sleep stage identification results.

[0009] This system integrates a high-suppression-ratio hybrid analog filter network into the local link between the signal acquisition electrodes and the analog-to-digital converter via a wired connection, and establishes a clear hardware module and signal flow from signal generation, acquisition, filtering, analysis to regulation. This physically solves the signal fidelity problem under strong carrier interference within a single device, and achieves complete closed-loop regulation that can operate independently without relying on any external devices or networks.

[0010] Optionally, the adjustment of the electrical stimulation parameters includes: adjusting the frequency difference of the at least two intermediate frequency carrier signals to make them fall within a preset envelope frequency range; the preset envelope frequency range is between 0.1 Hz and 10 Hz to match the firing frequency of neurons in the ventromedial prefrontal cortex.

[0011] By precisely locking the envelope frequency generated by the interference to the delta wave band, which is closely related to deep sleep, and ensuring that its overall range covers the intrinsic firing rhythm of neurons in the target brain region, a precise match between the stimulation frequency parameters and the electrophysiological characteristics of neurons in the target region is achieved. This can specifically induce and enhance neural oscillation synchronization activities related to deep sleep, thereby effectively promoting the occurrence and maintenance of deep sleep.

[0012] Optionally, the electrical stimulation intensity satisfies the following conditions: when the carrier frequency is less than 2.5 kHz, the maximum current amplitude is less than 5 mA; when the carrier frequency is between 2.5 kHz and 5 kHz, the maximum current amplitude is less than 7 mA; and when the carrier frequency is greater than 5 kHz, the maximum current amplitude is less than 14 mA.

[0013] This segmented current limiting strategy based on carrier frequency establishes a high-resolution safety barrier directly linked to the excitation frequency. It fully considers the differences in conductivity and safety tolerance thresholds of human tissue at different frequencies, completely eliminating the risk of localized tissue thermal damage or neurotoxicity caused by current overload at the physical output level, maximizing long-term safety while ensuring therapeutic efficacy.

[0014] Optionally, the regulation of the electrical stimulation parameters includes: when using multiple pairs of electrodes to perform time-interferential electrical stimulation between multiple brain region target points, performing time-division multiplexing polling switching between stimulation parameter configurations at multiple target points at an intermediate frequency rate; the intermediate frequency rate is in the frequency band of 2kHz to 5kHz; when switching the target point current amplitude, implementing controlled slew rate limiting to produce a smooth ramp transition; the controlled slew rate limiting is implemented by a rate limiter, which gradually adjusts the current command value in a clock cycle higher than the polling rate with a preset fixed step, so that it smoothly transitions from the current amplitude to the target amplitude; during the transient period of each focus state switching, generating a blanking signal to temporarily freeze the input stage of the ADC performing the analog-to-digital conversion; the generation of the blanking signal is synchronized with the start time of the focus state transition, and its duration at least covers the ramp transition period and the stable period required by the ADC input stage; the freeze operation controls the ADC input stage to enter a bypass or sampling hold pause state through the blanking signal.

[0015] This scheme cleverly transforms the spatial crosstalk problem of multi-target stimulation into a temporal separation problem. First, polling is performed at a frequency band far exceeding the neuronal response speed, utilizing the low-pass characteristics of neuronal electrophysiology to make it macroscopically perceived as multiple targets being independently and concurrently modulated. Second, by shifting the transient noise spectrum generated by switching to the efficient stopband of the analog front-end filter, its interference with EEG signals is isolated at the source. Finally, combined with a controlled ramp transition and a precise synchronous blanking mechanism, pixel-level strict temporal isolation between the stimulation and acquisition channels is achieved at the physical layer. This fundamentally avoids any potential contamination of high-fidelity EEG acquisition by focus switching artifacts, allowing independent modulation of multiple target areas and interference-free signal acquisition to proceed in parallel. This implementation breaks the limitation of traditional multi-electrode stimulation where the brain's electric fields must be superimposed to generate an uncontrollable envelope. For the first time, it achieves pixel-level independent orchestration of the stimulation timing of multiple deep target areas at the physical layer. Theoretically, the system can execute vmPFC stimulation (promoting deep sleep) and amygdala stimulation (inhibiting anxiety) in parallel, providing unprecedented spatiotemporal freedom for complex brain state regulation.

[0016] Optionally, in the step of identifying the current sleep period, the identification is based on a lightweight neural network model running on the host controller; the lightweight neural network model includes at least one normalization layer, the running statistics of the normalization layer are configured to be updated online in unsupervised memory of the host controller, and the convolutional layer weights of the lightweight neural network model remain frozen during the update.

[0017] This solution achieves continuous, unsupervised adaptive response of a neural network model to non-stationary baseline drift of individual EEG signals without increasing backpropagation computational overhead or triggering real-time processing interruptions due to non-volatile memory write operations. By updating the statistics of the normalization layer only online, the model's feature distribution can dynamically align with the data characteristics of the current individual, while retaining the sleep stage discrimination knowledge acquired during training. Thus, it robustly maintains accurate stage segmentation capabilities across individuals and nights on resource-constrained embedded platforms.

[0018] Optionally, the operating statistics are updated using an exponential moving average (EMA) formula; the exponential moving average formula includes a smoothing coefficient α(t); the smoothing coefficient α(t) is dynamically modulated based on signal quality metrics derived from the hardware front end and / or the current sleep stage results.

[0019] This mechanism enables the update rate of statistics to be perceptually synchronized with signal quality and physiological state. When the signal quality is high and the patient is in deep sleep, where the EEG signal is most stable, the system actively learns the individual's stable baseline at a high rate. However, when transient artifacts are present or the patient is in a sleep period with large EEG fluctuations, the system slows down or freezes the update process, thereby giving the online adaptive process strong anti-artifact capabilities and avoiding the contamination or collapse of feature distribution caused by blind learning.

[0020] Optionally, it also includes: when the cumulative change of the operating statistic within a single usage period exceeds a preset standard deviation threshold, automatically stopping the update and rolling the operating statistic back to its initial value.

[0021] This provides a rigid safety barrier based on statistical distribution distance for the unsupervised adaptive process. By continuously monitoring the drift of operating statistics relative to the factory initial values ​​and executing circuit breaking and rollback when significant out-of-distribution deviations occur, this solution can effectively prevent model discrimination boundary disorder caused by extreme operating conditions or prolonged wear, ensuring the basic availability and stability of the device in various complex scenarios.

[0022] Optionally, before identifying the current sleep period, the method further includes: acquiring the fixed group delay introduced by the simulated front end that physically attenuates the EEG signal; calculating a phase compensation angle using the EEG slow wave frequency locked in real time by the frequency-locked loop and the fixed group delay; and biasing the instantaneous phase extracted from the EEG slow wave according to the phase compensation angle to obtain the corrected instantaneous phase.

[0023] This solution solves the inherent problem of nonlinear phase distortion introduced by high-order physical filters in the analog front end with extremely low firmware computation cost and only a single multiply-accumulate operation. It avoids running complex digital all-pass equalizers on resource-constrained processors and accurately restores the true instantaneous phase of slow EEG waves through an "offline calibration, pre-compensation" strategy, providing a high-fidelity timing reference for closed-loop modulation that relies on precise phase.

[0024] Optionally, the method further includes: evaluating the confidence level of the corrected instantaneous phase, and allowing the electrical stimulation to be triggered based on the corrected instantaneous phase only when the confidence level is higher than a preset threshold; the confidence level is evaluated based on the amplitude of the frequency-locked loop output, the frequency-locking error, and / or the signal quality index.

[0025] By introducing a multi-dimensional reliability fuzzy evaluation based on the algorithm's internal state and signal quality, this scheme constructs a selective phase-triggered safety gate. When the EEG waveform is severely distorted due to interference or physiological mutations, causing frequency-locked loop tracking instability, this mechanism can reliably shield unreliable phase points, preventing false stimulation. This allows the system to degenerate from simple precise phase tracking to a more robust macroscopic closed-loop decision-making mechanism under non-ideal signal conditions, significantly improving the safety of modulation.

[0026] Optionally, the signal quality index includes at least one of signal stability, noise ratio, or data integrity, and is evaluated by: injecting a weak pseudo-random test signal through the electrodes during the application of the electrical stimulation, the pseudo-random test signal being incoherent with the physiological rhythm; monitoring the response characteristics of the test signal to evaluate the electrode contact impedance and / or the detuning state of the hybrid analog filter network in real time; and providing a priori indication of the signal quality index based on the evaluated electrode contact impedance and / or detuning state.

[0027] This method expands the dimension of signal quality assessment from the traditional pure signal feature domain to the hardware physical state perception domain. Its technical advantage lies not only in achieving an objective judgment of the current signal quality, but also in enabling proactive perception of potential signal quality degradation through monitoring changes in electrode contact impedance and passive filter network termination impedance. This gives a filter network composed of static passive components quasi-adaptive state diagnosis and early warning capabilities, providing valuable prior information to upper-level decision-making modules and significantly improving the overall robustness of the system in real-world, complex usage environments.

[0028] Optionally, the method further includes: simultaneously acquiring heart rate variability signals and / or acceleration signals while acquiring the electroencephalogram (EEG) signal; evaluating the quality indicators of the EEG signal, the heart rate variability signal, and / or the acceleration signal; identifying the current sleep stage includes: dynamically selecting a decision path based on the quality indicators; wherein, when the quality indicator of the EEG signal is higher than a first threshold, EEG features extracted from the EEG signal are used as the primary criterion; when the quality indicator of the EEG signal is lower than the first threshold, the weight of the EEG features is reduced, and features extracted from the heart rate variability signal and / or the acceleration signal are introduced as alternative or supplementary criteria.

[0029] This scheme constructs a multimodal redundant decision system driven by signal quality. It overcomes the shortcomings of relying solely on EEG signals, which leads to a sharp drop in reliability in complex scenarios such as poor electrode contact or intense body movement. When the dominant modality signal deteriorates, the system can intelligently and seamlessly switch to or integrate other redundant modalities for decision-making, endowing the sleep staging function with self-healing capabilities under single-modality failure and ensuring the continuity and reliability of closed-loop control decisions under various adverse conditions.

[0030] Optionally, the hybrid analog filtering network includes: a passive LCR notch filter group tuned to the intermediate frequency carrier signal frequency, and an active high-order low-pass filter located after the passive LCR notch filter group with a cutoff frequency lower than the intermediate frequency carrier signal.

[0031] As a preferred embodiment, the passive LCR notch filter group comprises multiple LCR series resonant notch filters, the Q value of which is greater than 50, and the inductor in which is a magnetically shielded wire-wound inductor; the active high-order low-pass filter is an 8th-order filter based on Bessel polynomials, and the -3dB cutoff frequency of which is between 100Hz and 150Hz; the active high-order low-pass filter includes an operational amplifier, the input voltage noise density of which is less than 5nV / √Hz; the hybrid analog filter network is configured to provide a physical attenuation of not less than 100dB for the intermediate frequency carrier signal.

[0032] This hybrid architecture combines the advantages of passive devices (high voltage withstand and low noise) with active devices (steep attenuation slope). The front-stage passive notch filter array with extremely high Q values ​​is responsible for targeted deep attenuation of known high-power carrier frequencies. The rear-stage active low-pass filter, based on Bessel polynomials, effectively filters out residual intermediate frequency spurious signals and broadband noise while maximally protecting the phase information of the EEG signal within the passband from distortion, thanks to its maximum flat group delay characteristics. Simultaneously, stringent restrictions on the selection of key components suppress the introduction of new interferences such as inductor leakage flux and operational amplifier background noise at the source, ensuring the cleanliness of the entire noise reduction chain and providing a solid physical guarantee for the unsaturated, high-fidelity acquisition of microvolt-level EEG signals.

[0033] Optionally, the acquisition electrode and the stimulation electrode are different types of electrodes, wherein: the acquisition electrode is a dry electrode, located at AF7, AF8, FPZ, FP1, and FP2 positions of the International 10-20 system; and the stimulation electrode is a hydrogel electrode, located at AF3, F1, TP7, and TP9 positions of the International 10-20 system.

[0034] By physically assigning high-sensitivity signal acquisition and high-current electric field stimulation to electrodes of different types and locations, this scheme achieves natural isolation between the acquisition and stimulation pathways. Utilizing the stable signal pickup capability of dry electrodes in the forehead region and the high conductivity and low impedance characteristics of hydrogel electrodes forming an effective time-interference electric field at specific locations, high-fidelity signal extraction and efficient deep electric field modulation can be achieved simultaneously, while also realizing target precision and signal effectiveness based on standard anatomical localization.

[0035] Optionally, the host controller includes a microcontroller (MCU), volatile memory (SRAM), and a non-volatile memory (Flash), wherein the non-volatile memory is used to store a lightweight neural network model running on the microcontroller, and the volatile memory is used to store real-time data; the sleep staging module is implemented as a module running the lightweight neural network model, the lightweight neural network model including at least one normalization layer, the running statistics of the normalization layer are configured to be updated online in the volatile memory, and the convolutional layer weights of the lightweight neural network model remain frozen during the update; the update of the running statistics adopts the exponential moving average (EMA) formula, the exponential moving average formula includes a smoothing coefficient α(t), the smoothing coefficient α(t) is dynamically modulated according to the signal quality index (SQI) derived from the hardware front end and / or the current sleep staging result; the host controller is further configured with a circuit breaker protection mechanism: when the cumulative change of the running statistics in a single usage cycle exceeds a preset standard deviation threshold, the update is automatically stopped and the running statistics are rolled back to the initial value.

[0036] This solution fully integrates the aforementioned unsupervised, gradient-free model adaptation mechanism into the system hardware. It clearly illustrates the specific implementation of the algorithm in the embedded chip, the data storage partitioning, and the operational logic, enabling the adaptation process to achieve determinism and reliability in hardware behavior. Furthermore, it integrates safety circuit breaker measures, providing a complete hardware and software integrated guarantee for the long-term stable operation of the system.

[0037] Optionally, the host controller is configured to store a fixed group delay introduced by the hybrid analog filter network via offline calibration, and to calculate a phase compensation angle using the EEG slow wave frequency locked in real time by the frequency-locked loop and the fixed group delay. The host controller then performs a bias correction on the instantaneous phase extracted from the EEG slow wave based on the phase compensation angle to obtain a corrected instantaneous phase. The host controller is further configured to: evaluate the confidence level of the corrected instantaneous phase, and only allow triggering of the time-interference electrical stimulation based on the corrected instantaneous phase when the confidence level is higher than a preset threshold; the confidence level is based on the amplitude and frequency lock output by the frequency-locked loop. The error and / or the signal quality metrics are used for evaluation; the signal quality metrics include at least one of signal stability, noise ratio, or data integrity, and the host controller is further configured to evaluate the signal quality metrics by: controlling the injection of a weak pseudo-random test signal into the stimulation electrode or the acquisition electrode during the application of the time-interference electrical stimulation, the pseudo-random test signal being incoherent with the physiological rhythm; monitoring the response characteristics of the test signal to evaluate the electrode contact impedance and / or the detuning state of the hybrid analog filter network in real time; and providing a priori indication of the signal quality metrics based on the evaluated electrode contact impedance and / or detuning state.

[0038] This solution deeply integrates three main functions—phase distortion repair, signal reliability assessment, and hardware status self-diagnosis—into the host controller. It solves the phase error problem caused by analog filtering with extremely low computational cost. Simultaneously, by establishing confidence gating of the stimulus trigger signal and real-time monitoring of hardware status based on injection testing, it provides dual, multi-dimensional information assurance for the safety of precise closed-loop control and the timing accuracy of electrical stimulation triggering.

[0039] Optionally, the carrier signal generation module is configured to generate at least two intermediate frequency carrier signals such that the frequency difference is within a preset envelope frequency range, the preset envelope frequency range being between 0.1 Hz and 10 Hz; the closed-loop control module is further configured with a safety protection circuit for limiting the electrical stimulation current amplitude according to the carrier frequency, the safety protection circuit being configured to follow the following: when the carrier frequency is less than 2.5 kHz, the maximum current amplitude is less than 5 mA; when the carrier frequency is between 2.5 kHz and 5 kHz, the maximum current amplitude is less than 7 mA; when the carrier frequency is greater than 5 kHz, the maximum current amplitude is less than 14 mA; the closed-loop control module also includes a multifocal time-division multiplexing controller, configured to, when using multiple pairs of electrodes to perform time-interference electrical stimulation between multiple brain region targets, use a frequency band between 2 kHz and 5 kHz... The frequency rate is time-division multiplexed and polled between stimulation parameter configurations of multiple target points; the multi-focus time-division multiplexing controller further includes a rate limiter for generating a smooth ramp transition when switching target current amplitudes; the rate limiter gradually adjusts the current command value in a clock cycle higher than the polling rate with a preset fixed step, so that it smoothly transitions from the current amplitude to the target amplitude; the closed-loop control module further includes a blanking signal generator for generating a blanking signal during the transient period of each focus state switch, the generation of the blanking signal is synchronized with the start time of the focus state transition, and its duration at least covers the ramp transition period and the stable period required by the input stage of the analog-to-digital converter, the blanking signal is used to control the input stage of the analog-to-digital converter to enter a bypass or sampling hold pause state.

[0040] This technical solution integrates within a single system framework a frequency-specific strategy to promote deep sleep, a frequency-adaptive current limiting mechanism to ensure long-term safety, and the ability to achieve independent multi-target control without crosstalk or artifacts. It enables the system to provide precise and effective treatment while achieving a high degree of synergy in electrical safety and signal fidelity, thus providing triple assurance of efficacy, safety, and data quality.

[0041] Optionally, the wearable component also integrates a photoplethysmography (PPG) sensor including a red light emitter and an infrared light emitter, and an accelerometer, for collecting heart rate variability signals and body movement signals, respectively; the sleep staging module is configured to evaluate the quality indicators of the EEG signal, the heart rate variability signal, and / or the body movement signal, and dynamically select a decision path based on the quality indicators; wherein, when the quality indicator of the EEG signal is higher than a first threshold, the EEG features extracted from the EEG signal are used as the primary criterion; when the quality indicator of the EEG signal is lower than the first threshold, the weight of the EEG features is reduced, and features extracted from the heart rate variability signal and / or the body movement signal are introduced as alternative or supplementary criteria.

[0042] By integrating multimodal sensors into wearable components and endowing the staging module with dynamic decision-making path selection capabilities based on quality perception, this solution enables the system to intelligently avoid and rely on other redundant physiological information to maintain high-quality staging output when the quality of a single modality signal deteriorates due to electrode displacement or other interference. This combination of hardware redundancy and algorithmic adaptation significantly improves the system's functional robustness and decision reliability in complex sleep environments.

[0043] This invention addresses the inherent contradiction between strong electrical stimulation carrier waves and weak EEG signals by using a high-suppression-ratio hybrid analog filter network as the front end of the signal acquisition link, thus ensuring the acquisition of high-fidelity signal sources. Building upon this, the invention improves the accuracy and robustness of sleep staging and timing determination by introducing an unsupervised adaptive model running on resource-constrained processors and a phase repair and confidence assessment mechanism. Simultaneously, through the synergy of frequency band time-division multiplexing and hardware blanking, it achieves interference-free independent modulation of multiple deep brain regions. These technological elements work together to form a complete technical system from the physical layer and algorithm layer to the system control layer, enabling the entire sleep improvement electrical stimulation system to achieve therapeutic effectiveness, signal analysis accuracy, and long-term safety under the stringent conditions of completely local independent operation. Attached Figure Description

[0044] To more clearly illustrate the embodiments of this patent, the relevant drawings will be briefly described below. It should be understood that the drawings described below are only for illustrating some embodiments of this patent, and those skilled in the art can obtain many other technical features and connections not mentioned herein based on these drawings.

[0045] Figure 1 This is a schematic diagram of the hardware architecture of the closed-loop sleep improvement system provided in the embodiments of the present invention; Figure 2 This is a schematic diagram of the multifocal time-division multiplexing stimulus generation and blanking timing provided by an embodiment of the present invention; Figure 3 This is a flowchart of the multi-focus time-division multiplexing security interlocking logic provided in the embodiments of the present invention; Figure 4 This is a schematic diagram of the data flow and SRAM update of the unsupervised adaptive sleep staging algorithm provided in the embodiments of the present invention; Figure 5 This is a schematic diagram of the phase position reliability assessment and stimulus triggering logic provided in the embodiments of the present invention; Figure 6 This is a flowchart of EIT impedance monitoring and filter detuning self-diagnosis provided by an embodiment of the present invention; Figure 7This is a flowchart of the factory calibration rapid training and personalized background noise template generation provided by the embodiments of the present invention. Detailed Implementation

[0046] The patent will now be described in detail with reference to the accompanying drawings.

[0047] High-quality sleep, especially deep sleep (N3 stage) characterized by slow-wave activity, is crucial for memory consolidation, metabolic waste removal, and immune system repair. However, in modern society, due to factors such as stress, anxiety, and aging, a large number of people struggle to obtain sufficient deep sleep, and sleep disorders have become a widespread public health problem.

[0048] Early intervention methods mainly relied on drugs (such as benzodiazepines), which can forcefully induce sleep, but long-term use can easily lead to dependence and addiction, and can also disrupt the physiological structure of sleep, resulting in prolonged light sleep and a decrease in the proportion of REM sleep and deep sleep.

[0049] As a non-pharmacological alternative, physical stimulation techniques, particularly electrical stimulation, have garnered significant attention due to their lack of drug side effects. For example, a current practice employs traditional transcranial electrical stimulation (TCS), which alters the excitability of cortical neurons by placing electrodes on the scalp and applying low-frequency currents. However, because the conductivity of the skull is far lower than that of the brain's soft tissue, and current propagates along the path of least impedance, the current applied to the scalp diffuses and attenuates considerably before reaching the deeper brain regions. Its effective range is largely limited to superficial brain areas such as the cerebral cortex, making it difficult to effectively intervene in deep brain nuclei. Furthermore, many key regulatory centers for sleep regulation, such as the ventromedial prefrontal cortex, which is closely related to deep sleep, are located deep within the brain. Therefore, traditional TCS faces significant obstacles in targeting deep brain regions to improve deep sleep.

[0050] The advent of Temporal Interference (TI) electrical stimulation technology has broken through the technical bottleneck of non-invasive electrical stimulation reaching deep brain regions. Its basic principle is to apply two or more high-frequency (e.g., kilohertz) alternating currents with slight frequency differences to the scalp surface. These mid-frequency (defined as 1k-100kHz) currents, because their frequency far exceeds the neuronal response cutoff frequency, cannot directly excite cortical neurons. However, when they converge deep within the brain tissue, they produce an interference effect due to the superposition of electric fields, forming a low-frequency envelope modulated electric field with a frequency equal to the difference between the two current frequencies. By setting this envelope frequency in the slow-wave band (e.g., 0.1Hz to 10Hz) capable of modulating neural activity, non-invasive, targeted neuromodulation of deep brain regions (e.g., the ventromedial prefrontal cortex) can be achieved to promote deep sleep. This technology cleverly utilizes principles of physics to bypass the inherent limitations of traditional transcranial electrical stimulation techniques, such as the diffusion of current across the scalp and skull, making it difficult to precisely focus on deep targets.

[0051] However, applying temporal interferometry to closed-loop sleep improvement faces a significant physical challenge. To construct a truly closed-loop system, electroencephalogram (EEG) signals must be monitored simultaneously with electrical stimulation to assess sleep depth in real time and dynamically adjust stimulation parameters to ensure accuracy and safety. The problem lies in the fact that both the EEG electrodes used for signal acquisition and the stimulation electrodes used for application are deployed on the scalp, resulting in a high degree of spatial coupling. During temporal interferometry stimulation, the applied mid-frequency carrier signal typically has a current intensity of several milliamperes or even tens of milliamperes, creating a voltage drop of hundreds of millivolts on the scalp. In stark contrast, the EEG signal to be acquired has an amplitude of only a few to tens of microvolts. This leads to an extremely demanding signal coexistence scenario: within a single acquisition channel, a massive interference signal and an extremely weak target physiological signal are completely superimposed. If such mixed signals are directly fed into the subsequent amplifier, their huge dynamic range will cause the amplifier to saturate instantly, making the analog-to-digital converter unable to distinguish the microvolt-level EEG signals, resulting in the complete failure of the EEG acquisition function.

[0052] To resolve the frequency domain conflict between acquisition and stimulation, an intuitive approach is to leverage the fact that the carrier frequency of time-interference stimulation (e.g., 1kHz to 50kHz) is much higher than the EEG signal frequency band (e.g., 0.5Hz to 45Hz), filtering out carrier interference in the digital domain using a high-pass or band-stop filter. However, due to the extreme amplitude difference of over 100dB between the interference signal and the useful signal, any active circuitry before the analog-to-digital converter (ADC) must provide sufficient dynamic range. Even a conventional 24-bit ADC with a considerable dynamic range may not be sufficient to resolve sub-microvolt EEG signal details in the presence of millivolt-level interference. Therefore, a purely digital domain filtering approach cannot physically overcome the bottleneck of front-end saturation.

[0053] Another seemingly more direct approach is to use digital signal processing technology to synthesize a digital cancellation signal of equal amplitude and opposite phase before the interference enters the analog front end. This signal is then injected into the acquisition path via a digital-to-analog converter (DAC) in an attempt to "neutralize" the interference. However, due to the dynamic changes in the impedance of the human electrode-skin contact, establishing a precise, real-time, full-frequency interference mirroring system presents significant engineering challenges. Its cancellation effect is easily deteriorated by model mismatch, and may even introduce new non-stationary artifacts. For example, the quantization noise introduced by the limited resolution of a typical 12-bit DAC can reach tens of microvolts, enough to completely obscure the target EEG signal. More critically, the impedance of the human electrode-skin contact is not constant; it undergoes low-frequency dynamic drift with changes in the wearer's micro-movements, sweating, or skin condition. This means that the amplitude and phase of the interference signal to be canceled are themselves in a continuous and unpredictable state of flux. Any attempt to establish a precise, real-time, full-frequency "mirror" interference cancellation system is highly susceptible to collapse due to model mismatch, instead introducing even more difficult-to-handle non-stationary artifacts.

[0054] Furthermore, even if a clean EEG signal is obtained through some means, and the instantaneous phase of slow waves is extracted, the nonlinear phase distortion introduced by the analog front-end becomes a new obstacle. While high-order analog filters effectively attenuate intermediate frequency interference, they inevitably introduce a frequency-varying nonlinear phase shift into the EEG signal within the passband, especially for slow waves where phase information is crucial. This directly leads to a timing misalignment of closed-loop triggered electrical stimulation based on real-time phase estimation. In the worst case, inhibitory stimulation may be applied during the neuron's excitation period, or excitatory stimulation may be applied during the refractory period, which is not only ineffective but may even have adverse effects. Attempting to run a complex digital all-pass filter on a resource-constrained embedded microcontroller to correct this nonlinear phase distortion incurs unacceptable computational costs for wearable devices requiring long battery life.

[0055] In view of this, the embodiments of the present invention aim to provide a closed-loop sleep improvement system, method and related equipment, in order to fundamentally solve or at least partially alleviate the above-mentioned physical contradictions, that is, while applying high-intensity mid-frequency electrical stimulation, it is possible to reliably and non-destructively extract high-fidelity weak electroencephalogram signals, and based on this, to achieve precise, safe and environmentally adaptable closed-loop sleep regulation, thereby effectively improving the duration and quality of deep sleep.

[0056] Implementation Method 1 A first embodiment of the present invention provides a sleep-improving electrical stimulation system and method thereof. See also... Figure 1 As shown, the system includes a wearable component and a host controller electrically connected to the wearable component. The wearable component can be configured as a flexible headband structure suitable for wearing on the user's head during sleep, integrating acquisition electrodes for acquiring electroencephalogram (EEG) signals and stimulation electrodes for applying time-interference electrical stimulation to deep brain regions, and optionally integrating sensors for sensing user head movements and positional changes (e.g., a triaxial accelerometer and a photoplethysmography sensor). The host controller, as the core processing and control unit of the system, is physically separated from the wearable component to reduce head strain. It can be electrically connected to the wearable component via wired cable, Bluetooth, Wi-Fi, or other wireless communication protocols, and incorporates a microcontroller (MCU), signal processing links, stimulation signal generation links, and a battery module powering the various modules. In addition, the wearable component may optionally integrate an electrooculography (EOG) electrode connection interface for connecting electrodes placed around the eyes to collect electrooculography signals, thereby providing eye movement information for the subsequent multimodal sleep staging module to more accurately distinguish between rapid eye movement (REM) and non-rapid eye movement (NREM) sleep.

[0057] In this embodiment, the acquisition electrode and the stimulation electrode are designed as functionally independent types, which helps to minimize crosstalk between them. For example, the acquisition electrode for picking up EEG signals can be a dry electrode that does not require conductive gel or saline solution. This type of electrode makes direct contact with the scalp through dry conductive contacts, making it easy for the user to wear and clean. Its placement can be selected according to the international 10-20 system standard, for example, it can be placed in the prefrontal cortex and frontal pole regions such as AF7, AF8, FPZ, FP1, and FP2 to effectively capture EEG signals containing rich slow wave and spindle wave features. To improve the stability of signal pickup, the contacts of the acquisition electrode can be made of a conductive polymer with a certain degree of flexibility or an array of metal bumps coated with silver-silver chloride. Unlike the acquisition electrode, the stimulation electrode for delivering electrical stimulation can be a hydrogel electrode with high adhesion and low contact resistance. This type of electrode can conform to the small undulations of the skin surface, ensuring a stable and uniform current injection throughout the wearing period, avoiding discomfort or skin effects caused by local high impedance points. The placement of the stimulation electrodes is also based on the international 10-20 system standard. For example, electrodes forming the first electrical stimulation channel can be placed at positions AF3 and F1, and electrodes forming the second electrical stimulation channel can be placed at positions TP7 and TP9. This spatially cross-arranged layout allows the two mid-frequency currents to form an effective interference electric field in the deep target area. If different brain regions need to be modulated in practical applications, the stimulation electrodes can be adjusted to other positions.

[0058] The host controller internally constructs a signal acquisition link with extremely high dynamic range and strong anti-interference capability, connecting the acquisition electrodes to the microcontroller. The analog front-end of this acquisition link features a hybrid analog filter network, configured after the buffer stage of the acquisition electrodes and before the input of the analog-to-digital converter. The core function of this hybrid analog filter network is to perform step-by-step, deep physical attenuation of the high-intensity intermediate frequency carrier interference superimposed on the EEG signal in the analog domain, fundamentally preventing saturation of subsequent high-gain amplifiers or analog-to-digital converters.

[0059] Specifically, the hybrid analog filtering network can be constructed by cascading a pre-stage and a post-stage. The pre-stage can be a group of passive LCR notch filters, the structure of which can include multiple LCR series resonant notch filters. Each LCR series resonant notch filter can be precisely tuned to a specific intermediate frequency carrier frequency used for time-interference electrical stimulation. For example, when the system uses two intermediate frequency currents with carrier frequencies of 2kHz and 2.005kHz, two independent notch filters can be configured for each EEG acquisition channel, resonating at 2kHz and 2.005kHz respectively. This passive notch filter requires no power supply, and its series resonant state presents extremely low impedance to the target frequency, thereby bypassing most of the interference signal at that frequency to ground, while exhibiting high impedance to signals at other frequencies with minimal impact. To ensure that the notch filter can provide an extremely narrow and deep stopband trap, the inductor element in the notch filter can be a high-quality magnetically shielded wire-wound inductor with a Q value greater than 50 to reduce energy loss and magnetic field leakage. In a preferred implementation, the magnetically shielded wire-wound inductor can employ a closed-loop can core, confining its magnetic flux within the core. This effectively suppresses magnetic field coupling interference from external 50Hz or 60Hz power frequency magnetic fields on microvolt-level signals, while also reducing the impact of its own leakage flux on adjacent sensitive circuits. The capacitors in the notch filter can be C0G / NP0 ceramic capacitors with extremely low temperature coefficients and no piezoelectric effect, avoiding capacitance drift and perturbation noise caused by mechanical vibration or applied voltage changes. Furthermore, since passive LCR notch filters are highly sensitive to the termination impedance of external circuits, parasitic capacitance on the printed circuit board traces can cause a shift in the resonant frequency. Therefore, during actual board layout, the notch filter network should be placed as close as possible to the connector of the acquisition electrode, and differential routing should be used. Frequency consistency calibration before production can even be performed using laser trimming or a pre-set digital capacitor array during mass production.

[0060] After the initial targeted and deep attenuation of the known intermediate frequency (IF) carrier by the pre-stage passive LCR notch filter group, the subsequent stage of the hybrid analog filter network can be an active high-order low-pass filter. This filter is used to perform a steep secondary filtering of the residual, incompletely filtered IF components from the pre-stage filter, as well as the inherent broadband noise of the circuit. Preferably, this active filter can be designed as an 8th-order low-pass filter based on Bessel polynomials. The main purpose of choosing the Bessel topology is that this type of filter has the flattest group delay characteristic within its passband. This means that the relative time delay difference between different frequency EEG signal components is minimized after passing through the filter, thereby maximizing the protection of the phase information of the slow-wave EEG waveform without distortion. The -3dB cutoff frequency of this active filter can be set between 100Hz and 150Hz, for example, 120Hz, while its attenuation slope for the 2kHz frequency can reach more than -80dB / decibels, thus blocking most of the IF interference energy from the analog-to-digital converter. The core active device used in constructing this high-order active filter—the operational amplifier—must meet the stringent requirement of ultra-low noise floor, with its input voltage noise density configured to be less than 5 nV / √Hz. This is because the residual interference after strong attenuation in the preceding stage is relatively close to the amplitude of the microvolt-level EEG signal. If the noise floor of the active filter itself is not low enough, it will become a new significant noise source, directly drowning out useful physiological signals. Therefore, a chopper-stabilized precision operational amplifier can be selected, utilizing its extremely low 1 / f noise and broadband noise characteristics to ensure the overall signal-to-noise ratio of the signal link. Through the aforementioned hybrid architecture combining passive and active components, the entire hybrid analog filter network is configured to provide an overall physical attenuation capability of no less than 100 dB for the intermediate frequency carrier signal, which is sufficient to suppress strong interference with amplitudes up to hundreds of millivolts to the microvolt or even submicrovolt level, on the same order of magnitude as weak EEG signals.

[0061] The analog signal, after physical attenuation and purification by the aforementioned hybrid analog filtering network, is fed into an analog front-end chip specifically designed for bioelectrical signal acquisition for analog-to-digital conversion. This analog front-end chip can be specifically defined as a dedicated integrated circuit integrating a programmable gain amplifier and a 24-bit high dynamic range analog-to-digital converter. For example, it can use the ADS1299 series or a similar low-noise, multi-channel, synchronous sampling chip with compatible functionality. The programmable gain amplifier inside the chip can flexibly set the gain factor according to the amplitude of the front-end signal, for example, it can be set to 6x, 12x, or 24x, to condition the signal to the amplitude range most suitable for the quantization of the analog-to-digital converter. Its built-in analog-to-digital converter uses Σ-Δ modulation technology, combined with an internal digital decimation filter, which not only provides extremely high resolution but also has natural Sinc function filtering characteristics, which can form deep zeros at integer multiples of the Nyquist frequency, thereby enabling final and precise suppression of residual intermediate frequency interference that may generate image frequencies during sampling rate conversion. Ultimately, the chip outputs a high-fidelity 24-bit digital EEG signal stream to the microcontroller via digital interfaces such as serial peripheral interfaces, for use in subsequent sleep staging algorithms.

[0062] Understandably, the host controller can also integrate other core functional modules of the system. For example, a carrier signal generation module generates two or more intermediate-frequency digital carrier waveforms based on preset stimulation parameters, which are then converted into current signals via a digital-to-analog converter and a voltage-controlled constant current source to drive the aforementioned stimulation electrodes. A sleep staging module, whose input is connected to the output of the analog-to-digital converter, analyzes high-fidelity digital EEG signals in real time to identify the user's current sleep stage, such as wakefulness, N1, N2, N3 non-REM sleep, or REM sleep. A closed-loop control module, whose input is connected to the output of the sleep staging module and whose control output is connected to the control input of the carrier signal generation module, dynamically adjusts the on / off state of electrical stimulation and various parameters based on the identified sleep stage, thus forming a complete closed-loop circuit of signal acquisition, analysis, and control. The collaborative work of these modules enables accurate monitoring of sleep states and closed-loop control of deep brain regions even in environments with strong electromagnetic interference.

[0063] Implementation Method 2 Based on the above system architecture and method implementation, the sleep improvement electrical stimulation system and method of this embodiment further improves the generation and regulation module of electrical stimulation, aiming to achieve frequency specificity, safety protection and precise regulation without interference from multiple targets.

[0064] In this embodiment, the carrier signal generation module within the host controller can utilize the direct digital frequency synthesis engine within the microcontroller to generate digital sequences representing the waveforms of each intermediate frequency carrier in real time. These digital sequences are converted into analog voltage signals via independent high-speed digital-to-analog converters, and then converted into constant current with high output impedance by a subsequent voltage-controlled constant current source circuit. Finally, the voltage waveform command is applied to the corresponding stimulation electrode, thereby ensuring that the current injected into the brain tissue is not significantly affected by individual differences in skin impedance.

[0065] At the level of stimulation frequency configuration, in order to achieve targeted intervention of the slow-wave firing rhythm of neurons in the ventromedial prefrontal cortex (vmPFC) closely related to deep sleep, the closed-loop modulation module adjusts the frequency difference between two simultaneously applied intermediate-frequency carrier signals. This setting of the frequency difference range overcomes the conventional practice of using deep brain stimulation (DBS) frequency as a reference for traditional time-interference stimulation. Based on research into the electrophysiological characteristics of vmPFC neurons, this invention has found that they possess a wide action potential (>1 ms) and a slow firing frequency (0.1 Hz to 5 Hz), exhibiting irregular firing accompanied by bursts of activity. To match this and achieve effective modulation, the induced envelope frequency needs to cover their inherent firing rhythm.

[0066] Meanwhile, the system's built-in safety protection circuit automatically and dynamically limits the maximum permissible stimulation current amplitude according to the frequency band of the current output carrier frequency, fully adapting to the safety tolerance characteristics of human tissue at different frequencies. This frequency-related safety barrier is specifically configured as follows: when the carrier frequency is less than 2.5kHz, the peak current flowing through any stimulation electrode circuit is strictly limited to below 5mA; when the carrier frequency is between 2.5kHz and 5kHz, the peak current is limited to below 7mA; and when the carrier frequency is higher than 5kHz, the peak current is limited to below 14mA. For example, for a system actually operating at a 2kHz carrier frequency, even when the control command requires maximum output, its output current will be forcibly clamped to within 5mA by the hardware logic, physically eliminating the risk of tissue thermal damage or excessive nerve excitation that may result from control system program errors or improper parameter settings.

[0067] When the system is configured to simultaneously or alternately apply time-interference electrical stimulation to multiple deep brain regions using multiple pairs of electrodes, such as simultaneously modulating the left and right ventromedial prefrontal cortex, this embodiment provides a multifocal time-division multiplexing control mechanism to overcome nonlinear crosstalk and switching transient artifacts caused by the aliasing of multiple electric fields in the intracranial space. See also Figure 2As shown, the core of this mechanism lies in a multifocal time-division multiplexing state machine running within a high-precision timer interrupt service routine on a microcontroller. This state machine does not simultaneously activate stimulation configurations for all target areas. Instead, it rapidly switches between stimulation parameter configurations for multiple target areas at a polling rate much higher than the EEG signal frequency band and preferably falling within the ultrasound frequency band. This polling rate can be set between 2kHz and 5kHz, for example, to 2kHz. This is equivalent to transforming the spatially interfering multi-channel continuous wave stimulation into a finely segmented, sequentially alternating sequence of pulse waves. Since the membrane potential changes of a typical neuron are limited by its own resistance-capacitance time constant, which is typically on the order of 10 to 30 milliseconds, for kilohertz-level electric field switching with a rate of change far exceeding this time constant, the neuron cannot respond to each discrete switching event individually. Its membrane potential will "sense" the average effect of the electric fields of each target area within a time window. By utilizing the low-pass filtering characteristics of this neurophysiology, the system achieves concurrent and independent control of multiple deep target areas at the macroscopic level, while also shifting the originally harmful switching noise energy to the ultrasonic frequency band, so that it can be effectively filtered out by the mid-frequency stopband of the hybrid analog filter network described in Implementation Method 1 above.

[0068] To achieve this high-speed switching, the problems of broadband electromagnetic radiation and electrode charge accumulation caused by sudden changes in current command values ​​during the switching process must be addressed. To this end, a rate limiter is integrated into the multi-focus time-division multiplexing controller. When the state machine decides to change the stimulation current amplitude of one target region from its current value to the target value of another target region, the rate limiter does not directly write the target value into the register driving the digital-to-analog converter (DAC). Instead, within a local high-speed clock cycle much higher than the polling rate—for example, at a clock tick of 100 kHz—it gradually increases or decreases the digital current command output to the voltage-controlled constant current source in preset, small, fixed steps. This step can be set, for example, to 1 / 256 of the DAC's full scale. This process continues until the current output value smoothly ramps to the final desired target value. For example, a complete current amplitude switch might consist of a series of subtle steps within a short window of 10 microseconds, forming a smooth outward ramp rather than a voltage step that generates strong harmonics. This controlled soft transition suppresses intermediate-frequency harmonics and electromagnetic pulses caused by sudden current changes at the source.

[0069] However, even with a smooth transition limited by slew rate, weak perturbations may still be introduced into the highly sensitive EEG acquisition front-end at the moment of switching initiation and during the transition. If this perturbation happens to coincide with the sampling time of the analog-to-digital converter, it will manifest as a transient spike artifact. To completely eliminate such interference, this implementation further introduces a hardware-level blanking synchronization mechanism. The multifocal time-division multiplexing controller also includes a blanking signal generator that is strictly synchronized with the multifocal time-division multiplexing state machine. At the start of each focus configuration state transition, the blanking signal generator immediately generates a blanking pulse signal with a precise duration. The duration of this pulse signal is designed to at least completely cover the entire period during which the rate limiter completes the ramp transition, and additionally include the setup and settling time required by the subsequent analog-to-digital converter input stage. For example, its pulse width can be configured between 40 microseconds and 60 microseconds. The blanking pulse signal is directly connected to the blanking control pin of the bioelectric analog front-end chip. During the pulse's validity period, it controls the chip's input stage to enter a special bypass or sampling hold pause state. During this period, even if there are any disturbances in the front-end analog circuit caused by switching, the analog-to-digital converter's sampling capacitor will not track or quantize these instantaneous changes. Only when the blanking pulse ends and the analog front-end resumes normal sampling mode will the next analog-to-digital converter sampling clock edge convert the analog signal that has reached a stable state. Through this pixel-level stimulation-acquisition timing isolation, the acquisition of EEG signals is perfectly protected within the steady-state window between two focus switches, achieving uninterrupted and artifact-free acquisition of high-fidelity EEG signals while applying complex multi-target electrical stimulation.

[0070] It is worth noting that when the system simultaneously or time-divisionally applies temporal interference electrical stimulation to multiple brain target areas, there should be at least a 2kHz difference between the fundamental carrier frequencies used for stimulation of different target areas to avoid unintended interference between the stimulation channels. For example, when channels one and two for manipulating the first target area (such as the left vmPFC) use 2000Hz and 2001Hz carriers respectively, channels three and four for manipulating the second target area (such as the right vmPFC) need to use at least 4000Hz and 4001Hz carriers for differentiation.

[0071] Implementation Method 3 In the aforementioned second implementation method, a technical solution is provided to achieve artifact-free modulation of multiple target areas through kilohertz-level time-division multiplexing and soft transition blanking mechanisms. This solution can transform multiple electric fields that originally crosstalk each other in space into a sequence that alternates in time, and utilize the electrical low-pass characteristics of neurons to achieve concurrent and independent modulation at the macroscopic level. At the same time, through rate limiting and precise hardware blanking, it is ensured that the EEG acquisition is not contaminated by switching artifacts.

[0072] However, in long-term wear scenarios, the user's inevitable tossing and turning at night, sweating, or slight displacement of the headband can all cause dynamic changes in the contact state between the stimulation electrodes and the scalp. For example, local sweat seepage may cause a sharp drop in electrode contact impedance, forming an unexpected low-impedance current path, resulting in an abnormally high stimulation current density at that point, increasing the risk of discomfort or even skin burns. Similarly, a loose headband may leave an electrode in a nearly completely floating, high-impedance state. If the multi-focus time-division multiplexing state machine continues to output current commands to that channel according to the original timing sequence, the voltage-controlled constant current source will be unable to properly discharge current, causing its output voltage to be momentarily pushed to the power rail. This could trigger hardware protection, and the recovery process may also generate an interference pulse in the common-ground circuit, contaminating the synchronously acquired EEG signals.

[0073] In view of this, this embodiment further improves the control logic for multi-focus time-division multiplexing in Embodiment 2. See also Figure 3 As shown, the main improvement is that a high-speed security detection step implemented by hardware or underlying firmware is forcibly inserted before the multi-focus time-division multiplexing state machine executes each target area configuration switching instruction. This step is independent of the main control firmware query cycle.

[0074] Specifically, within the host controller, the high-precision timer interrupt service routine synchronized by the blanking signal generator, in addition to running the multi-focus time-division multiplexing state machine and rate limiter logic described in Implementation Method 2, also incorporates a safety interlock module. Before the timer interrupt service routine updates the state machine to the next target configuration and initiates a new round of blanking and soft transition sequences, the safety interlock module proactively initiates a real-time status query for all relevant stimulation electrodes it manages. This query does not wait for the slow-speed polling in the main loop of the host firmware, but directly reads flag bits from the status register at the hardware front end. These status flag bits originate from the electrode impedance monitoring circuit and lead detachment detection module at the system front end. For example, as mentioned in Implementation Method 1, the system can achieve real-time calculation of an impedance modulus at the hardware level by continuously injecting a weak pseudo-random test signal unrelated to any physiological rhythm into the electrode and simultaneously monitoring its response characteristics. When the calculated contact impedance value exceeds the preset safety range, for example, if the impedance is higher than 100kΩ (indicating poor contact or detachment) or lower than 100Ω (indicating a possible sweat short circuit), a corresponding hardware comparator will immediately set a fault flag. Similarly, the lead detachment detection module built into the bioelectric analog front-end chip can also continuously monitor the DC-to-ground impedance of the electrode by applying a weak pull-up or pull-down current, and set a detachment flag when the electrode is completely detached from the skin.

[0075] After the safety interlock module acquires these status flags, it executes a very brief judgment logic. This logic checks whether all status flags associated with the pair or more stimulation electrodes to be activated in the next time slot indicate normal operation. The transition to the next focal state is only permitted if the contact impedance of all relevant electrodes is determined to be within the preset safety range and no lead detachment event is reported. The multifocal time-division multiplexing state machine then updates normally to the next state and triggers the blanking and soft transition procedures as usual. Conversely, if the status flag of any involved electrode indicates an anomaly, the safety interlock module immediately hard-locks the current state update. This means the state machine maintains the previously known safe configuration and does not issue any new amplitude commands to the digital-to-analog converter and voltage-controlled constant current source, thus eliminating the possibility of directing current to unreliable paths under fault conditions. Meanwhile, a safety anomaly will be reported to the main control firmware for subsequent decision-making, such as attempting a low-frequency electrode impedance rescan, issuing a user prompt, or completely shutting down the stimulation output of the current target area in the event of a series of failures.

[0076] It is worth noting that the injection of the "pseudo-random test signal" and the "blanking" operation of the acquisition link are synchronized in time. The system firmware ensures that the injection frame of the test signal is synchronized with the sampling frame of the ADC, and the injection of the test signal is also paused during the blanking period. This time synchronization mechanism can guarantee zero interference between the test module and the acquisition module.

[0077] Compared to Implementation Method 2, which does not perform such real-time hardware state interlocking before switching, this implementation method preemptively prevents stimulation state transitions that pose functional safety risks due to any potential changes in mechanical or physiological contact conditions by performing nanosecond-level speed matching and safe closed-loop locking of the switching action enable signal with the high-bandwidth monitoring state from the physical layer electrode level. This improvement provides the system with an additional intrinsically safe firewall based on hardware prior information, building upon the zero artifacts and zero crosstalk achieved in Implementation Method 2. This ensures that the accuracy and absolute safety of closed-loop control are reliably guaranteed even under extremely complex and non-ideal wearing conditions.

[0078] Implementation Method 4 This embodiment proposes further improvements to the sleep improvement electrical stimulation system and method described in the foregoing embodiments. Specifically, this embodiment further improves robustness on resource-constrained embedded microcontrollers.

[0079] The unsupervised adaptive multimodal sleep staging module serves as the sensing core of the closed-loop control system in this application's technical solution. Its input end receives high-fidelity multi-channel digital signals from the analog-to-digital converter, while its output end provides the closed-loop control module with the identified current sleep stage and the associated staging confidence level.

[0080] To enable independent operation on the microcontroller within the host controller, in this embodiment, the core implementation of the sleep staging module is a lightweight neural network model. This model can be configured to solidify all its learnable structural parameters after training. For example, the backbone network of the model can employ a combination of one-dimensional depthwise separable convolutions and dilated convolutions, compressing the total number of parameters to a level suitable for storage in tens of thousands of bytes of Flash ROM while maintaining sufficient feature extraction capabilities. To ensure the capture of the dynamic evolution of sleep stages, a temporal processing module, such as a simplified one-dimensional temporal convolutional network or a gated recurrent unit, can be cascaded at the end of the model. This module receives a feature sequence composed of multiple short-term sub-windows and outputs the final classification probability corresponding to a long-term stage. In a non-limiting example, the system segments continuous multi-channel EEG signals, heart rate variability, and acceleration signals into preset short-term sub-windows, for example, the length of each sub-window can be set to 5 seconds. Then, multidimensional features are extracted for each sub-window, including: the relative energy of the EEG signal in the δ (0.5-4Hz), θ (4-8Hz), α (8-12Hz), and β (12-30Hz) frequency bands; the root mean square value, variance, and zero-crossing rate in the time domain; and a low-dimensional embedding representation obtained directly from the original signal segment through a pre-trained convolutional subnetwork. For heart rate signals, the system can extract features such as the root mean square of the difference between adjacent sinus beat intervals and the low-frequency to mid-frequency power ratio from a continuous sequence of heartbeat intervals. For acceleration signals, its vector amplitude is calculated as a measure of motion intensity.

[0081] To address the widespread problem of non-stationary baseline drift in EEG signals caused by individual differences or variations in electrode contact status, see [link to relevant documentation]. Figure 4 As shown, this implementation employs a unique unsupervised, gradient-free online adaptive mechanism, replacing traditional supervised fine-tuning. In this mechanism, all learnable weights and biases of the convolutional and temporal layers constituting the lightweight neural network are permanently frozen after factory training and stored in the microcontroller's read-only Flash memory, remaining unchanged throughout the device's lifetime. In contrast, the runtime statistics (e.g., mean and variance) used by all feature normalization layers in the model to standardize input features are maintained in a completely dynamic manner. Upon device power-on initialization, the initial values ​​of these statistics are loaded from Flash into a specially allocated buffer within the microcontroller's high-speed static random access memory (SRAM). This buffer can be statically allocated to no more than a few kilobytes, such as 4KB, and is monitored by a memory protection unit to prevent stack overflows from damaging it.

[0082] While the system continuously runs and acquires high-confidence multimodal data in real time, an online adaptive module works in parallel in the background, updating these operational statistics stored in SRAM according to specific conditions. The core of the update is an exponential moving average formula, whose smoothing coefficient is designed as a variable that can be dynamically modulated based on various internal and external states perceived by the system. Specifically, this smoothing coefficient can be determined by a composite function: it is directly gated by a gating factor strongly correlated with the signal quality index of the hardware front-end output. For example, when the signal quality index indicates that the current EEG signal is pure and the electrode contact impedance is stable (e.g., a comprehensive evaluation exceeding a normalized threshold of 0.8), the gating factor tends towards 1, allowing the update; conversely, when a sudden body movement artifact or impedance instability is detected, the gating factor rapidly decays to near 0, directly freezing the update operation. Simultaneously, the smoothing coefficient is also correlated with the current real-time sleep staging results. During deep sleep (N3 stage), when EEG signals are most stable and their characteristic distribution is most typical, the system can employ a relatively high baseline smoothing coefficient (e.g., approximately 0.8) to encourage the model to actively learn the individual's stable baseline at this time. However, during REM sleep or wakefulness, due to the variable signal patterns, this coefficient is reduced to a very low level (e.g., 0.1) to maintain the robustness of existing statistics and avoid contamination by uncertain states. Furthermore, an indicator reflecting signal complexity, such as the spectral entropy of the EEG signal, can be introduced for further modulation. When the spectral entropy is low, indicating a highly ordered and stable signal, the update rate can be moderately amplified; conversely, it is suppressed. This multidimensional modulation design enables the adaptive process to resist artifacts and possess the ability to deeply perceive sleep microstates.

[0083] To further monitor whether the feature distribution has experienced excessive drift beyond expectations that could potentially damage the model's classification boundary, the system can also be configured with a lightweight distribution drift measurement module. This module can periodically, for example, after each long-term segmentation unit inference, calculate the distance between the distribution formed by the feature vectors of the current batch and the old distribution defined by the running statistics recorded in the current BN layer. To minimize computational overhead, the system does not calculate the exact Wasserstein distance. Instead, it first maps the high-dimensional feature map to a very low-dimensional space through a pre-generated, fixed random Gaussian projection matrix, for example, directly reducing the dimensionality to a scalar, and then estimates the distribution distance of that scalar. This very low-cost estimate can be used as auxiliary information, combined with the aforementioned smoothing coefficient, to fine-tune the update step size in the direction of reducing distribution discrepancies. Furthermore, as a final safety barrier, the system also incorporates a circuit breaker mechanism. It continuously monitors the cumulative L2 norm change of the running mean of each BN layer in the SRAM relative to its factory initial value. Once the cumulative change in any layer exceeds a preset standard deviation threshold (e.g., three times the standard deviation of the layer's mean obtained through large-scale data calibration at the factory), a circuit breaker will be immediately triggered. It automatically locks any further updates to the statistics of that layer, forces its mean and variance to roll back to their initial factory values, and reports a safety event to the main control system, ensuring that the model will not suffer catastrophic consequences such as a breakdown of its discriminative function even under extreme disturbances.

[0084] To maintain uninterrupted and highly reliable staging even in complex situations where the quality of a single modality signal deteriorates, the sleep staging module in this embodiment can also perform a dynamic decision-making path selection driven by signal quality among signal features of multiple modalities. The module calculates the quality index for each signal, such as EEG, heart rate variability, and acceleration, in real time. These indicators can comprehensively evaluate information such as signal stability, noise ratio, data integrity, or lead dropout status. When the quality index of the EEG signal, which is the primary component, is higher than a preset first threshold after comprehensive evaluation, the system will make a staging decision mainly based on the multidimensional features extracted from the EEG signal and their embedded representations. Once the quality of the EEG signal falls below the threshold for any reason, the decision logic is not simply shut down. Instead, the contribution weight of the EEG features is smoothly reduced, and features extracted from the heart rate variability and acceleration signals are dynamically and synchronously introduced. These auxiliary modal features, together with the remaining, still valid EEG features, constitute a new, alternative feature space, which is then sent to the temporal inference module. In extreme cases, if the EEG signal completely fails, the staging module can even degenerate into a discrimination mode that relies purely on heart rate variability and body movement signals. This fundamentally achieves self-healing low-performance degradation when the sensing mode fails, ensuring the continuity and safety of closed-loop regulation.

[0085] Implementation Method 5 This embodiment proposes further improvements to the sleep improvement electrical stimulation system and method described in the foregoing embodiments. Specifically, this embodiment aims to solve the nonlinear phase distortion problem introduced by the high-order filtering network of the analog front end, and provides a complete, self-diagnostic signal quality assessment system, including methods and modules.

[0086] In the aforementioned implementation method one, to physically attenuate intermediate frequency carrier interference of up to several hundred millivolts before analog-to-digital conversion, a hybrid analog filter network consisting of a high-Q passive LCR notch filter array cascaded with an 8th-order active low-pass filter was constructed at the analog front end. This network, through carefully designed amplitude-frequency characteristics, achieved out-of-band suppression exceeding 100 dB. However, any physical filter, while achieving steep amplitude-frequency attenuation, inevitably introduces a frequency-varying phase delay, i.e., a nonlinear group delay, within its passband. For EEG slow waves with frequency components mainly concentrated between 0.5 Hz and 4 Hz, different frequency components will experience different time delays after passing through this filter network, causing distortion of the synthesized slow wave waveform on the time axis, particularly manifested as shifts in key zero-crossing positions and peak times. If this phase-distorted slow wave signal is directly used to extract its instantaneous phase through an algorithm and trigger time-interference electrical stimulation accordingly, the stimulation pulse will not accurately fall on the desired neuronal excitation or inhibition phase, thus weakening the modulation effect. Traditionally, this nonlinear phase can be balanced by designing a digital all-pass filter, but this method requires considerable microcontroller computing resources to perform the convolution operation, which is detrimental to the low power consumption and real-time performance of the device.

[0087] To address this core challenge of phase distortion with extremely low firmware overhead, refer to Figure 5 As shown, this embodiment further employs an original strategy combining offline fixed group delay compensation with online phase position confidence fuzzy decision-making. During the automated testing phase before the device leaves the factory, a group delay calibration procedure is executed. The test fixture sequentially injects a series of low-frequency sinusoidal test signals with known initial phases into the input of each EEG signal acquisition channel, for example, signals with frequencies of 1Hz, 2Hz, and 5Hz. Simultaneously, the complete acquisition and phase extraction link is acquired and run. By comparing the zero-crossing times of the injected signals with the zero-crossing times corresponding to the original instantaneous phase output by the frequency-locked loop algorithm, the average fixed group delay applied by the channel's analog front end to the entire slow-wave frequency band is accurately calculated. This fixed group delay constant is used as an inherent device parameter; for example, its calibration result may be 20 milliseconds, and it is burned into the microcontroller's Flash read-only area for subsequent real-time calculations.

[0088] During device wear and real-time operation, a second-order generalized integrator-frequency-locked loop (FCL) serves as the core of the slow-wave tracking algorithm, deployed in the microcontroller firmware. This algorithm takes a high-fidelity EEG signal, bandpass filtered (e.g., 0.5Hz to 4Hz), as input and outputs four key real-time variables: the original instantaneous phase, the locked slow-wave instantaneous frequency, the amplitude of a pair of orthogonal signal components, and the frequency-locking error index. Subsequently, the phase compensation angle calculation unit uses the real-time locked slow-wave instantaneous frequency and a pre-stored fixed group delay to perform one multiplication and one addition operation to calculate a phase compensation angle, which is equal to 2π multiplied by the instantaneous frequency and then multiplied by the fixed group delay. By directly adding this compensation angle to the original instantaneous phase, a corrected instantaneous phase that approximates the actual cortical EEG signal is obtained. For example, when the locked instantaneous frequency is 1Hz and the fixed group delay is 20 milliseconds, the calculated compensation angle is approximately 7.2 degrees. This corrected phase can then serve as the phase basis for micro-closed-loop triggering of electrical stimulation.

[0089] However, when the EEG waveform itself undergoes severe deformation, such as at the instant of a sudden slow wave initiation, or when the frequency-locked loop temporarily loses lock due to transient interference, the corrected phase information is unreliable even with fixed compensation. Therefore, this implementation further constructs a phase position reliability assessment mechanism. This mechanism comprehensively evaluates the amplitude of the orthogonal signal output by the frequency-locked loop and the frequency locking error. When the amplitude is consistently below a preset minimum threshold, for example, when the corresponding peak-to-peak value of the original signal is less than 1 microvolt, it indicates that the signal energy is too weak and may be dominated by noise; or when the frequency locking error significantly exceeds a preset threshold, for example, exceeding ±0.2 Hz, it indicates that the frequency-locked loop cannot stably track a single oscillatory rhythm. In these cases, a phase position reliability flag will be set to "low". The stimulation triggering logic of the micro-closed loop is designed as an AND logic: a stimulation pulse sequence will only be released when the global stimulation enable flag is "true", the phase position reliability flag is "high", and the corrected instantaneous phase falls within a predefined "rising state" phase window (e.g., a specific phase interval representing the imminent firing of a neuronal cluster). Otherwise, even if other conditions are met, as long as the phase is unreliable, the triggering of the micro-loop will be safely shielded, and the system will degenerate into a mode that relies solely on robust decisions from the macro-loop. This fuzzy evaluation of reliability based on the signal's own algorithmic state proactively eliminates potential erroneous triggering events, elevating the security of closed-loop control to a new level.

[0090] In addition to fixing phase distortion in the analog link, refer to Figure 6As shown, this embodiment also provides an online self-diagnostic method for comprehensively sensing the physical state of front-end hardware, aiming to endow static passive analog filter networks with semi-adaptive environmental sensing capabilities. The implementation of this method relies on injecting an extremely weak pseudo-random test signal I, unrelated to any physiological rhythm, into the user through existing electrodes. test The amplitude of the test signal can be carefully controlled between 1 microamp and 10 microamps, far below the sensory threshold and any safety limits, and its spectrum is designed to be distributed in an unrelated frequency band outside the EEG band, for example, a pseudo-random sequence with a center frequency of 1 kHz and a bandwidth of approximately 100 Hz. A dedicated weak current source, which can be implemented by the output of a microcontroller digital-to-analog converter after high-voltage buffering and current limiting, or by a lead detection current source integrated within the bioelectric analog front-end chip, is periodically or continuously coupled to the designated stimulation or acquisition electrodes.

[0091] Meanwhile, one or more analog-to-digital converter channels in the bioelectric analog front end are allocated to synchronously monitor the voltage V generated by the test signal at the electrode-tissue interface. meas Response. Utilizing the known injected current signal pattern and synchronously acquired voltage data, the impedance calculation module within the firmware performs a fast Discrete Fourier Transform or quadrature demodulation to calculate the complex impedance magnitude and phase at the test signal frequency in real time. For example, the magnitude Z of the electrode contact impedance can be obtained. contact and phase ∠Z. This impedance magnitude is continuously compared to a preset safety range, for example, a reference range. Figure 3 As shown, a typical normal range may be defined between 100 ohms and 50 kiloohms. Once the impedance exceeds this range, it not only directly serves as a high-bandwidth indicator of electrode contact quality deterioration and is fed forward to the signal quality index (SQI) fusion module in Implementation Method Four, but can also trigger the stimulation safety interlock mechanism described in Implementation Method Three.

[0092] Furthermore, in this embodiment, based on the real-time calculated electrode contact impedance, the risk of passive filter network detuning due to impedance changes can be inferred. The principle is that the actual resonant center frequency of a passive LCR notch filter is extremely sensitive to its termination impedance. Changes in the scalp contact impedance alter the network termination conditions of the notch filter, causing its actual notch frequency to deviate from the initial tuning value. During factory calibration, a mapping model or lookup table of "termination impedance - notch frequency shift" can be established by systematically changing the termination impedance and measuring the notch filter output, and then embedded in the microcontroller. During real-time operation, the impedance magnitude output by the impedance calculation module is input into this model to evaluate the current center frequency drift Δf of each notch filter in real time. notch Once the drift amount Δf is evaluated...notch If the notch filter's stopband width exceeds a preset proportion, for example, half of its half-power bandwidth, a "filter detuning" warning flag will be set. This warning, as a key priori component of signal quality, provides crucial hardware health feedback to the upstream adaptive phasing module and closed-loop control module, enabling them to anticipate the nature of any residual microcarrier interference in the currently acquired signal due to incomplete filtering, thus allowing for more robust decision-making. Through this online impedance tomography self-diagnosis technology based on pseudo-random test signal injection, the system achieves real-time monitoring of its own simulated front-end physical health, upgrading the traditionally "static" passive network into a state-aware "semi-static" adaptive front-end. This provides a solid technical guarantee for the stable operation of the system in complex and ever-changing real-world wearing scenarios.

[0093] Implementation Method Six This embodiment proposes further improvements to the sleep-improving electrical stimulation system and method described in the foregoing embodiments. Specifically, this embodiment improves the safety strategy for optimizing the closed-loop sleep regulation process, focusing on constraining the timing and total amount of electrical stimulation from a higher dimension to ensure that stimulation is only allowed to be initiated after sleep homeostasis has been fully established, and to implement rigid safety limits on the total stimulation amount throughout the sleep cycle.

[0094] In the closed-loop control system described in the preceding embodiments, the macroscopic closed-loop decision logic can determine whether to allow the application of time-interventional electrical stimulation based on real-time sleep stage results. However, if stimulation is initiated immediately based solely on instantaneous stage results, such as once the user is detected to have transitioned from wakefulness to light sleep (N1 stage), there is a risk of disrupting the normal sleep process. The N1 stage in the early stages of sleep is a transitional state between light sleep and wakefulness, and is highly sensitive to external stimuli. Premature intervention may cause the user to be awakened before consolidating sleep, thereby impairing overall sleep efficiency.

[0095] In view of this, this embodiment introduces a stimulus initiation delay strategy based on sleep homeostasis confirmation. The system maintains a homeostasis determiner in its firmware, which continuously receives the identification results of each stage unit output by the sleep stage module. When the system detects that the user has entered any non-rapid eye movement (NREM) sleep stage for the first time (e.g., N1 or N2 stage), the determiner does not immediately authorize stimulation, but instead starts a timer to accumulate the consecutive stage units experienced. The stimulus enable flag is only set when the user continuously maintains a stable NREM sleep state during this period (i.e., consecutive stage results are all displayed as N1 or N2 stages, and no awakening or NREM sleep stages occur in between), and the duration of this stable state accumulates to exceed a preset threshold.

[0096] The duration threshold is designed to provide a physiological buffer window between falling asleep and entering a stable sleep state. This threshold can be pre-configured within a reasonable range, for example, from 2 to 5 minutes. In a non-limiting example, the threshold could be specifically set to 3 minutes. This corresponds to six consecutive 30-second phases, each classified as either N1 or N2. This waiting window allows the system to distinguish between brief sleep attempts and genuine, stable sleep segments, thus precisely targeting the electrical stimulation during the period when the brain has the potential to generate deep sleep, while excluding the initial sleep stages that may fluctuate under external disturbances.

[0097] Furthermore, this implementation strategy incorporates dual safety barriers regarding both the total stimulation dose and the duration of stimulation. The system records the user's fall asleep time using its internal real-time clock, which can be defined as the start of the first continuous non-rapid eye movement (NREM) sleep phase. The system is then configured to allow electrical stimulation only within a preset time window following this fall asleep time. For example, this time window could be set to the first four hours. This design is based on physiological considerations: the first half of the night is the period of highest concentration of deep sleep and greatest neuronal plasticity; stimulation thereafter is not only less efficient but may also excessively disrupt the REM-dominated sleep structure of the second half of the night.

[0098] Simultaneously, a stimulation duration accumulator precisely accumulates the total duration of actual electrical stimulation from the first stimulation pulse. Once this accumulated duration reaches a preset upper limit for total stimulation duration, such as 60 minutes, the system will forcibly shut down all stimulation outputs regardless of the current sleep stage or whether it is still within the preset time window, and will only maintain signal monitoring functionality for the remainder of the night. Through this dual upper limit management based on both time windows and total accumulated duration, this implementation fundamentally eliminates potential risks such as sleep structure disorder, receptor desensitization, or residual effects the following day caused by overstimulation at the system strategy level, providing a robust physical-strategy dual firewall for the user's long-term safety.

[0099] Implementation Method Seven This embodiment proposes further improvements to the sleep improvement electrical stimulation system and method described in the foregoing embodiments. Specifically, in the automated testing phase before the devices leave the factory, this embodiment uses a rapid training mechanism to generate a personalized feature distribution background noise template for each device, aiming to optimize the user experience during initial use and ensure the consistency of batch products.

[0100] The online unsupervised adaptive sleep staging algorithm provided in the aforementioned Implementation Method 4 aligns with the individual EEG feature distribution of the current user by continuously updating the running statistics of the normalized layer using an exponential moving average within a preset SRAM buffer. This adaptive process begins with a set of factory default values, typically derived from the global statistics of the large-scale dataset used during model training. Due to inherent differences in individual EEG baselines, these global default values ​​require a period of wear and data accumulation to gradually converge to a state matching the current individual; this convergence period may span the first few sleep cycles of the user's first use. To eliminate this adaptation delay and enable the device to provide high-accuracy sleep staging results upon initial use, see [link to relevant documentation]. Figure 7 As shown, this embodiment proposes a customized factory calibration strategy performed at the end of the production line.

[0101] In this strategy, an automated testing fixture can be deployed on the production line. This fixture includes a precision signal generator capable of simulating typical sleep EEG characteristics, and a custom-designed test fixture for connecting to the motherboard acquisition terminal of the device under test (DUT). During the final PCBA (Printed Circuit Board Assembly) testing phase, the testing fixture injects a pre-synthesized standard composite EEG signal, approximately 3 minutes in duration, into the EEG acquisition channel of the DUT. This signal is not a simple sine wave, but rather incorporates waveforms simulating EEG characteristics of different individuals at different sleep depths. For example, it can include an amplitude-modulated signal with a center frequency of 0.8Hz exhibiting typical high-amplitude slow-wave characteristics of deep sleep, or a short pulse train with a center frequency of 12Hz simulating spindle waves of light sleep. Simultaneously, simulated eye movement artifacts and electromyographic interference can be injected into the model's robustness. Simultaneously, stable, low-noise signals simulating a resting state can also be injected into the input terminals of the acceleration and heart rate channels, respectively.

[0102] Simultaneously, the device's factory firmware is configured to enter a fast training mode upon detecting a tooling start signal. In this mode, the adaptive module described in Implementation Method 4 is forcibly activated, but its operating parameters are configured to accumulate statistics at a rate much higher than during normal use. For example, the typical value of the base learning rate during normal use can be set around 0.01, while in fast training mode, this learning rate can be temporarily increased to 0.1. The system uses this 3-minute standard signal to continuously perform inference and rapidly update the running mean and running variance of all normalized layers in SRAM using the exponential moving average formula. A convergence determination logic continuously monitors changes in these statistics; for example, it can calculate the rate of change of the mean vector within the most recent 30-second window. When this rate of change stably drops to a preset extremely low threshold, such as below 1%, it is determined that the device's statistics have reached a steady state adapted to the current input signal.

[0103] At this point, the test fixture sends a calibration completion command to the device via the communication interface. The microcontroller firmware then responds, programming the normalized layer running mean and variance data, which have now reached a steady state in the SRAM, into a dedicated, factory-customized noise floor template. This template is stored in a separate read-only area in the Flash memory, isolated from the main firmware program area and user data area. Subsequent firmware upgrades, such as OTA updates, will be designed to retain this block of data without overwriting it. When the user finally receives the device and boots it up for the first time, the initialization program will first load this dedicated factory noise floor template from the Flash memory into the SRAM buffer, replacing the general global mean obtained from the training server, as the starting baseline for the online adaptive module. This means that for the user, the starting point of the device's characteristic distribution is no longer the average of the population, but rather a physical benchmark that has been calibrated with a standard sleep signal and reflects the noise floor and signal characteristics of this specific hardware simulation path. The online adaptive process simply involves fine-tuning the remaining real physiological differences between individuals on this solid foundation, enabling the model to achieve a high level of accuracy that is essentially ready to use out of the box. This greatly shortens the adaptation period for first-time wear and improves the user experience from the very first night.

[0104] Furthermore, this strategy also brings significant quality control gains to large-scale production. Because the noise floor spectrum of different batches of analog components, and even different operational amplifier chips within the same batch, exhibits discreteness at a minute scale, this leads to a fixed bias in the digitized characteristic distribution of different devices when faced with the exact same input signal. By injecting the same standard signal into each device on the production line and independently calibrating its own noise floor template, this hardware deviation is effectively normalized to the algorithm level before shipment. The factory's quality department can also check whether the various statistics of this noise floor template fall within a distribution range characterized by normal hardware conditions, established in advance through a large number of samples. If a device's template shows a significant outlier, it can serve as another sensitive means of screening defective analog devices, intercepting products with potential performance defects in advance, thereby ensuring that the products ultimately delivered to every user have highly consistent and excellent performance.

[0105] Finally, it should be noted that those skilled in the art will understand that many technical details have been presented in the embodiments of this patent to facilitate a better understanding of the invention. However, even without these technical details and various variations and modifications based on the above embodiments, the technical solutions claimed in the claims of this patent can be substantially achieved. Therefore, in practical applications, various changes can be made to the above embodiments in form and detail without departing from the spirit and scope of this patent.

Claims

1. A method for improving sleep through electrical stimulation, characterized in that, include: Generate at least two intermediate frequency carrier signals for electrical stimulation; Electrical stimulation is applied, and an electroencephalogram (EEG) signal superimposed with the intermediate frequency carrier signal is simultaneously acquired through electrodes; The EEG signal is passed through a hybrid analog filter network to physically attenuate the superimposed intermediate frequency carrier signal in the analog domain; The electroencephalogram (EEG) signal was converted from analog to digital. Based on the signal after physical attenuation and analog-to-digital conversion, the current sleep stage is identified; The electrical stimulation parameters are adjusted based on the identification results of the sleep period.

2. The method according to claim 1, characterized in that, The regulation of the electrical stimulation parameters includes: regulating the frequency difference of the at least two intermediate frequency carrier signals generated to make them fall within a preset envelope frequency range; The preset envelope frequency range is between 0.1 Hz and 10 Hz to match the firing frequency of neurons in the ventromedial prefrontal cortex.

3. The method according to claim 1, characterized in that, The intensity of the electrical stimulation satisfies: When the carrier frequency is less than 2.5kHz, the maximum current amplitude is less than 5mA; When the carrier frequency is between 2.5kHz and 5kHz, the maximum current amplitude is less than 7mA; When the carrier frequency is greater than 5kHz, the maximum current amplitude is less than 14mA.

4. The method according to claim 1, characterized in that, The regulation of the electrical stimulation parameters includes: when using multiple pairs of electrodes to perform time-interference electrical stimulation between multiple brain region target points, switching between the stimulation parameter configurations of multiple target points at a mid-frequency rate; The intermediate frequency rate is in the frequency band from 2kHz to 5kHz; When switching the target current amplitude, a controlled slew rate limit is implemented to produce a smooth ramp transition; the controlled slew rate limit is implemented by a rate limiter that gradually adjusts the current command value in a clock cycle higher than the polling rate with a preset fixed step, so that it smoothly transitions from the current amplitude to the target amplitude. During the transient period of each focus state switch, a blanking signal is generated to temporarily freeze the input stage of the ADC performing the analog-to-digital conversion; The generation of the blanking signal is synchronized with the start time of the focus state transition, and its duration covers at least the time period of the ramp transition and the stable time period required by the ADC input stage. The freeze operation controls the input stage of the ADC to either enter a bypass state or remain in a paused sampling state via the blanking signal.

5. The method according to claim 1, characterized in that, In the step of identifying the current sleep stage, the identification is based on a lightweight neural network model running on the host controller; The lightweight neural network model includes at least one normalization layer, the runtime statistics of which are configured to be updated online in unsupervised memory of the host controller, while the convolutional layer weights of the lightweight neural network model remain frozen during the update.

6. The method according to claim 5, characterized in that, The operational statistics are updated using the exponential moving average (EMA) formula; The exponential moving average formula includes a smoothing coefficient α(t); The smoothing coefficient α(t) is dynamically modulated based on the signal quality metrics derived from the hardware front end and / or the current sleep staging results.

7. The method according to claim 6, characterized in that, The method further includes: When the cumulative change of the operating statistic within a single usage period exceeds a preset standard deviation threshold, the update will automatically stop and the operating statistic will be rolled back to its initial value.

8. The method according to claim 1, characterized in that, Before identifying the current sleep stage, the method also includes: Obtain the fixed group delay introduced by the analog front end that physically attenuates the EEG signal; A phase compensation angle is calculated using the slow wave frequency of the EEG locked in real time by the frequency-locked loop and the fixed group delay; Based on the phase compensation angle, the instantaneous phase extracted from the slow EEG is biased and corrected to obtain the corrected instantaneous phase.

9. The method according to claim 8, characterized in that, The method further includes: The confidence level of the corrected instantaneous phase is evaluated, and the electrical stimulation is allowed to be triggered based on the corrected instantaneous phase only when the confidence level is higher than a preset threshold. The confidence level is evaluated based on the amplitude of the frequency-locked loop output, the frequency locking error, and / or the signal quality indicators.

10. The method according to claim 9, characterized in that, The signal quality metrics include at least one of signal stability, noise ratio, or data integrity, and are evaluated in the following manner: During the application of the electrical stimulation, a weak pseudo-random test signal is injected through the electrodes. The pseudo-random test signal is incoherent with the physiological rhythm. Monitor the response characteristics of the test signal to evaluate the electrode contact impedance and / or the detuning state of the hybrid analog filter network in real time; The signal quality metrics are provided with prior indications based on the assessed electrode contact impedance and / or detuning state.

11. The method according to claim 1, characterized in that, The method further includes: While acquiring the electroencephalogram (EEG) signals, heart rate variability signals and / or acceleration signals are acquired simultaneously. Evaluate the quality indicators of the electroencephalogram signal, the heart rate variability signal, and / or the acceleration signal; The process of identifying the current sleep stage includes: dynamically selecting a decision path based on the quality indicators; Wherein, when the quality index of the electroencephalogram (EEG) signal is higher than the first threshold, the EEG features extracted from the EEG signal are used as the main criterion; When the quality index of the EEG signal is lower than the first threshold, the weight of the EEG features is reduced, and features extracted from the heart rate variability signal and / or the acceleration signal are introduced as alternative or supplementary criteria.

12. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it is able to implement the steps of the method according to any one of claims 1 to 11.

13. A sleep-improving electrical stimulation system, characterized in that, include: Wearable components integrate acquisition electrodes for acquiring electroencephalogram (EEG) signals and stimulation electrodes for applying time-interference electrical stimulation deep within the brain. A host controller, electrically connected to the wearable component, the host controller comprising: A carrier signal generation module is used to generate at least two intermediate frequency carrier signals required for the time-interference electrical stimulation. The output terminal of the carrier signal generation module is electrically connected to the stimulation electrode to output the intermediate frequency carrier signal to the stimulation electrode. A hybrid analog filter network, whose input is electrically connected to the acquisition electrode, is used to physically attenuate the EEG signal synchronously acquired by the acquisition electrode and superimposed with the intermediate frequency carrier signal in the analog domain; An analog-to-digital converter, whose input is electrically connected to the output of the hybrid analog filter network, is used to perform analog-to-digital conversion on the EEG signal after physical attenuation. The sleep staging module has its input terminal electrically connected to the output terminal of the analog-to-digital converter, and is used to identify the current sleep stage based on the high-fidelity signal after physical attenuation and analog-to-digital conversion. The closed-loop control module has its input terminal electrically connected to the output terminal of the sleep staging module and its control output terminal electrically connected to the control input terminal of the carrier signal generation module. It is used to adjust the parameters of the time-interference electrical stimulation according to the sleep stage identification results.

14. The sleep-improving electrical stimulation system according to claim 13, characterized in that, The hybrid analog filtering network includes: A passive LCR notch filter array tuned to the frequency of the intermediate frequency carrier signal, and an active high-order low-pass filter located after the passive LCR notch filter array with a cutoff frequency lower than the intermediate frequency carrier signal.

15. The sleep-improving electrical stimulation system according to claim 14, characterized in that, The passive LCR notch filter group includes multiple LCR series resonant notch filters, the Q value of the LCR series resonant notch filter is greater than 50, and the inductor in the LCR series resonant notch filter is a magnetically shielded wire-wound inductor. The active high-order low-pass filter is an 8th-order filter based on Bessel polynomials, and the -3dB cutoff frequency of the active high-order low-pass filter is between 100Hz and 150Hz. The active high-order low-pass filter includes an operational amplifier, the input voltage noise density of which is less than 5nV / √Hz; The hybrid analog filter network is configured to provide a physical attenuation of not less than 100 dB for the intermediate frequency carrier signal.

16. The sleep-improving electrical stimulation system according to claim 13, characterized in that, The acquisition electrode and the stimulation electrode are different types of electrodes, wherein: The acquisition electrodes are dry electrodes, located at positions AF7, AF8, FPZ, FP1, and FP2 of the international 10-20 system; The stimulation electrode is a hydrogel electrode, located at positions AF3, F1, TP7, and TP9 of the International 10-20 system.

17. The sleep-improving electrical stimulation system according to claim 13, characterized in that, The host controller includes a microcontroller, volatile memory, and non-volatile memory, wherein the non-volatile memory is used to store a lightweight neural network model running on the microcontroller, and the volatile memory is used to store real-time data. The sleep staging module is implemented as a lightweight neural network model, which includes at least one normalization layer. The running statistics of the normalization layer are configured to be updated online in the volatile memory, while the weights of the convolutional layers of the lightweight neural network model remain frozen during the update. The update of the running statistics adopts an exponential moving average formula, which includes a smoothing coefficient α(t), which is dynamically modulated based on the signal quality index SQI derived from the hardware front end and / or the current sleep stage result. The host controller is further configured with a circuit breaker protection mechanism: when the cumulative change of the operating statistics in a single usage cycle exceeds a preset standard deviation threshold, the update will be automatically stopped and the operating statistics will be rolled back to the initial value.

18. The sleep-improving electrical stimulation system according to claim 13, characterized in that, The host controller is configured to store the fixed group delay introduced by the hybrid analog filter network through offline calibration, and to calculate a phase compensation angle using the EEG slow wave frequency locked in real time by the frequency-locked loop and the fixed group delay. The instantaneous phase extracted from the EEG slow wave is biased and corrected according to the phase compensation angle to obtain the corrected instantaneous phase. The host controller is further configured to: evaluate the confidence level of the corrected instantaneous phase, and allow triggering of the time-interference electrical stimulation based on the corrected instantaneous phase only when the confidence level is higher than a preset threshold; the confidence level is evaluated based on the amplitude of the frequency-locked loop output, the frequency-locking error, and / or the signal quality index; The signal quality metrics include at least one of signal stability, noise ratio, or data integrity, and the host controller is further configured to evaluate the signal quality metrics in the following manner: During the application of the time-interference electrical stimulation, a weak pseudo-random test signal is injected into the stimulation electrode or the acquisition electrode. The pseudo-random test signal is incoherent with the physiological rhythm. Monitor the response characteristics of the test signal to evaluate the electrode contact impedance and / or the detuning state of the hybrid analog filter network in real time; The signal quality metrics are provided with prior indications based on the assessed electrode contact impedance and / or detuning state.

19. The sleep-improving electrical stimulation system according to claim 13, characterized in that, The carrier signal generation module is configured to generate at least two intermediate frequency carrier signals such that the frequency difference is within a preset envelope frequency range, wherein the preset envelope frequency range is between 0.1 Hz and 10 Hz. The closed-loop control module is further configured with a safety protection circuit for limiting the amplitude of the electrical stimulation current according to the carrier frequency. The safety protection circuit is configured to follow the following: when the carrier frequency is less than 2.5 kHz, the maximum current amplitude is less than 5 mA; when the carrier frequency is between 2.5 kHz and 5 kHz, the maximum current amplitude is less than 7 mA; when the carrier frequency is greater than 5 kHz, the maximum current amplitude is less than 14 mA. The closed-loop control module also includes a multi-focus time-division multiplexing controller, which is configured to perform time-division multiplexing polling switching between stimulation parameter configurations of multiple target points at a mid-frequency rate of 2kHz to 5kHz when using multiple pairs of electrodes to perform time-interference electrical stimulation between multiple brain region target points. The multi-focus time-division multiplexing controller further includes a rate limiter for generating a smooth ramp transition when switching the target current amplitude; the rate limiter gradually adjusts the current command value in a clock cycle higher than the polling rate with a preset fixed step, so that it smoothly transitions from the current amplitude to the target amplitude. The closed-loop control module further includes a blanking signal generator, which generates a blanking signal during the transient period of each focus state switch. The generation of the blanking signal is synchronized with the start time of the focus state transition, and its duration covers at least the period of the ramp transition and the stable period required by the input stage of the analog-to-digital converter. The blanking signal is used to control the input stage of the analog-to-digital converter to enter a bypass or sampling hold pause state.

20. The sleep-improving electrical stimulation system according to claim 13, characterized in that, The wearable component also integrates a photoplethysmography (PPG) sensor containing a red light emitter and an infrared light emitter, as well as an accelerometer, for collecting heart rate variability signals and body motion signals, respectively. The sleep staging module is configured to evaluate the quality indicators of the electroencephalogram signal, the heart rate variability signal, and / or the body movement signal, and dynamically select a decision path based on the quality indicators. Wherein, when the quality index of the electroencephalogram (EEG) signal is higher than the first threshold, the EEG features extracted from the EEG signal are used as the main criterion; When the quality index of the EEG signal is lower than the first threshold, the weight of the EEG features is reduced, and features extracted from the heart rate variability signal and / or the body movement signal are introduced as alternative or supplementary criteria.