A waveform control method, device, electronic equipment, and medium for an electrotherapy device.
By using two independent phase accumulation processes to generate modulation values and fundamental values in low- and medium-frequency electrotherapy devices, and embedding segment checks during the accumulation process of fundamental values, the problems of low frequency accuracy and untimely sampling feedback in existing technologies are solved, and waveform control of electrotherapy devices with high frequency accuracy and portable design is realized.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHANGSHALONG ZHIJIE TECH CO LTD
- Filing Date
- 2026-04-16
- Publication Date
- 2026-07-17
Smart Images

Figure CN122031929B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of electronic medical devices, and more specifically, to a waveform control method, apparatus, electronic device, and medium for an electrotherapy device. Background Technology
[0002] Low- and medium-frequency electrotherapy devices are medical physiotherapy equipment that stimulates human neuromuscular nerves and muscles with current of specific frequencies and waveforms to achieve therapeutic effects such as pain relief, promoting blood circulation, and delaying muscle atrophy.
[0003] Currently, waveform synthesis technology for low- and mid-frequency electrotherapy devices mainly employs three schemes: First, using operating system scheduling or timer interrupts to control the digital-to-analog converter for plotted output. This method is limited by the scheduling cycle, resulting in low frequency accuracy and insufficient waveform smoothness. Second, using multiple dedicated signal modulation circuits for single waveforms for splicing synthesis. This scheme leads to complex circuits, low integration, and high debugging and maintenance costs. Third, using high-performance dedicated arbitrary waveform synthesis chips. However, these chips are expensive and have redundant performance, making them unsuitable for portable consumer products. Regarding power amplification and isolation, common solutions include using an audio power amplifier to drive a transformer for isolated output on the low-voltage side. However, this is limited by transformer performance, resulting in a narrow frequency coverage. Alternatively, an isolated power supply can be used for isolation and then boosted before connecting to a transistor amplifier circuit. This method is inefficient, generates significant heat, and is unsuitable for battery-powered portable devices. In terms of load status detection, existing technologies mostly use transformers for current sampling. This method cannot completely sample signals containing DC components, affecting the closed-loop control accuracy of the output intensity.
[0004] The aforementioned existing technologies have the following drawbacks: the frequency accuracy of the point-based output method is low, while the cost of dedicated chip solutions is too high; multiple dedicated modulation circuits make it difficult to improve integration; the audio power amplifier driving transformer method has a narrow frequency band; the isolated power supply plus transistor amplifier circuit is inefficient and generates a lot of heat; transformer current sampling cannot process signals containing DC components. Among these, low frequency accuracy and incomplete sampling feedback are key issues restricting the therapeutic effect and portability of electrotherapy devices. For example, the point-based output method can usually only achieve millisecond-level accuracy, making it difficult to generate delicate therapeutic waveforms, and the separation of sampling feedback and waveform generation makes it impossible to achieve precise adjustment cycle by cycle. Summary of the Invention
[0005] In view of the above, the purpose of this application is to provide a waveform control method, device, electronic device and medium for an electrotherapy device to overcome at least one of the above-mentioned defects.
[0006] In a first aspect, embodiments of this application provide a waveform control method for an electrotherapy device, comprising: performing phase accumulation according to a first accumulation calculation frequency, and obtaining a modulation value by looking up a table based on the accumulated phase point; performing phase accumulation according to a second accumulation calculation frequency, obtaining a fundamental wave value by looking up a table based on the accumulated phase point, and performing a segment check on the current fundamental wave phase point during the accumulation process, and triggering a sampling task when the current fundamental wave phase point is located in a preset sampling segment; and obtaining an output waveform ratio value based on the modulation value and the fundamental wave value.
[0007] In one optional embodiment of this application, the step of performing phase accumulation according to a first accumulation calculation frequency and obtaining the modulation value by looking up a table based on the accumulated phase point includes: determining a first phase step value according to the externally input modulation waveform frequency; accumulating the first phase accumulation counter with the first phase step value according to the first accumulation calculation frequency to obtain the current modulation phase point; establishing a modulation waveform data table according to the externally input modulation waveform type, wherein the modulation waveform data table records the amplitude value corresponding to each phase point within a complete cycle; and querying the modulation waveform data table for the amplitude value corresponding to the current modulation phase point as the modulation value.
[0008] In one optional embodiment of this application, the fundamental frequency value is obtained by: determining a second phase step value based on the externally input fundamental frequency; accumulating the second phase step value with the second phase accumulator counter according to the second accumulation calculation frequency to obtain the current fundamental phase point; establishing a fundamental waveform data table based on the externally input fundamental waveform type, wherein the fundamental waveform data table records the amplitude values corresponding to each phase point within a complete cycle; querying the fundamental waveform data table for the amplitude value corresponding to the current fundamental phase point, and using it as the fundamental frequency value.
[0009] In one optional embodiment of this application, the method further includes: during the phase accumulation process according to the first accumulation calculation frequency, recording the number of output cycles through the cycle count bit in the first phase accumulation counter; and performing logical judgment and switching between different modulation waveform types according to the preset treatment stage requirements.
[0010] In one optional embodiment of this application, the segment check further includes a polarity segment check: when the current fundamental phase point is located in a preset polarity segment, the waveform polarity value is modified to a positive or negative value.
[0011] In one optional embodiment of this application, the method further includes: acquiring target intensity information; when the sampling task is triggered, calculating closed-loop intensity information by proportional-integral method based on the target intensity information and the collected output current sampling value and output voltage sampling value; and adjusting the distribution relationship between the power supply voltage value and the output waveform proportional value based on the closed-loop intensity information.
[0012] In one optional embodiment of this application, the output current sample value and the output voltage sample value are acquired and transmitted back in the following manner: the output voltage is divided and then subtracted from the reference voltage to obtain the output voltage sample value; the output current is half-wave rectified, low-pass filtered, and then subtracted from the reference voltage to obtain the output current sample value; the output voltage sample value and the output current sample value are compared with a reference triangular wave respectively and converted into pulse width modulation signals; the pulse width modulation signals are digitally isolated and transmitted back to the microcontroller.
[0013] Secondly, embodiments of this application also provide a waveform control device for an electrotherapy device. The device includes: a modulation value acquisition module, used to perform phase accumulation according to a first accumulation calculation frequency, and obtain a modulation value by looking up a table based on the accumulated phase points; a fundamental value acquisition module, used to perform phase accumulation according to a second accumulation calculation frequency, obtain a fundamental value by looking up a table based on the accumulated phase points, and perform a segment check on the current fundamental phase point during the accumulation process, and trigger a sampling task when the current fundamental phase point is located in a preset sampling segment; and a waveform ratio output module, used to obtain an output waveform ratio value based on the modulation value and the fundamental value.
[0014] Thirdly, embodiments of this application also provide an electronic device, including: a processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the memory via the bus, and when the machine-readable instructions are executed by the processor, the steps of the method described above are performed.
[0015] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps of the method described above.
[0016] The waveform control method, device, electronic equipment, and medium of the electrotherapy device provided in this application embodiment perform phase accumulation according to a first accumulation calculation frequency, and obtain the modulation value by looking up a table based on the accumulated phase point; perform phase accumulation according to a second accumulation calculation frequency, obtain the fundamental wave value by looking up a table based on the accumulated phase point, and perform segment checks on the current fundamental wave phase point during the accumulation process. When the current fundamental wave phase point is located in a preset sampling segment, a sampling task is triggered; and the output waveform ratio value is obtained based on the modulation value and the fundamental wave value. Through this application, the waveform frequency accuracy is increased, the hardware integration and power consumption are reduced, and the device size is saved.
[0017] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0018] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This is an overall structural block diagram of the multi-channel electrotherapy output system provided in the embodiments of this application; Figure 2 A flowchart illustrating the waveform control method of the electrotherapy device provided in this application embodiment; Figure 3 This is a schematic diagram of waveform parameters sent by the Android control terminal according to an embodiment of this application. Figure 4 A flowchart for obtaining modulation values provided in the embodiments of this application; Figure 5 This is a block diagram illustrating the principle of the modulation waveform phase accumulation algorithm provided in the embodiments of this application. Figure 6 This is a schematic diagram of the logic judgment process for modulation waveform switching provided in the embodiments of this application; Figure 7 This is a flowchart illustrating the process of obtaining the fundamental frequency value, provided in an embodiment of this application. Figure 8 This is a block diagram illustrating the principle of the fundamental waveform phase accumulation algorithm provided in the embodiments of this application. Figure 9 A schematic diagram illustrating the principle of spread-frequency control of the excitation power supply for the electrotherapy device provided in this application embodiment; Figure 10 A schematic block diagram of the adjustable voltage isolated power supply provided in the embodiments of this application; Figure 11 The circuit schematic diagram of the adjustable voltage isolated power supply provided in the embodiments of this application; Figure 12 This is a flowchart illustrating the acquisition and transmission of outgoing current and output voltage sample values provided in an embodiment of this application. Figure 13 This is a schematic block diagram of the output sampling circuit provided in an embodiment of this application; Figure 14 This is a circuit diagram of the output voltage sampling subtraction provided in an embodiment of this application; Figure 15 This is a circuit diagram of the output current sampling circuit provided in an embodiment of this application; Figure 16 A reference triangular wave generator circuit diagram provided for embodiments of this application; Figure 17 The comparator group circuit diagram provided in the embodiments of this application; Figure 18 This is a low-pass filter circuit diagram provided in an embodiment of this application; Figure 19 This is a block diagram illustrating the principle of closed-loop control of the output intensity of the electrotherapy device provided in the embodiments of this application. Figure 20 This is a schematic diagram of a single-inductor Class D power amplifier provided in an embodiment of this application. Figure 21 The circuit schematic of a single-inductor Class D power amplifier provided in an embodiment of this application is shown below. Figure 22 A schematic diagram of key waveforms of a single-inductor Class D power amplifier provided in an embodiment of this application; Figure 23 A schematic diagram of the waveform control device of the electrotherapy device provided in the embodiment of this application; Figure 24 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0020] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of this application. Based on the embodiments of this application, every other embodiment obtained by those skilled in the art without inventive effort falls within the scope of protection of this application.
[0021] First, the applicable scenarios for this application will be introduced. This application can be applied to the field of electronic medical devices.
[0022] Low-frequency electrotherapy refers to the treatment of diseases using pulsed currents below 1000Hz. It has the characteristics of low voltage, low frequency, adjustable frequency, and stimulation of neuromuscular nerves. It is suitable for the treatment of acute and chronic pain, including stimulating motor nerves, delaying muscle atrophy, and achieving analgesia through current parameter adjustment. Medium-frequency electrotherapy generates low-frequency modulated pulsed currents in deep tissues, producing analgesia, muscle strengthening, promoting blood circulation, softening scars, and loosening adhesions.
[0023] Research has revealed inherent flaws in existing low- and mid-frequency electrotherapy devices in three key areas: waveform synthesis, power amplification, and load detection. Waveform synthesis either relies on operating system scheduling and plotting, leading to insufficient frequency accuracy, or uses multiple dedicated circuits resulting in low integration and high cost, or wastes resources by using expensive dedicated chips. In the power amplification stage, audio amplifiers using transformers have narrow frequency bands, typically five times or less. Isolated power supplies with transistors are inefficient and generate significant heat, failing to meet the battery power and miniaturization requirements of portable devices. Load detection using transformer sampling cannot fully capture the current signal containing DC components, limiting the closed-loop control accuracy of the output intensity. These flaws collectively contribute to the limitations of traditional electrotherapy devices, which are often characterized by limited functionality, bulky size, and inconvenience in movement or portability.
[0024] Based on this, the embodiments of this application provide a waveform control method, device, electronic device, and medium for an electrotherapy device. The modulation value and the fundamental value are generated through two independent phase accumulation processes, and a segment check is embedded in the accumulation process of the fundamental value to trigger the sampling task. Finally, the modulation value and the fundamental value are multiplied to obtain the output waveform ratio value, so as to improve the waveform frequency accuracy and the timeliness of sampling feedback. This achieves the effect of high frequency accuracy and flexible waveform output without relying on expensive dedicated waveform synthesis chips or multiple dedicated modulation circuits, and overcomes the shortcomings of low frequency accuracy, untimely or incomplete sampling feedback in the prior art.
[0025] This application provides a waveform control method for a portable low-to-medium frequency electrotherapy device. The method generates a modulation value and a fundamental value through two independent phase accumulation processes. A segment check is embedded during the fundamental value accumulation process to trigger a sampling task. Finally, the modulation value and the fundamental value are multiplied to obtain the output waveform ratio. This method achieves high-frequency accuracy and flexible waveform output without relying on expensive dedicated waveform synthesis chips or multiple dedicated modulation circuits. It also enables cycle-by-cycle load state sampling feedback, overcoming the shortcomings of existing technologies such as low frequency accuracy and untimely or incomplete sampling feedback, thus facilitating the portable design of electrotherapy devices.
[0026] For further details, please refer to Figure 1 , Figure 1 This is a block diagram of the overall structure of the multi-channel electrotherapy output system provided in the embodiments of this application.
[0027] Please see Figure 1 The multi-channel electrotherapy output system of this embodiment mainly consists of a general-purpose microcontroller, peripheral modules, adjustable voltage isolation power supply, single-inductor Class D power amplifier, and output sampling circuit. The general-purpose microcontroller is the core control unit, which can simultaneously control multiple (4 channels in this embodiment) electrotherapy output channels. The following description takes the first channel as an example. The structures of the second, third, and fourth channels are the same as the first channel.
[0028] The peripheral modules communicate bidirectionally or interact with the general-purpose microcontroller via one-way signals to implement the device's basic function management. Specifically, these include a programming port, a debugging port, an Android interface, a buzzer, a battery temperature sensor, a motherboard temperature sensor, a power-on / off circuit, and a battery management circuit. The programming port and debugging port are used to program and debug the microcontroller; the Android interface is used to communicate with external terminals; the buzzer is used for status indication; the battery temperature sensor and motherboard temperature sensor are used to collect temperature data at corresponding locations; the power-on / off circuit is used for power on / off control of the device; and the battery management circuit is used for battery charging / discharging management and status monitoring.
[0029] A general-purpose microcontroller (in this embodiment, the prototype is an STM32F750VB) is the core control unit of the system, used to generate multiple electrotherapy-related control signals and receive sampled feedback signals to achieve closed-loop control. For the first output channel, the microcontroller outputs a PWM (output power supply voltage signal) and a DAC (spread spectrum control signal) to an adjustable voltage isolated power supply, outputs a PWM (electrotherapy waveform signal) and a GPIO (electrotherapy polarity signal) to a single-inductor Class D power amplifier, and simultaneously outputs a PWM (feedback gain signal) to the output sampling circuit. The output sampling circuit collects relevant parameters of the electrotherapy output and feeds back the two ADC output data to the microcontroller, forming a closed-loop control circuit.
[0030] The adjustable voltage isolated power supply provides adjustable isolated power to the single-inductor Class D power amplifier. Its supply voltage is regulated by the PWM output power voltage signal of the microcontroller, and spread spectrum control is achieved through the DAC spread spectrum control signal to optimize electromagnetic compatibility. The single-inductor Class D power amplifier generates the target electrotherapy output signal based on the electrotherapy waveform and polarity control signal output by the microcontroller. The output sampling circuit is used to collect parameters such as voltage and current of the electrotherapy output in real time, process them, and feed them back to the microcontroller to achieve precise output control and safety protection.
[0031] Please see Figure 2 , Figure 2 This is a flowchart illustrating the waveform control method of the electrotherapy device provided in this application. The steps of this application are implemented by a software program in a microcontroller (such as an STM32F750VB) through phase accumulation algorithms, table lookups, multiplication operations, etc. The microcontroller is the main executor of the waveform control method, such as... Figure 2 As shown in the embodiments of this application, the waveform control method of the electrotherapy device includes: S101. Accumulate the phase according to the first accumulation calculation frequency, and look up the modulation value in the table based on the accumulated phase point.
[0032] In this embodiment, a modulation value is generated using a phase accumulation algorithm based on externally input waveform parameters. This process includes: determining a phase step value; updating the phase accumulation counter according to the accumulation calculation frequency; querying the waveform data table using the current phase point as an index to obtain the corresponding amplitude value as the modulation value. The modulation value is subsequently multiplied by the fundamental value to control the variation pattern of the output waveform.
[0033] This step generates the modulation value using a phase accumulation algorithm. The frequency accuracy depends only on the bit width of the accumulator counter, which is far superior to traditional point-based methods. Simultaneously, software lookup tables replace multiple dedicated hardware modulation circuits, reducing hardware costs and circuit complexity. The modulation value is directly used in subsequent multiplication operations without the need for additional signal conditioning.
[0034] For further details, please refer to Figure 3 , Figure 3 This is a schematic diagram of waveform parameters sent by the Android control terminal according to an embodiment of this application. Figure 3 As shown, the waveform parameters sent from the external Android control terminal to the microcontroller include: target intensity information, modulation waveform sequence, modulation waveform type, modulation waveform frequency, fundamental waveform type, and fundamental frequency.
[0035] The target intensity information is used to set the target amplitude of the electrotherapy output, and the microcontroller adjusts the output power through closed-loop control based on this information. The modulation waveform sequence defines the timing and switching logic of the multi-segment electrotherapy waveform, facilitating the customization of complex physiotherapy programs. The modulation waveform type and frequency are used to configure the waveform style and modulation frequency of the modulation wave. The fundamental waveform type and frequency are used to configure the fundamental carrier waveform and carrier frequency of the electrotherapy output. After receiving all control information, the microcontroller generates the corresponding modulation waveform and fundamental waveform based on the phase accumulation algorithm, ultimately driving the single-inductor Class D power amplifier to output the required electrotherapy signal.
[0036] Please see Figure 4 , Figure 4 This is a flowchart illustrating the process of obtaining modulation values as provided in an embodiment of this application. Figure 4 As shown, it includes: S201. Determine the first phase step value based on the frequency of the externally input modulation waveform.
[0037] External input comes from an Android control terminal that communicates wirelessly with the electrotherapy device. After the user selects a treatment mode via the Android application, the system sends modulation waveform frequency parameters. The modulation waveform frequency determines how fast the output signal amplitude changes, such as how many times per second.
[0038] The first phase step value is a digital quantity calculated based on the ratio of the frequency to the first accumulation calculation frequency. The specific calculation formula is: the phase step value equals the modulation waveform frequency multiplied by 2 raised to the power of the phase accumulator counter's bit width, then divided by the first accumulation calculation frequency. Since the first phase accumulator counter has a bit width of 32 bits and the first accumulation calculation frequency is approximately 15 kHz, in this embodiment, the first accumulation calculation frequency is 15.0 kHz ± 0.1 kHz. Therefore, the step value is a 32-bit integer, representing the amount the counter should increment with each accumulation. This step value is stored in the microcontroller's register for reuse in subsequent accumulation steps, and is recalculated only when the user modifies the modulation waveform frequency.
[0039] This step enables precise conversion from the user-desired frequency to digital step values. Thanks to the use of a 32-bit wide accumulator, the frequency resolution is extremely high, achieving approximately 8.94 × 10⁻⁶. -4 The frequency step of Hz is far higher than that of traditional point-tracking methods. This high-precision frequency control allows the electrotherapy device to produce subtle modulation waveform changes, such as slowly changing analgesic waveforms or rapidly impacting muscle stimulation waveforms, without relying on external high-precision crystal oscillators or complex phase-locked loop circuits.
[0040] S202. According to the first accumulation calculation frequency, the first phase accumulation counter is accumulated with the first phase step value to obtain the current modulation phase point.
[0041] The first accumulation calculation frequency is set to approximately 15 kHz. In this embodiment, the first accumulation calculation frequency is set to 15.0 kHz ± 0.1 kHz. This frequency is generated by a timer or system clock divider within the microcontroller and serves as the trigger clock for the accumulation operation. At each clock cycle, the microcontroller performs an accumulation operation: adding the current value of the first phase accumulator counter to the first phase step value, and writing the result back to the first phase accumulator counter. The first phase accumulator counter is a 32-bit register, typically initialized to 0. Its value gradually increases after each accumulation, overflowing when it exceeds the maximum 32-bit value, thus achieving periodic phase cycling. The accumulated counter value is the current modulation phase point, an integer ranging from 0 to 2^32 minus 1, representing the relative position of the modulation waveform within one cycle. For example, a larger step value results in a faster counter loop, corresponding to a higher modulation frequency; a smaller step value results in a slower counter change, corresponding to a lower modulation frequency.
[0042] This step enables continuous phase generation of the modulated waveform without the need for complex table lookups or digital-to-analog conversion outputs in interrupt service routines. Compared to traditional timer interrupt plotting methods, this step only requires one addition operation per clock cycle, resulting in extremely low computational overhead. Furthermore, the phase accumulation process is unaffected by interrupt response delays, ensuring consistent phase accuracy. The 15 kHz update frequency guarantees the time-domain resolution of the modulated waveform, sufficient to smoothly represent common modulated waveforms such as sine waves, triangle waves, and square waves, without excessively consuming microcontroller processing resources, reserving computational margin for other tasks such as communication and sampling control.
[0043] S203. Establish a modulation waveform data table based on the modulation waveform type input externally. The modulation waveform data table records the amplitude value corresponding to each phase point within a complete cycle.
[0044] The modulation waveform type input from the external input also comes from the Android control terminal. Users can select sine modulation, triangular modulation, square wave modulation, or a custom sequence. Based on the selected type, the microcontroller pre-creates or retrieves the corresponding modulation waveform data table from its internal memory. This data table contains 256 entries, each corresponding to a phase point and storing the amplitude value at that phase point. The amplitude value is typically normalized to a floating-point or fixed-point number between 0 and 1; for example, the sine wave data table stores sine values for points ranging from 0 to 2π. The table length of 256 is chosen by balancing waveform precision with storage capacity, matching the number of bits (high 8 bits) used to truncate the phase points. Once created, this data table can be reused during treatment without recalculation each time; it is only updated when the user switches waveform types.
[0045] This step enables software definition of waveform shapes, allowing the electrotherapy device to support arbitrary waveforms without hardware modifications. The datasheet is stored in the microcontroller's flash memory, occupying a very small space (256 points, each typically 1-2 bytes) and costing almost nothing. Because the datasheet can be remotely upgraded, new treatment waveforms can be added via firmware updates after the device leaves the factory, significantly improving product scalability and lifespan. Compared to existing solutions that use multiple dedicated hardware circuits to generate different waveforms, this step completely entrusts waveform diversity to software, maintaining a unified hardware circuit, significantly reducing material costs and board area.
[0046] S204. Query the amplitude value corresponding to the current modulation phase point in the modulation waveform data table and use it as the modulation value.
[0047] The current modulation phase point is a 32-bit integer, but the data table only has 256 entries. Therefore, the phase point needs to be mapped to a data table index. The mapping method is as follows: take the high 8 bits of the current modulation phase point (i.e., bits 24 to 31) as the index value, because 2 to the power of 8 equals 256, which exactly covers the length of the data table. The microcontroller directly accesses the corresponding position in the data table through this index and reads the pre-stored amplitude value. This amplitude value is the modulation value at the current moment, which is a dimensionless scaling factor, typically ranging from 0 to 1. The modulation value is then fed into a multiplier and multiplied by the fundamental frequency value generated in subsequent steps, thereby controlling the amplitude envelope of the fundamental signal. For example, when the modulation value is 0.5, the output amplitude is halved; when the modulation value is 1, the output amplitude remains unchanged; and when the modulation value is 0, the output is zero.
[0048] This step enables high-speed, deterministic table lookup operations, requiring only a few processor cycles per lookup without any floating-point or trigonometric calculations. Because the data table length is strictly matched to the number of bits used for phase truncation, the lookup process avoids index out-of-bounds errors or interpolation errors, ensuring the fidelity of the modulated waveform. Compared to using a digital-to-analog converter to calculate waveform points in real time, the table lookup method avoids complex calculations during each interrupt, reducing software complexity and improving the real-time performance of waveform updates. The modulation value directly participates in multiplication operations without additional signal conditioning or level conversion, providing digital proportional control for subsequent fundamental modulation.
[0049] S102. Accumulate phase according to the second accumulation calculation frequency, look up the fundamental value from the accumulated phase point in the table, and check the current fundamental phase point during the accumulation process. When the current fundamental phase point is located in the preset sampling segment, trigger the sampling task.
[0050] The second phase step value is determined based on the externally input fundamental frequency, and the second phase accumulator counter is updated according to the second accumulation calculation frequency to obtain the current fundamental phase point. A fundamental waveform data table is established based on the externally input fundamental waveform type, and the fundamental value is obtained by querying the data table using the current fundamental phase point as the index. While accumulating to obtain the current fundamental phase point, a segment check is performed on the phase point. If it falls into a preset sampling segment, a sampling task is triggered to collect the output current and output voltage values.
[0051] In this embodiment of the application, the segment check also includes a polarity segment check: when the current fundamental phase point is located in a preset polarity segment, the waveform polarity value is modified to a positive or negative value.
[0052] Here, polarity segment checking is performed synchronously during the fundamental waveform generation process. The fundamental waveform data table pre-marks polarity segments, which are the phase intervals in the waveform period where the current direction needs to be changed, such as near the zero-crossing point of a sine wave. After the microcontroller accumulates the current fundamental phase point at a frequency of 500 kHz, it quickly determines whether the point falls within the preset polarity interval through bit logic operations. If the condition is met, the waveform polarity value is immediately modified: it is modified to a positive value when the current fundamental phase point is in the preset positive polarity interval, and modified to a negative value when it is in the preset negative polarity interval, and temporarily stored in a register for subsequent processing.
[0053] This check enables precise control of the current direction. Polarity determination is embedded in the phase accumulation of each cycle, requiring no additional interruption. The polarity reversal time error is less than 2 microseconds, and the phase error is less than 0.36 degrees, avoiding waveform distortion or current surges.
[0054] The waveform polarity and output waveform scaling are coordinated by a delay matching circuit: the polarity controls the switching direction of the power amplifier half-bridge, and the scaling factor controls the pulse width modulation duty cycle. After being aligned by an XOR gate, the two synchronously drive the power half-bridge, ensuring a symmetrical transition between the positive and negative half-cycles and preventing short circuits or distortions caused by asynchronous switching.
[0055] This step generates a high-precision fundamental waveform through a phase accumulation algorithm and embeds a sampling triggering mechanism into the accumulation process to achieve synchronous sampling cycle by cycle of the fundamental waveform. No additional timer or interrupt is required, the sampling timing is accurate, and real-time feedback is provided for subsequent closed-loop control.
[0056] For further details, please refer to Figure 5 , Figure 5 This is a block diagram illustrating the principle of the modulation waveform phase accumulation algorithm provided in an embodiment of this application. Please refer to... Figure 5The modulation value of the modulated waveform is calculated using a phase accumulation algorithm based on the modulated waveform sequence, modulation waveform type, modulation waveform frequency, and overall waveform proportion. The dashed box indicates the operations performed for each phase accumulation update; the remaining parts are calculated and modified when parameters are changed. The modulation waveform frequency and the modulation waveform update frequency together determine the modulation waveform phase step. The phase step is input to the phase accumulation module to complete phase accumulation. After phase truncation, the phase is split into two paths: one input to the waveform counting module and the other to the current modulation value reading module. The waveform counting module, combined with the modulation waveform sequence and modulation waveform data table, selects the modulation waveform type and outputs it to the current modulation value reading module. The current modulation value obtained from the table, combined with the overall waveform proportion, finally outputs the modulation ratio value.
[0057] In the embodiments of this application, the modulation ratio value is the modulation value.
[0058] The phase accumulator counter has a 32-bit width, with the last 24 bits used to calculate the phase point of the current modulation waveform period. According to the direct digital frequency synthesis tuning formula: Output frequency = Phase step × Phase accumulator frequency / 2 相位累加计数字宽 The phase accumulation count has a bit width of 24 bits, the phase step is the value when accumulating the count each time, and the phase accumulation frequency is selected to be approximately 15kHz. In this embodiment of the application, the phase accumulation frequency is 15.0kHz±0.1kHz.
[0059] The minimum step of the output frequency is the phase accumulation frequency / 2. 相位累加计数位宽 That is, the frequency accuracy of the modulation waveform is 15kHz / (2 24 )≈8.94×10 -4 Hz. Extract the first 8 bits of the current phase point, that is, the 9th to 16th bits of the phase accumulation count, look up the value in the data table corresponding to the 256 phase points to obtain the current modulation value, and multiply it by the overall waveform ratio to obtain the final modulation value.
[0060] For further details, please refer to Figure 6 , Figure 6 This is a schematic diagram illustrating the logic judgment process for modulation waveform switching provided in an embodiment of this application. Please refer to... Figure 6The update frequency for the modulation waveform accumulation calculation is set to 15kHz. A data table with 256 phase points is used, recording the corresponding digital amplitude information of one complete cycle of each modulation waveform. The phase accumulation count has a bit width of 32 bits, with the first 8 bits used for output cycle counting, recording the total number of output cycles. Logical judgment is executed during each accumulation calculation to control the switching between different modulation waveforms required for different therapeutic effects. After the process starts, it checks if the waveform count is greater than b. If not, the process ends directly; if it is, the waveform count is cleared, the judgment value is switched from b to c, and the output waveform is switched from B to C, ending the process and completing the switching from the current section's b B waveforms to the next section's c C modulation waveforms.
[0061] Please see Figure 7 , Figure 7 This is a flowchart illustrating the process of obtaining the fundamental frequency value, as provided in an embodiment of this application. Figure 7 As shown, the fundamental frequency value is obtained in the following way: S301. Determine the second phase step value based on the fundamental frequency input from the outside.
[0062] The externally input fundamental frequency comes from an Android control terminal that wirelessly communicates with the electrotherapy device. After the user selects a treatment mode via the Android application, the system sends the fundamental frequency parameter. The fundamental frequency determines the speed of the basic waveform of the output current, such as a sinusoidal oscillation of 1000 times per second. The second phase step value is a digital quantity calculated based on the ratio of the fundamental frequency to the second accumulation calculation frequency. The calculation formula is: the phase step value equals the fundamental frequency multiplied by 2 raised to the power of the phase accumulation counter bit width, then divided by the second accumulation calculation frequency. The second accumulation calculation frequency is set to approximately 500 kHz. In this embodiment, the second accumulation calculation frequency is set to 500.0 kHz ± 0.5 kHz. The second phase accumulation counter bit width is 32 bits, therefore the step value is a 32-bit integer, representing the amount by which the counter should increase each time it accumulates. This step value is stored in the microcontroller's register for reuse in subsequent accumulation steps, and is recalculated only when the user modifies the fundamental frequency.
[0063] This step enables precise conversion from the user-desired fundamental frequency to digital step values. Thanks to the use of a 32-bit wide accumulator, the frequency resolution can reach approximately 1.16 × 10⁻⁶. -4 The frequency is Hz, far exceeding that of traditional analog oscillators or timer interrupt methods. This high-precision frequency control allows the electrotherapy device to generate extremely stable fundamental signals, such as the 4000 Hz sine wave used for intermediate frequency electrotherapy, with negligible frequency errors, thus ensuring the accuracy and repeatability of treatment parameters.
[0064] S302. According to the second accumulation calculation frequency, the second phase accumulation counter is accumulated with the second phase step value to obtain the current fundamental phase point.
[0065] The second accumulation calculation frequency is set to approximately 500 kHz. In this embodiment, the second accumulation calculation frequency is set to 500.0 kHz ± 0.5 kHz. This frequency is generated by a high-speed timer or phase-locked loop frequency multiplication within the microcontroller and serves as the trigger clock for the accumulation operation. At each clock cycle, the microcontroller performs an accumulation operation: adding the current value of the second phase accumulator counter to the second phase step value, and writing the result back to the second phase accumulator counter. The second phase accumulator counter is a 32-bit register, typically initialized to 0. Its value gradually increases after each accumulation, overflowing when it exceeds the maximum 32-bit value, thus achieving periodic phase cycling. The accumulated counter value is the current fundamental phase point, distributed within the range of 0 to 2^32 - 1, representing the relative position of the fundamental waveform within one cycle. For example, a larger step value results in a faster counter loop, corresponding to a higher fundamental frequency; a smaller step value results in a slower counter change, corresponding to a lower fundamental frequency.
[0066] This step enables continuous phase generation of the fundamental waveform at an update frequency of up to 500 kHz, sufficient to meticulously reproduce the details of common fundamental waveforms such as sine, square, and triangular waves. Compared to solutions using digital-to-analog converters for point-by-point output, this step only requires one addition operation per cycle, resulting in extremely low computational overhead, and the phase accumulation process is unaffected by interrupt response delays. The 500 kHz update frequency, combined with the subsequent LC filter, effectively filters out high-frequency switching noise, ensuring the smoothness of the output waveform. It also provides fine phase resolution for segment checks (such as sampling segments and polarity segments), allowing the sampling trigger position to be accurate to the nanosecond level.
[0067] S303. Establish a fundamental waveform data table based on the fundamental waveform type input from the outside.
[0068] The fundamental waveform data table records the amplitude values corresponding to each phase point within a complete cycle.
[0069] The fundamental waveform type input from the external source also comes from the Android control terminal. Users can select sine wave, square wave, triangle wave, sawtooth wave, or a custom waveform. The microcontroller pre-creates or retrieves the corresponding fundamental waveform data table in its internal memory based on the selected type. This data table contains 256 entries, each corresponding to a phase point and storing the amplitude value at that phase point. The amplitude value is typically normalized to a floating-point or fixed-point number between -1 and 1. For example, the sine wave data table stores sine values from 0 to 2π, with a value range of -1 to 1. The data table length of 256 is selected by balancing waveform precision with storage capacity, matching the number of bits (high 8 bits) used for phase point truncation. Once created, this data table can be reused during treatment and is only updated when the user switches the fundamental waveform type.
[0070] This step enables software definition of the fundamental waveform, allowing the electrotherapy device to support fundamental waveforms of arbitrary shapes without hardware modifications. The datasheet is stored in the microcontroller's flash memory, occupying minimal space and costing almost nothing. Because the datasheet can be remotely upgraded, new fundamental waveforms, such as asymmetric or composite waveforms for specific treatments, can be added via firmware updates after the device leaves the factory. Compared to existing solutions using analog oscillators or dedicated waveform generation chips, this step completely entrusts waveform diversity to software processing while maintaining a unified hardware circuit, significantly reducing material costs and board area, while facilitating mass production and maintenance.
[0071] S304. Query the amplitude value corresponding to the current fundamental phase point in the fundamental waveform data table and use it as the fundamental value.
[0072] The current fundamental phase point is a 32-bit integer, but the data table only has 256 entries. Therefore, the phase point needs to be mapped to the data table index. The mapping method is as follows: take the high 8 bits (bits 24 to 31) of the current fundamental phase point as the index value, because 2 to the power of 8 equals 256, which exactly covers the length of the data table. The microcontroller directly accesses the corresponding position in the data table through this index and reads the pre-stored amplitude value. This amplitude value is the fundamental value at the current moment, which is a dimensionless value, typically ranging from -1 to +1. The fundamental value is then fed into a multiplier and multiplied by the modulation value generated in step S101 to obtain the amplitude-modulated output waveform ratio. For example, when the fundamental value is 0.8, the output waveform reaches the positive peak at this phase point; when the fundamental value is -0.5, the output waveform is the negative half-amplitude value.
[0073] This step enables high-speed, deterministic table lookup operations, requiring only a few processor cycles per lookup, without any floating-point operations or trigonometric function calculations. Because the data table length and phase truncation bit depth are strictly matched, the lookup process avoids index out-of-bounds errors or interpolation errors, ensuring the fidelity of the fundamental waveform. The 500 kHz lookup frequency results in a very fine output waveform in the time domain, which, combined with subsequent power amplifier filtering, can produce an electrotherapy signal close to an ideal analog waveform. This fundamental value directly participates in multiplication operations without additional digital-to-analog conversion or signal conditioning, providing a digital foundation waveform for subsequent modulation and synthesis. Furthermore, while looking up the fundamental value, the current fundamental phase point can be used for segment checks, such as determining whether it falls within a preset sampling segment or polarity segment, thereby achieving synchronous triggering.
[0074] S103. Based on the modulation value and the fundamental frequency value, obtain the output waveform ratio value.
[0075] In this step, the modulation value obtained in S101 is multiplied by the fundamental value obtained in S102. The product is the output waveform ratio. The modulation value represents the variation pattern of the output signal amplitude, and the fundamental value represents the basic shape of the output signal. Multiplying the two yields a modulated composite waveform ratio. This ratio is a digital value, typically ranging from 0 to 1 or after normalization.
[0076] Subsequently, this proportional value, together with the power supply voltage value in subsequent steps, determines the actual output current intensity. Specifically, the microcontroller outputs this proportional value to a single-inductor Class D power amplifier circuit, and simultaneously adjusts the output voltage of the adjustable isolation power supply according to a closed-loop control algorithm. The two work in coordination so that the electrotherapy signal finally applied to the electrode pads has both the basic shape of the fundamental wave and the variation pattern of the modulated wave.
[0077] This step enables flexible synthesis of two waveforms, generating a variety of complex therapeutic waveforms, such as amplitude-modulated waves, frequency-modulated waves, or pulse trains, without requiring any additional hardware modulation circuitry. Multiplication operations are performed internally by software instructions within the microcontroller, offering high speed and accuracy. Furthermore, it supports remote data table updates to expand to new waveform types, providing excellent scalability. The output waveform's proportional value directly drives subsequent power amplification stages. Compared to traditional methods that first generate analog signals and then amplify them, this reduces analog modulation stages, improving overall integration and anti-interference capabilities. This proportional value, combined with an adjustable power supply voltage, allows for fine-tuning of the output intensity, avoiding the inefficiencies or waveform distortion caused by solely adjusting the power supply voltage.
[0078] For further details, please refer to Figure 8 , Figure 8 This is a block diagram illustrating the principle of the fundamental waveform phase accumulation algorithm provided in an embodiment of this application. Please refer to... Figure 8 The fundamental wave value is calculated by a phase accumulation algorithm based on the fundamental wave waveform frequency, fundamental wave waveform type, spread spectrum control value, and modulation ratio (modulation value).
[0079] The dashed box represents the operations required for each phase accumulation update, while the remaining parts are executed when parameters are modified or the task is triggered. The principle of the fundamental waveform accumulation calculation algorithm is basically the same as that of the modulation waveform, but the update frequency of the fundamental waveform will be dynamically changed according to the spread spectrum control value to perform spread spectrum operation and reduce the external radiation peak.
[0080] The update frequency is approximately 500kHz. In this embodiment, the update frequency is 500.0kHz ± 0.5kHz. A data table with 256 phase points is used. The data table records the corresponding digital amplitude information for a complete cycle. The phase accumulation counter has a bit width of 32 bits and is used to calculate the phase point of the current fundamental waveform cycle. Similarly, the frequency is calculated according to the direct digital frequency synthesis tuning formula, and its frequency accuracy is 500kHz / (2 32 )≈1.16×10 -4 Hz. Extract the first 8 bits of the current phase point, look up the value in the data table to obtain the current waveform value of the fundamental wave, and multiply it by the modulation value to obtain the fundamental wave value.
[0081] In the fundamental wave phase accumulation algorithm, phase segment checks are performed, and the phase values of the polarity segments are recorded in the fundamental wave waveform data table. Bitwise logic operations are then performed with the current phase count value. If the polarity segment condition is met, the waveform polarity value is modified to the corresponding value. Bitwise logic operations are also performed between the sampled segment phase values and the current phase count value. If the output conversion condition is met, a closed-loop adjustment task is triggered, in which the calculations related to output intensity closed-loop control are completed.
[0082] In this embodiment, the software program used to implement the phase accumulation algorithm of the modulation waveform and the fundamental waveform is configured with specific parameter values. The core idea of parameter selection is to make adaptive configurations based on the hardware parameter characteristics of the microcontroller used, while meeting the product performance requirements. The specific parameter settings are shown in Table 1 below: Table 1
[0083] In this application, the proportional coefficient of the proportional-integral (PI) control ranges from 0.1 to 0.5, and the integral coefficient ranges from 0.01 to 0.1. The formula for calculating the closed-loop strength information is: Closed-loop strength information = proportional coefficient × current error + integral coefficient × cumulative error value, where the current error is the difference between the target strength information and the actual strength information, and the actual strength information is calculated by multiplying the output current sample value and the output voltage sample value.
[0084] The above parameters can be flexibly adjusted according to the performance requirements of the actual application and the performance of the selected microcontroller hardware. At the same time, the parameters can be reconfigured by replacing the devices with different performance, so that the waveform control scheme of the electrotherapy device in this application has good flexibility and scalability.
[0085] For further details, please refer to Figure 9 , Figure 9 This is a block diagram illustrating the principle of spread-frequency control of the excitation power supply in the electrotherapy device provided in this embodiment. Please refer to... Figure 9In the operating system of a general-purpose microcontroller, a true random number generator is triggered periodically to generate random numbers. These random numbers are then converted into spread spectrum control values and output to the flyback power supply controller via a DAC. This allows the switching frequency of the flyback power supply to be changed within a small range, thereby completing the spread spectrum operation of the power supply and reducing the peak radiated emission.
[0086] For further details, please refer to Figure 10 , Figure 10 This is a schematic block diagram of the adjustable voltage isolated power supply provided in an embodiment of this application. Please refer to... Figure 10 The adjustable isolated power supply of this application adopts a conventional flyback configuration, while adding dynamic spread spectrum and voltage regulation functions. Battery power is supplied, and a DAC-spread spectrum control is input to the isolated power supply control chip. The output of the isolated power supply control chip is sent to the flyback transformer. The flyback transformer output is filtered by the isolated power supply output to obtain the electrotherapy power supply output. The PWM output power supply voltage is digitally isolated to output an FPWM output power supply voltage. The FPWM output power supply voltage is then filtered by a low-pass filter and an error amplifier, and together with the output power supply voltage negative feedback through optocoupler isolation, it is input to the isolated power supply control chip to form a voltage regulation closed-loop control, realizing dynamic adjustment of the output power supply voltage.
[0087] For further details, please refer to Figure 11 , Figure 11 This is a circuit diagram of the adjustable voltage isolated power supply provided in an embodiment of this application. Please refer to [link / reference]. Figure 11 The adjustable voltage isolated power supply circuit of this application takes the flyback power controller U2 as the core, and works with flyback transformer T1, isolation optocoupler U3, operational amplifier OP1A / OP2A, analog switch U13 and other devices to realize dynamic spread spectrum and voltage regulation closed-loop control.
[0088] In the circuit, P12V is the primary-side 12V input power supply. C4, R9, and R8, together with operational amplifier OP1A, realize the dynamic frequency adjustment function of the power switch. According to the technical documentation of the flyback power controller U2, the resistance from pin 6 to ground has a clear and fixed correspondence with the switching frequency. R1 is the default resistance from pin 6 to ground. When the value of R8 is much smaller than that of R9, and the value of C4 is large enough, the AC component through R9 is grounded through C4, and the DC component is grounded through R8 via operational amplifier OP1A, which is equivalent to changing the resistance from pin 6 of U2 to ground, realizing the spread spectrum function. The DAC-spread spectrum control signal is input to the non-inverting input of OP1A. R24 is the input current limiting resistor. TP3 is the test point at the output of OP1A, used to dynamically adjust the spread spectrum parameters. A3V3 is the 3.3V auxiliary power supply for pin 6 of U2, and R12 is the auxiliary power supply current limiting resistor.
[0089] In the circuit, U13 is an analog switch, FPWM-output power supply voltage is the input control signal, FA2V5 is a 2.5V reference voltage, and FD5V is the 5V power supply for U13. The FPWM-output power supply voltage is converted into a precise amplitude PWM signal with FA2V5 as the reference. This signal is then converted into a low-frequency analog signal via a 4th-order RC low-pass filter circuit composed of CP1 and RN1, with TP6 / TP7 serving as the test points before and after filtering. This analog signal is input to operational amplifier OP2A, where it is compared and amplified with the secondary-side output power supply voltage of the FP terminal after voltage division by R26 and R27. R21 and R22 are the feedback resistors of OP2A, driving the output of the isolation optocoupler U3. R15 and R19 are the current-limiting resistors of the isolation optocoupler. The isolation optocoupler U3 transmits the feedback signal to the flyback power supply controller U2, completing the partial closed-loop control of power supply voltage regulation and realizing dynamic adjustment of the output power supply voltage. FGND is the secondary ground of the isolation power supply, electrically isolated from the primary ground.
[0090] The remaining components in the circuit are standard power supply circuit configurations: D1 is the primary freewheeling diode, Q1 is the main switch of the flyback topology, D2, C12, C13, and CE2 are the output rectifier and filter circuits, R20 is the output current limiting resistor, R11, R13, and C8 are the drive protection circuits for Q1, R16, R14, C9, and C10 are the RCD snubber circuits on the primary side of the flyback transformer, CE1 and C3 are the electrolytic / ceramic filter circuits for the P12V input power supply, C7, C6, and C5 are the power supply decoupling circuits for U2, R5, R6, R7, C1, and C2 are the input voltage sampling circuits for U2, R12 is the auxiliary power supply circuit for U2, R15 and R19 are the current limiting circuits for the isolation optocoupler, R21 and R22 are the feedback resistors for OP2A, and FGND is the secondary ground of the isolation power supply.
[0091] Furthermore, this application also includes: During the phase accumulation process according to the first accumulation calculation frequency, the number of output cycles is recorded by the cycle count bit in the first phase accumulation counter; according to the preset treatment stage requirements, logical judgment and switching are performed between different modulation waveform types.
[0092] In the 32-bit register of the first phase accumulator counter, the high 8 bits are defined as the period count bits, used to record the number of complete modulation waveform cycles that have been output. Whenever the accumulator counter overflows from its maximum value and returns to zero, the period count bits are automatically incremented by one, requiring no additional interrupts or timers, resulting in almost zero overhead.
[0093] This mechanism accurately measures the number of waveform output cycles, with updates and phase accumulation perfectly synchronized, eliminating counting errors. The high 8 bits can record up to 256 cycles, meeting the needs of multi-stage treatment.
[0094] Based on the preset treatment stage requirements, the microcontroller checks whether the cycle count has reached the current stage's cycle count threshold during each accumulation. If it does, it executes a logical judgment, switches to the next waveform type, resets the cycle count, and loads the new waveform's data table and step value. The judgment and switching are performed in each accumulation cycle (15 kHz), with an additional time consumption of less than 1 microsecond.
[0095] This switching mechanism automates the execution of multi-stage treatment prescriptions without the need for intervention from a host computer. The switching occurs at the moment the waveform cycle ends and the phase returns to zero, ensuring phase continuity between the preceding and following waveforms without abrupt changes or spikes, thus improving the targeted nature and effectiveness of the treatment.
[0096] Furthermore, this application also includes: Acquire target intensity information; when the sampling task is triggered, calculate closed-loop intensity information using a proportional-integral method based on the target intensity information and the collected output current and output voltage sampling values; adjust the distribution relationship between the power supply voltage value and the output waveform proportional value based on the closed-loop intensity information.
[0097] Here, the target intensity information is sent from the Android control terminal, representing the user's desired output current intensity, and is typically stored in the microcontroller as a dimensionless percentage or integer. For example, a target intensity of 50% corresponds to half-power output. This value is used as the setpoint for closed-loop control.
[0098] When the sampling task is triggered (i.e., the fundamental phase point is located in the preset sampling section), the microcontroller reads the output current sample value and the output voltage sample value. These two values are digital quantities obtained from the analog-to-digital conversion of the sampling circuit, reflecting the instantaneous power actually applied to the electrodes. The target intensity is compared with the current output value to calculate the error value.
[0099] Closed-loop strength information is calculated using a proportional-integral (PI) method. The proportional term multiplies the current error by a proportionality coefficient, quickly responding to the output deviation; the integral term accumulates historical errors and multiplies them by an integral coefficient, eliminating steady-state errors. The PI calculation is performed at each sampling trigger, outputting a closed-loop strength adjustment. This adjustment is a dimensionless coefficient, typically ranging from 0 to 1.
[0100] The microcontroller controls two parameters simultaneously. When an increase in output intensity is needed, it prioritizes increasing the output waveform scaling factor (i.e., the product of the modulation value and the fundamental frequency value). If the scaling factor is already close to its upper limit and still insufficient, it increases the voltage of the adjustable isolation power supply. Conversely, when reducing intensity, it prioritizes decreasing the power supply voltage, and then decreases the scaling factor.
[0101] In this embodiment, the target operating range [Pmin, Pmax] (e.g., [0.3, 0.8]) for the proportional gain and the operating range [Vmin, Vmax] for the power supply voltage can be preset. The target output power is obtained after the closed-loop strength information is calculated using proportional-integral methods. The system first adjusts the proportional gain to make it fall within the target range, and then adjusts the power supply voltage to match the remaining power demand, thereby maintaining the proportional gain always within the efficient operating range.
[0102] This coordination strategy avoids the inefficient operating condition of "high power supply voltage, low ratio value" and reduces the heat generation of the power transistor.
[0103] This closed-loop control achieves precise adjustment of output intensity and optimization of power consumption. Compared with traditional solutions that only adjust the power supply voltage or duty cycle, dual-parameter coordination improves power conversion efficiency while ensuring waveform quality. Because the sampling trigger is synchronized with the fundamental frequency period, the control quantity can be updated once in each cycle, resulting in fast response and smooth, shock-free intensity changes perceived by the patient. In addition, the proportional-integral algorithm eliminates output fluctuations caused by changes in skin impedance, ensuring long-term stability of treatment parameters.
[0104] For further details, please refer to Figure 12 , Figure 12 This is a flowchart illustrating the acquisition and return of output current and output voltage sample values provided in an embodiment of this application. Figure 12 As shown, the output current sample value and output voltage sample value are acquired and transmitted back in the following manner: S401. After dividing the output voltage, subtract it from the reference voltage to obtain the output voltage sample value.
[0105] The output of the electrotherapy device is a high-voltage differential signal, which cannot be directly fed into the analog-to-digital converter of the microcontroller. This step uses a resistor divider network to reduce the output voltage to a safe range. For example, by using two high-resistance resistors in series to divide the voltage, the voltage of hundreds of volts can be reduced to 0 to 3.3 volts. Since the output signal is referenced to the floating ground FGND, and the subtraction circuit is referenced to the low-voltage reference point FA2V5 (2.5 volts), it is necessary to subtract the divided signal from the reference point FA2V5 to eliminate common-mode offset. Specifically, 2.5 volts is subtracted from both the waveform signal and the polarity signal after voltage division, and then subtracted again by a differential amplifier to obtain the output voltage sample value with FA2V5 as the reference. This sample value is an analog voltage, typically ranging from 0 to 2.5 volts, representing the instantaneous amplitude of the output signal.
[0106] This sampling circuit enables voltage detection from the high-voltage output to the low-voltage microcontroller without the need for an expensive isolation amplifier. Subtraction eliminates ground level differences, ensuring sampling accuracy. With a 1% accuracy voltage divider resistor, the sampling error can be controlled within 2%, meeting closed-loop control requirements. The sampled output voltage value is then fed to a comparator for conversion into a pulse-width modulated signal.
[0107] S402. After half-wave rectification of the output current, it is low-pass filtered and then subtracted from the reference voltage to obtain the output current sample value.
[0108] The output current is obtained through a sampling resistor R51 under the low-side MOSFET of the power amplifier, which converts the output current into a negative peak voltage. Since this voltage may be negative and exceeds the microcontroller's input range, it is first half-wave rectified by a comparator: the sampled voltage is compared with FGND; if it is greater than FGND, an analog switch is turned on to send the signal to the next stage; otherwise, FGND is sent to the next stage. The rectified signal is filtered by a SallenKey low-pass filter to remove high-frequency noise, and then subtracted from the reference point FA2V5 by a subtraction circuit to remove DC offset, finally obtaining the output current sample value with FA2V5 as the reference. This value is an analog voltage proportional to the instantaneous absolute value of the output current.
[0109] Half-wave rectification combined with low-pass filtering extracts the average envelope of the output current, avoiding high-frequency switching noise interference. The value of the sampling resistor R51 is designed to ensure that the negative voltage peak is within the allowable range of the comparator and analog switch (typically -0.3V to +5V). The sampled output current value reflects the magnitude of the actual load current and is used for power calculation in closed-loop control.
[0110] S403. Compare the output voltage sample value and the output current sample value with the reference triangular wave respectively, and convert them into pulse width modulation signals.
[0111] The reference triangular wave is generated by integrating a square wave with a 50% duty cycle using an integrator circuit. Its frequency is adjustable, and its amplitude is inversely proportional to the frequency. The output voltage and current samples are input to the positive terminals of two comparators, respectively, while the reference triangular wave is input to the negative terminal of the comparators. When the sampled value is higher than the triangular wave value, the comparator outputs a high level; when it is lower, it outputs a low level. This converts the analog sampled signal into a pulse width modulation (PWM) signal with a duty cycle proportional to the sampled value. The conversion gain can be adjusted by changing the frequency of the triangular wave: reducing the frequency and increasing the amplitude of the triangular wave at low output strength improves the resolution in the low-signal region.
[0112] This conversion achieves a linear transformation from analog signals to digital pulses without the need for an analog-to-digital converter. The PWM signal possesses the noise immunity of digital signals, making it suitable for long-distance transmission. Since the triangular wave frequency can be selected from 100 kHz to 500 kHz, the update rate of the PWM output is much higher than the rate of change of the sampled signal, ensuring the integrity of the sampled information.
[0113] S404 transmits the pulse width modulation signal back to the microcontroller after digital isolation.
[0114] The PWM signal at the high-voltage end is transmitted to the low-voltage end via a digital isolator (such as a capacitive or magnetic isolation chip). The digital isolator receives the PWM logic level at its input and restores it to a digital signal in phase at its output. The electrical isolation withstand voltage is typically several kilovolts, ensuring user safety. The PWM signal at the low-voltage end is then converted to a precise amplitude (e.g., 0 to 3.3 volts) PWM signal by an analog switch, and finally restored to an analog voltage by a low-pass filter (such as a two-stage SallenKey topology), which is then sent to the microcontroller's analog-to-digital converter for reading. The microcontroller obtains the output voltage and current sample values by measuring the PWM duty cycle or directly reading the filtered analog value.
[0115] Digital isolation transmission avoids the nonlinear distortion and temperature drift problems common in analog signal isolation. The transmission delay of the isolation device is typically tens of nanoseconds, which has a negligible impact on 500 kHz PWM signals. The sampled values fed back to the microcontroller are used for proportional-integral closed-loop control to achieve real-time adjustment of the output intensity. Compared with traditional transformer sampling, this solution can completely transmit signals containing DC components, and has a higher isolation voltage and smaller size, making it suitable for portable devices.
[0116] For further details, please refer to Figure 13 , Figure 13 This is a schematic block diagram of the output sampling circuit provided in an embodiment of this application. Please refer to [link / reference]. Figure 13This application uses an integrating circuit to convert a 50% duty cycle PWM into a triangular wave, which is then compared with the pre-modulated output current and output voltage signals. This is converted back to a PWM wave via digital isolation and sent to the microcontroller. An analog switch converts this to a precise amplitude PWM, which is then low-pass filtered before being sent to the microcontroller for conversion. In the circuit, the F-waveform output and F-polarity output are sampled by an output voltage sampling module to obtain the F-output voltage sampling signal; the F-output current is sampled by an output current sampling module to obtain the F-output current sampling signal. These two sampling signals, along with the triangular wave output from the reference triangular wave generator, are input to a comparator group to compare and output the FPWM-output voltage and FPWM-output current signals. Simultaneously, the FPWM-feedback gain signal is input to the reference triangular wave generator to achieve feedback gain adjustment. All FPWM signals are digitally isolated, outputting PWM-output voltage, PWM-output current, and PWM-feedback gain signals. These are then filtered by a low-pass filter group, ultimately outputting the ADC-output voltage and ADC-output current signals, which are sent to the microcontroller to complete subsequent closed-loop control.
[0117] For further details, please refer to Figure 14 , Figure 14 This is a circuit diagram of the output voltage sampling and subtraction method provided in an embodiment of this application. Please refer to [link / reference]. Figure 14 The output voltage sampling circuit of this application performs subtraction operations through a voltage divider structure to achieve effective acquisition of differential output signals.
[0118] In the circuit, the F-waveform output is the waveform signal from the differential output of the electrotherapy device. This signal is divided by voltage divider resistors R61 and R62, with FGND serving as the secondary ground of the isolation power supply and acting as the reference ground for the voltage divider circuit. The F-polarity output is the polarity signal from the differential output of the electrotherapy device. This signal is divided by voltage divider resistors R63 and R64, with FGND also serving as the reference point. After voltage division, the voltage at the upper node of R62 is UR62, and the voltage at the upper node of R64 is UR64. These two signals are input to operational amplifier OP4B, forming a subtraction circuit with an instrumentation amplifier structure. For the effective input values of the subtraction circuit, UR62-FA2V5 and UR64-FA2V5, FA2V5 is a 2.5V DC reference voltage, connected to the non-inverting input of OP4B via resistor R67, serving as the reference for the entire sampling circuit.
[0119] The circuit configuration meets the following requirements: F-output voltage sampling = R67 / (R65+R67)×(1+R68 / R66)×(UR62-FA2V5)-R68 / R66×(UR64-FA2V5). Where R65 and R67 are the voltage divider resistors at the non-inverting input of the OP4B, and R66 and R68 are the feedback resistors at the inverting input of the OP4B. When R65, R66, R67, and R68 have the same resistance value and are much larger than the resistance values of R62 and R64, the circuit is simplified, and its effective output value is simplified to: F-output voltage sampling = UR62-UR64. This circuit configuration uses FA2V5 as the reference point, accurately realizing single-ended sampling and level conversion of the output voltage differential signal. F-output voltage sampling is the final output sampling signal, used for subsequent output strength closed-loop control, providing a precise analog feedback signal for closed-loop adjustment.
[0120] For further details, please refer to Figure 15 , Figure 15 This is a circuit diagram of the output current sampling circuit provided in an embodiment of this application. Please refer to [link / reference]. Figure 15 The output current sampling circuit of this application achieves effective acquisition of differential output current signals through half-wave rectification, low-pass filtering and subtraction operation.
[0121] In the circuit, the F-output current signal originates from the polarity terminal of the single-inductor Class D power amplifier. It is a differential output current sampling signal, which is compared with FGND (secondary ground of the isolation power supply) through comparator U18 to perform half-wave rectification logic. U18 is a high-speed comparator. Its pin 3 IN+ is connected to the F-output current, pin 4 IN- is connected to FGND, pin 5 VCC is connected to FDSV (secondary 5V power supply), pin 2 GND is connected to FGND, and pin 1 OUT outputs the comparison result. If the F-output current is greater than FGND, U18 outputs a high level, controlling analog switch U21 to connect the F-output current to the subsequent circuit. If the F-output current is less than FGND, U18 outputs a low level, controlling U21 to connect FGND to the subsequent circuit, realizing effective rectification of the positive and negative half-waves. U21 is a single-pole double-throw analog switch. Its 4th pin COM is the common terminal, the 1st pin NO is connected to F- for output current, the 2nd pin GND is connected to FGND, the 5th pin V+ is connected to FDSV, the 6th pin IN is connected to the 1st pin OUT of U18, and the 3rd pin NC is an unused pin.
[0122] The rectified signal is processed by a Sallen-Key low-pass filter topology consisting of resistors R50, R53, C52, C54, R54, and R55. R50 and R53 are series current-limiting resistors, C52 is an AC coupling capacitor, and C54, R54, and R55, together with operational amplifier OP3A, form an active low-pass filter structure, resulting in a stable DC signal UOP3A referenced to FGND. OP3A is a non-inverting active low-pass filter operational amplifier; pin 3 is the non-inverting input, pin 2 is the inverting input, and pin 1 is the output.
[0123] This signal is input to operational amplifier OP3B, and works in conjunction with a subtraction network composed of resistors R57, R59, R58, and R60: R57 and R59 are voltage divider resistors at the non-inverting input, converting FA2V5 (2.5V DC reference voltage) to a reference level; R58 and R60 are feedback resistors at the inverting input, with FA2V5 as the reference point, ultimately outputting the F-output current sampling signal. This signal, along with the F-output voltage sampling signal, is fed into the microcontroller, providing precise current feedback for closed-loop control of the output strength.
[0124] For further details, please refer to Figure 16 , Figure 16 This is a reference triangular wave generator circuit diagram provided for an embodiment of this application. Please refer to... Figure 16 The reference triangular wave in this application is obtained by integrating the PWM signal with a 50% duty cycle using an integrator circuit.
[0125] In the circuit, the FPWM feedback gain is the 50% duty cycle PWM control signal from the microcontroller, input to pin 6 (IN) of analog switch U14. U14 is a single-pole double-throw analog switch; its pin 5 (V+) is connected to FD5V (secondary 5V power supply), pins 2 (GND) and 3 (NC) are connected to FGND (isolation power supply secondary ground), pin 1 (NO) is connected to FA2V5 (2.5V DC reference voltage), and pin 4 (COM) is the common output terminal. When the FPWM feedback gain is high, U14 connects FA2V5 to the subsequent circuit; when the FPWM feedback gain is low, U14 connects FGND to the subsequent circuit, realizing the level conversion of the PWM signal.
[0126] The converted signal is input to the subsequent circuit via C40 (AC coupling capacitor, isolating the DC component). R44 is an adjustable potentiometer, with its upper end connected to FA2V5 and its lower end connected to the output of C40, used to adjust the DC bias and gain of the integrator circuit. The signal is input to the inverting input (pin 6) and non-inverting input (pin 5) of operational amplifier OP5B via R45 and R46 respectively. Together with the integrator feedback network composed of R47 and C44, a non-inverting integrator circuit is formed to generate a reference triangular wave. OP5B is an operational amplifier, with pin 5 as the non-inverting input, pin 6 as the inverting input, and pin 7 as the output. R47 and C44 are connected between the output and the inverting input to form an integrator feedback loop.
[0127] The output amplitude of the reference triangular wave is inversely proportional to its frequency. The amplitude can be controlled by changing the frequency of the reference triangular wave, thereby changing the gain from sampling to PWM. A larger gain is used when the output intensity is low to reduce feedback error.
[0128] For further details, please refer to Figure 17 , Figure 17This is a circuit diagram of a comparator group provided for an embodiment of this application. Please refer to [link / reference]. Figure 17 Before isolation transmission, the F-output voltage sample and F-output current sample are compared with the reference triangular wave and converted into PWM signals.
[0129] In the circuit, FPWM-output voltage is the PWM input signal for output voltage closed-loop control, and FPWM-output current is the PWM input signal for output current closed-loop control; F-output voltage sampling and F-output current sampling are analog feedback signals processed by the preceding circuit. These signals are input to analog switches U15 and U16 respectively: U15 is a single-pole double-throw analog switch, with pin 5 (VCC) connected to FD5V (secondary 5V power supply), pin 2 (GND) connected to FGND (isolation power supply secondary ground), pin 3 (IN+) connected to F-output voltage sampling, and pin 1 (OUT) outputting FPWM-output voltage; U16 is also a single-pole double-throw analog switch, with pin 5 (VCC) connected to FD5V, pin 2 (GND) connected to FGND, pin 3 (IN+) connected to F-output current sampling, and pin 1 (OUT) outputting FPWM-output current.
[0130] The outputs of the two switches are pulled up to FA2V5 (2.5V DC reference voltage) through R42 and R43 respectively. They are then combined with the reference triangular wave through C42 and C43 (AC coupling capacitors used to transmit the reference triangular wave signal and isolate DC interference) to realize the comparison logic between the sampled signal and the reference triangular wave. Finally, the corresponding PWM signal is output, which is sent back to the microcontroller after digital isolation to complete the isolated transmission and subsequent processing of the sampled signal.
[0131] For further details, please refer to Figure 18 , Figure 18 This is a low-pass filter circuit diagram provided for an embodiment of this application. Please refer to [link / reference]. Figure 18 After digital isolation, the PWM output current signal (from the isolated output PWM signal of the front comparator group) is converted into a precise amplitude PWM signal based on FA2V5 (2.5V DC reference voltage) by analog switch U9. After being processed by low-pass filter, the ADC output current signal is output and sent to the microcontroller to complete the acquisition.
[0132] U9 is a single-pole double-throw analog switch. Its V+ terminal is connected to FD5V (secondary 5V power supply), GND terminal is connected to FGND (isolation power supply secondary ground), NO terminal is connected to FA2V5, COM terminal is the signal output terminal, and IN terminal is connected to the PWM-output current input signal. When the PWM-output current is high, U9 connects FA2V5 to the subsequent stage, and when it is low, it connects to FGND to achieve amplitude standardization of the PWM signal.
[0133] The circuit employs a two-stage Sallen-Key low-pass filter topology, with integrated amplification in the later stage and an additional RC topology for buffering at the output. The first stage consists of R2 and R4 as series current-limiting resistors, C28 and C30 as filter capacitors, and an operational amplifier OP7A. The OP7A is a non-inverting active filter structure that achieves high-frequency noise filtering and signal buffering in the first stage. The second stage consists of R23 and R34 as series current-limiting resistors, C34 and C35 as filter capacitors, and an operational amplifier OP7B. The OP7B integrates non-inverting amplification. The two-stage filtering works together to effectively filter high-frequency switching noise while simultaneously amplifying the signal.
[0134] Finally, the RC buffer circuit composed of R40 and C38 filters out residual high-frequency ripple, outputting a stable ADC sampling signal, providing accurate analog input for output strength closed-loop control. The power supply terminals of OP7A and OP7B are both connected to FD5V, with FGND as the reference ground. The entire circuit uses FA2V5 as the DC bias reference to ensure that the level of the sampling signal matches the input range of the microcontroller's ADC.
[0135] For further details, please refer to Figure 19 , Figure 19 This is a block diagram illustrating the principle of closed-loop control of the output intensity of the electrotherapy device provided in this embodiment of the application. Please refer to... Figure 19 The output intensity closed-loop control is executed when the closed-loop adjustment task is triggered or called by the operating system. Using the target intensity information sent from the Android control terminal, the output current conversion value converted by the ADC, and the output voltage conversion value, the current closed-loop intensity information is calculated using a proportional-integral method. Then, a power supply voltage-waveform proportional trade-off calculation is performed. Since the power supply voltage and waveform control of the electrotherapy device can directly adjust the output intensity, this trade-off avoids situations where high power supply voltage occurs simultaneously with low output amplitude, improving waveform quality and reducing heat generation. Finally, the overall waveform proportion and output power supply voltage value are calculated.
[0136] For further details, please refer to Figure 20 , Figure 20 This is a schematic block diagram of a single-inductor Class D power amplifier provided in an embodiment of this application. Please refer to [link / reference]. Figure 20 The single-inductor Class D power amplifier of this application uses a power switch group composed of two power half-bridges, in conjunction with a single-inductor modulation filter network, to output differential electrotherapy signals. The PWM (electrotherapy waveform) and GPIO (electrotherapy polarity) signals are digitally isolated and output as FPWM (electrotherapy waveform) and FGPIO (electrotherapy polarity). These two signals are input to a polarity synchronization module, and after synchronization, drive the power switch group. The output of the power switch group passes through the single-inductor modulation filter network, ultimately outputting an electrotherapy signal that meets the requirements.
[0137] For further details, please refer to Figure 21 , Figure 21This is a circuit schematic diagram of a single-inductor Class D power amplifier provided in an embodiment of this application. Please refer to [link / reference]. Figure 21 The single-inductor Class D power amplifier circuit of this application uses an XOR gate U12, an integrated power half-bridge U20, and a half-bridge driver U19 as core components, and works with a single inductor L2 and an output filter capacitor to achieve accurate output of electrotherapy signals.
[0138] In the circuit, the FPWM-electrotherapy waveform is the PWM control signal for converting the fundamental waveform's proportional value, and the FPWM-electrotherapy polarity is the GPIO control signal for converting the waveform's polarity value, both input to the XOR gate U12. U12 is an XOR gate chip; pin 1 (INA) connects to the FPWM-electrotherapy waveform, pin 2 (INB) connects to the FPWM-electrotherapy polarity signal after passing through the RC delay circuit composed of R41 and C39, pin 3 (GND) connects to FGND (secondary ground of the isolation power supply), pin 5 (VCC) connects to FD5V (secondary 5V power supply), and pin 4 (OUT) outputs the polarity-aligned control signal. According to the logic of the fundamental waveform phase accumulation algorithm, the output of the fundamental waveform's proportional value and the waveform's polarity value are not synchronized, and the hardware path delays of the two signals are inconsistent. This application uses the RC delay circuit composed of R41 and C39 to match the time difference between the two signals, and then uses the XOR gate U12 for polarity alignment, enabling the two power half-bridges to simultaneously flip their polarities. This design avoids performance-intensive delay matching in the software algorithm, effectively reducing the computational overhead of the microcontroller.
[0139] In the circuit, the integrated power half-bridge U20, together with the half-bridge driver U19, drives the power switching transistors Q2 and Q3. U19 is the half-bridge driver; pin 1 (VCC) is connected to FD5V; pin 2 (IN) is connected to FPWM (for polarity adjustment); pin 3 (SD) is connected to FGND; pin 4 (GND) is connected to FGND; pin 5 (LO) drives the lower transistor Q3; pin 7 (HO) drives the upper transistor Q2; and pin 8 (VB) is the bootstrap power supply. D3 is the bootstrap diode, and C46 and C49 are bootstrap capacitors, which, together with U19, form the bootstrap drive circuit, providing floating ground drive power for the upper transistor Q2. R48 and R49 are the gate drive resistors for Q2, and R56 is the gate drive resistor for Q3, used to suppress gate oscillation. The analog switch U17, together with related circuitry, generates the dead time in hardware. U17 is a multi-channel analog switch; pins 6-10 are the power supply and control terminals, and pins 1-4 are the signal terminals. Hardware logic generates the dead time for the half-bridge drive, preventing shoot-through between the upper and lower transistors. U20 is an integrated power half-bridge. Pin 1 (VCC) is connected to FD5V, pin 3 (HIN) and pin 2 (LIN) are connected to the drive signals output by U17, pin 8 (VS) is connected to FP (positive voltage output from the secondary side of the isolation power supply), pin 7 (BOOT) is connected to the bootstrap capacitor C51, and pin 6 (OUT) is the half-bridge output terminal.
[0140] The output end adopts a passive LC filter network, which consists of two-stage filter circuits composed of inductors L2 and L3 and capacitors C58 and C59. This configuration uses a large inductance and a small capacitance value, which is particularly suitable for the application scenario of high voltage and low current in electrotherapy. It effectively filters out high frequency switching noise and finally outputs two differential electrotherapy signals: FOUT-waveform output and FOUT-polarity output.
[0141] In the circuit, R51 is a current sampling resistor, connected in series between the source of Q3 and FGND, used for sampling the output current. After the sampled signal is processed by the RC low-pass filter circuit composed of R52 and C53, a stable F-output current feedback signal is obtained, which is used for subsequent output strength closed-loop control.
[0142] For further details, please refer to Figure 22 , Figure 22 This is a schematic diagram of key waveforms for a single-inductor Class D power amplifier provided in an embodiment of this application. Please refer to... Figure 22 The waveform generation process of a single-inductor Class D power amplifier begins with the target waveform. This target waveform is modulated to generate PWM waveform terminals and logic level polarity waveforms. The polarity alignment function combines the two waveforms in the second column into a PWM signal corresponding to the waveform in the first row of the third column. After being output through a power half-bridge, the final electrotherapy differential output waveform is obtained. This waveform transformation process fully realizes the accurate generation and output of the electrotherapy signal, ensuring the quality and stability of the output waveform.
[0143] The waveform control method, apparatus, electronic device, and medium for an electrotherapy device provided in this application, compared with the prior art methods that use operating system scheduling for plotting output or dedicated waveform synthesis chips, generate modulation values and fundamental values through two independent phase accumulation processes. During the accumulation of the fundamental value, a segment check is embedded to trigger a sampling task. Finally, the modulation value and the fundamental value are multiplied to obtain the output waveform ratio. This application eliminates the need for expensive dedicated chips and multiple dedicated modulation circuits, significantly improving frequency accuracy and achieving cycle-by-cycle synchronous sampling feedback. Simultaneously, it reduces hardware integration and power consumption, facilitating the portable design of the electrotherapy device.
[0144] This application achieves flexible waveform modulation, high frequency accuracy, and timely sampling feedback through a direct digital synthesis algorithm. The software datasheet is modifiable, allowing for waveform updates and expansion via remote control via an Android control terminal, making it easier to upgrade compared to hardware synthesis methods. In terms of control architecture, the microcontroller directly controls the output power stage switching topology, eliminating the intermediate step of modulating the analog waveform before amplification by the power stage, simplifying the signal chain and improving integration. The power stage switching signal is software-controlled, enabling spread spectrum operation on the power switch to reduce radiated emission peaks. Regarding the power amplifier topology, a Class D power amplifier structure with single-inductor filtering is adopted, which reduces switching losses, radiated emission energy, filter device space, and output internal resistance compared to full-bridge differential drive or bridge-type Class AB schemes. In terms of signal transmission and isolation, the advantages of easy isolation and reception of pulse-width modulation (PWM) signals are utilized. Sensitive analog signals have short transmission paths, and long-distance transmission and isolation are primarily achieved using digital PWM signals, solving the problem of analog information isolation transmission. The overall device exhibits strong anti-interference performance. Furthermore, the combination of direct microcontroller control and a single-inductor Class D power amplifier design results in high integration, portability, and ease of carrying. The general-purpose microcontroller, Saleenkai low-pass filter, and integrated power half-bridge used in this application are not dedicated circuits; their specific characteristic parameter selections are the result of optimization and trade-offs and are not intended to limit the scope of protection.
[0145] Based on the same inventive concept, this application also provides a waveform control device for an electrotherapy device corresponding to the waveform control method of the electrotherapy device. Since the principle of the device in this application is similar to the waveform control method of the electrotherapy device described above in this application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.
[0146] Please see Figure 23 , Figure 23 This is a schematic diagram of the waveform control device of the electrotherapy device provided in an embodiment of this application. Figure 23 As shown, the waveform control device 500 of the electrotherapy device includes: The modulation value acquisition module 501 is used to perform phase accumulation according to the first accumulation calculation frequency, and to obtain the modulation value by looking up a table based on the accumulated phase point. The fundamental value acquisition module 502 is used to perform phase accumulation according to the second accumulation calculation frequency, look up the fundamental value according to the accumulated phase point to obtain the fundamental value, and perform segment check on the current fundamental phase point during the accumulation process. When the current fundamental phase point is located in the preset sampling segment, the sampling task is triggered. The waveform scaling output module 503 is used to obtain the output waveform scaling value based on the modulation value and the fundamental value.
[0147] Please see Figure 24 , Figure 24 This is a schematic diagram of the structure of the electronic device provided in an embodiment of this application. Figure 24 As shown, the electronic device 300 includes a processor 310, a memory 320, and a bus 330.
[0148] The memory 320 stores machine-readable instructions executable by the processor 310. When the electronic device 300 is running, the processor 310 and the memory 320 communicate via the bus 330. When the machine-readable instructions are executed by the processor 310, they can perform the operations described above. Figure 2 The steps of the waveform control method of the electrotherapy device in the method embodiment shown are described in detail in the method embodiment, and will not be repeated here.
[0149] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, can perform the above-described actions. Figure 2 The steps of the waveform control method of the electrotherapy device in the method embodiment shown are described in detail in the method embodiment, and will not be repeated here.
[0150] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0151] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the shown or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.
[0152] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0153] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0154] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0155] Finally, it should be noted that the above-described embodiments are merely specific implementations of this application, used to illustrate the technical solutions of this application, and not to limit them. The scope of protection of this application is not limited thereto. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this application. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A waveform control method for an electrotherapy device, characterized in that, include: Phase accumulation is performed according to the first accumulation calculation frequency, and the modulation value is obtained by looking up the table based on the accumulated phase points; Phase accumulation is performed according to the second accumulation calculation frequency. The fundamental wave value is obtained by looking up a table based on the accumulated phase point. During the process of accumulating to obtain the current fundamental wave phase point, a segment check is performed on the current fundamental wave phase point. When the current fundamental wave phase point is located in a preset sampling segment, a sampling task is triggered. The segment check also includes a polarity segment check: when the current fundamental phase point is located in a preset polarity segment, the waveform polarity value is modified to a positive or negative value; The output waveform ratio is obtained based on the modulation value and the fundamental frequency value. Also includes: Obtain target intensity information; When the sampling task is triggered, the closed-loop strength information is calculated by proportional-integral method based on the target strength information and the collected output current and output voltage sampling values. Based on the closed-loop strength information, adjust the distribution relationship between the power supply voltage value and the output waveform ratio value.
2. The method according to claim 1, characterized in that, The step of performing phase accumulation according to the first accumulation calculation frequency, and obtaining the modulation value by looking up a table based on the accumulated phase points, includes: The first phase step value is determined based on the frequency of the externally input modulation waveform; According to the first accumulation calculation frequency, the first phase accumulation counter is accumulated with the first phase step value to obtain the current modulation phase point; A modulation waveform data table is established based on the modulation waveform type input from the outside. The modulation waveform data table records the amplitude value corresponding to each phase point within a complete cycle. The amplitude value corresponding to the current modulation phase point is retrieved from the modulation waveform data table and used as the modulation value.
3. The method according to claim 1, characterized in that, The fundamental frequency value is obtained in the following way: The second phase step value is determined based on the fundamental frequency input from the outside. According to the second accumulation calculation frequency, the second phase accumulation counter is accumulated with the second phase step value to obtain the current fundamental phase point; A fundamental waveform data table is established based on the fundamental waveform type input from the outside. The fundamental waveform data table records the amplitude value corresponding to each phase point within a complete cycle. The amplitude value corresponding to the current fundamental phase point is retrieved from the fundamental waveform data table and used as the fundamental value.
4. The method according to claim 1, characterized in that, Also includes: During the phase accumulation process according to the first accumulation calculation frequency, the number of output cycles is recorded by the cycle count bit in the first phase accumulation counter. Based on the preset treatment stage requirements, logical judgments and switching are performed between different modulation waveform types.
5. The method according to claim 1, characterized in that, The output current sample value and the output voltage sample value are acquired and transmitted back using the following method: After dividing the output voltage, subtract it from the reference voltage to obtain the sampled output voltage value; The output current is half-wave rectified and then low-pass filtered. Then it is subtracted from the reference voltage to obtain the output current sample value. The output voltage and output current samples are compared with a reference triangular wave and converted into pulse width modulation signals. The pulse width modulation signal is digitally isolated and then transmitted back to the microcontroller.
6. A waveform control device for an electrotherapy instrument, characterized in that, include: The modulation value acquisition module is used to perform phase accumulation according to the first accumulation calculation frequency, and to obtain the modulation value by looking up a table based on the accumulated phase point; The fundamental wave value acquisition module is used to perform phase accumulation according to the second accumulation calculation frequency, look up the fundamental wave value according to the accumulated phase point in the table, and perform segment check on the current fundamental wave phase point during the accumulation process. When the current fundamental wave phase point is located in the preset sampling segment, the sampling task is triggered. The segment check also includes a polarity segment check: when the current fundamental phase point is located in a preset polarity segment, the waveform polarity value is modified to a positive or negative value; A waveform scaling output module is used to obtain an output waveform scaling value based on the modulation value and the fundamental value. The waveform proportional output module is also used to acquire target intensity information; when the sampling task is triggered, it calculates closed-loop intensity information by proportional-integral method based on the target intensity information and the acquired output current sampling value and output voltage sampling value; and adjusts the distribution relationship between the power supply voltage value and the output waveform proportional value based on the closed-loop intensity information.
7. An electronic device, characterized in that, include: The device includes a processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is in operation, the processor communicates with the memory via the bus, and the processor executes the machine-readable instructions to perform the steps of the method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the method as described in any one of claims 1 to 5.