LED driving power supply current detection method and system based on electrical sensing

CN122962278APending Publication Date: 2026-10-23SHANGHAI YOUTON ELECTRONIC TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611072092.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-20
Publication Date
2026-10-23

AI Technical Summary

Technical Problem

这类方案在温度环境变化时,采样电阻阻值的温漂会直接引入测量偏差,且未能对回路电流中的稳态与暂态区间加以区分,导致电流有效值的计算在动态工况下出现较大误差

Benefits of technology

对瞬态电流分布矩阵中的每个元素进行温度漂移补偿时,利用电学传感器中内置的参考电阻网络,读取各参考电阻在当前温度下的实测阻值并与标准阻值比较,得到各参考电阻的阻值漂移率。再将各采样点的瞬态电流分量按照其与参考电阻网络中各参考电阻的物理距离进行加权,生成各采样点特有的综合漂移修正系数。以该系数的倒数乘以对应瞬态电流元素,完成自适应补偿。该方案不依赖于单一环境温度传感器,而是基于阵列内部参考电阻网络的实际阻值变化,在传感器阵列存在局部温度差异的条件下,能够为不同空间位置的采样点分别提供差异化的漂移修正量,有效减小了多点采样时因热场不均匀导致的测量不一致性,使补偿后的电流向量在整个检测区域内保持较高的温度稳定性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122962278A_ABST
    Figure CN122962278A_ABST
Patent Text Reader

Abstract

The application discloses a LED driving power current detection method and system based on electrical sensing, and belongs to the technical field of LED driving power current detection. The method collects initial voltage signal sequences of multiple sampling points in a LED driving power output loop through an electrical sensor array; constructs a transient current distribution matrix according to voltage signals of all the sampling points; compensates each element in the matrix for temperature drift by using a reference resistance network in the sensor to generate a compensated current vector; segments the compensated current vector in a time domain, and marks each segmented current change rate as a steady state section or a transient state section; calculates a first current effective value by using a low-frequency integration algorithm for the steady state section, and calculates a second current effective value by using a high-frequency pulse counting algorithm for the transient state section; and fuses the two effective values in a time sequence to generate a continuous current detection output. The application realizes segmented adaptive detection of current parameters under steady state and transient state conditions, and improves the accuracy and response speed of current detection in a full working condition range.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of LED driver power supply current detection technology, specifically to an LED driver power supply current detection method and system based on electrical sensing. Background Technology

[0002] LED driver power supplies mostly operate in high-frequency switching mode, and the output circuit current contains complex steady-state and transient components. Accurate detection of these current components is a prerequisite for evaluating driver power supply performance and implementing load protection and dimming control. Currently, the detection of LED driver power supply circuit current mostly relies on a single sensor or sampling resistor, directly converting the acquired voltage signal into a current value, and then using the root mean square algorithm or averaging algorithm to calculate the effective current value. With this approach, the temperature drift of the sampling resistor value directly introduces measurement deviation when the temperature environment changes, and it fails to distinguish between the steady-state and transient regions in the circuit current, resulting in significant errors in the calculation of the effective current value under dynamic operating conditions. Some improvements introduce external temperature sensors to compensate for the temperature drift of the sampling resistor, but the compensation model relies on a single temperature measurement point and cannot reflect the inconsistencies in local temperature drift caused by the physical location differences of sampling points in a multi-point sensor array. Furthermore, existing current detection methods generally employ a fixed sampling rate and a uniform effective value calculation strategy. When the current waveform exhibits low-frequency, small-amplitude fluctuations in the steady-state region and high-frequency, large-amplitude pulses in the transient region, it becomes difficult to simultaneously achieve both noise suppression capabilities for slowly changing signals and accuracy in capturing rapid transient events. This results in a contradiction between dynamic response and steady-state accuracy in the final continuous current detection output. These problems are particularly prominent in applications involving LED driver power supplies with frequent load switching, dimming processes, and intermittent fault monitoring. A current detection scheme is needed that can adaptively compensate for temperature drift in multi-point sampling arrays and differentiate between steady-state and transient regions based on current change characteristics, applying targeted calculation methods to each. Summary of the Invention

[0003] This invention provides a current detection method and system for LED driver power supply based on electrical sensing. It realizes adaptive compensation for temperature drift under a multi-sampling point array, and distinguishes between steady-state and transient segments of the compensated current vector. The effective values ​​of each segment are calculated by low-frequency integration algorithm and high-frequency pulse counting algorithm, thereby obtaining accurate and continuous current detection output.

[0004] To achieve the above objectives, the present invention provides the following technical solution: The present invention provides a current detection method for LED driver power supply based on electrical sensing, comprising: acquiring initial voltage signal sequences of multiple sampling points in the output circuit of the LED driver power supply through an electrical sensor array; constructing a transient current distribution matrix of the driver power supply based on the initial voltage signal sequences of all sampling points; using a reference resistor network built into the electrical sensor to perform temperature drift compensation on each element in the transient current distribution matrix to generate a compensation current vector; dividing the compensation current vector into time-domain segments, and marking each segment as a steady-state segment or a transient segment according to the current change rate of each segment; calculating the first effective current value for the steady-state segment using a low-frequency integration algorithm, and calculating the second effective current value for the transient segment using a high-frequency pulse counting algorithm; and fusing the first effective current value and the second effective current value in time order to generate a continuous current detection output of the driver power supply.

[0005] This method utilizes an electrical sensor array to achieve multi-point synchronous voltage acquisition and construct a transient current distribution matrix. This matrix comprehensively reflects the spatial distribution characteristics of the current in the drive power supply output circuit, providing spatial dimension information for subsequent compensation and analysis. A built-in reference resistor network is used to obtain a comprehensive drift correction coefficient based on the physical distance between each sampling point and the reference resistor. This coefficient is then used to compensate for temperature drift in the matrix elements, ensuring that the current detection results maintain high accuracy even with changes in ambient temperature and effectively suppressing temperature-induced measurement errors.

[0006] To further define the acquisition process, the preferred method for acquiring the initial voltage signal sequence of multiple sampling points in the output circuit of the LED driver power supply using an electrical sensor array is as follows: each electrical sensor in the electrical sensor array is installed at multiple sampling points in the output circuit, with each sampling point corresponding to an independent voltage acquisition channel; all voltage acquisition channels are simultaneously activated, acquiring the analog voltage signals of each sampling point at the same sampling frequency; anti-aliasing filtering and analog-to-digital conversion are performed on each analog voltage signal to obtain the initial digital voltage sequence corresponding to each sampling point; all initial digital voltage sequences are arranged in order of sampling point number to form an initial voltage signal sequence group. Through fully synchronous acquisition and anti-aliasing filtering, the temporal consistency and frequency domain purity of the data from each channel are ensured, laying the foundation for constructing an accurate transient current distribution matrix.

[0007] As a preferred method for constructing the transient current distribution matrix, the specific process includes: extracting the voltage difference between two adjacent sampling times in the initial voltage signal sequence of each sampling point as the voltage change feature value of that sampling point; dividing the voltage change feature value of each sampling point by the known equivalent internal resistance of the electrical sensor corresponding to that sampling point to obtain the transient current component of each sampling point; arranging the transient current components of all sampling points into row vectors according to the spatial location of the sampling points, and then stacking the row vectors of different sampling times in chronological order to form a transient current distribution matrix, where the row index of the matrix represents the sampling time and the column index represents the sampling point location. The resulting matrix structure clearly characterizes the current transient situation at each spatial location at different times, facilitating spatiotemporal joint temperature drift compensation and subsequent segmentation processing.

[0008] As a preferred method for temperature drift compensation, the process of using a built-in reference resistor network in an electrical sensor to compensate for temperature drift in each element of the transient current distribution matrix and generate a compensation current vector includes: reading the measured resistance value of each reference resistor in the reference resistor network at the current temperature and comparing it with the standard resistance value of each reference resistor to calculate the resistance drift rate of each reference resistor; weighting the transient current components of each sampling point according to the physical distance between the sampling point and each reference resistor in the reference resistor network to obtain the comprehensive drift correction coefficient for each sampling point; multiplying each element in the transient current distribution matrix by the reciprocal of the corresponding comprehensive drift correction coefficient to obtain the temperature-compensated current element; and arranging all temperature-compensated current elements at the same sampling moment in the order of the sampling points to form the compensation current vector for that sampling moment. Based on the drift compensation mechanism using the measured resistance value of the reference resistor network, the use of physical distance weighting makes the correction more consistent with the actual temperature field distribution, further improving the compensation accuracy, so that the final compensation current vector can truly reflect the instantaneous current state of the drive power supply.

[0009] As a preferred method for time-domain segmentation, the steps of segmenting the compensation current vector in the time domain and marking steady-state or transient segments further include: dividing the compensation current vector sequence into multiple initial segments of equal time length according to the sampling time sequence; calculating the current amplitude difference between the first and last compensation current vectors in each initial segment, and dividing the current amplitude difference by the time length of the initial segment to obtain the current change rate of the initial segment; marking the initial segments with a current change rate less than a preset change rate threshold as steady-state segments, and marking the initial segments with a current change rate greater than or equal to the preset change rate threshold as transient segments; merging adjacent initial segments with the same label into a final segment, and using the merged final segment as the time-domain segmentation unit for subsequent calculations. By automatically distinguishing the stable and transient stages of the current signal through the change rate threshold, and merging similar segments to form a complete time-domain segmentation unit, the steady-state segment and the transient segment can each adopt an algorithm that matches their characteristics, avoiding the problem of a single algorithm being unsuitable for different dynamic characteristics.

[0010] As a preferred method for calculating the effective value of the current in the steady-state segment, the steps for calculating the first effective value of the current in the steady-state segment using a low-frequency integration algorithm include: extracting all compensated current vectors within the time-domain segmented units marked as the steady-state segment; performing an arithmetic mean on the current elements at each corresponding position in all extracted compensated current vectors to obtain the steady-state average current vector; summing the squares of each current element in the steady-state average current vector and dividing by the total number of elements in the steady-state average current vector to obtain the square mean of the steady-state current; taking the square root of the square mean of the steady-state current, and using the resulting value as the first effective value of the current in the steady-state segment. Utilizing multi-point averaging and low-frequency integration effectively smooths out random noise, significantly improving the measurement accuracy and stability of the effective value of the steady-state current.

[0011] As a preferred method for calculating the effective value of the transient current, the steps of using a high-frequency pulse counting algorithm to calculate the second effective value of the current in the transient segment include: extracting all compensation current vectors within the time-domain segmented unit marked as the transient segment, and determining the number of all sampling moments in the transient segment; detecting the vector difference between the compensation current vector at the current sampling moment and the compensation current vector at the previous sampling moment at each sampling moment; recording a pulse event when the vector difference exceeds a preset difference threshold, and storing the occurrence time and direction of the vector difference of the pulse event; counting the cumulative number of all pulse events in the transient segment, dividing the cumulative number by the number of all sampling moments in the transient segment to obtain the pulse density, and multiplying the pulse density by a preset unit current equivalent to obtain the second effective value of the current in the transient segment. By capturing rapid current changes in the transient segment using high-frequency pulse counting, the severity and effective value level of the transient process can be sensitively reflected, avoiding omissions or averaging errors caused by transient waveform distortion.

[0012] As a preferred method for fusing continuous current detection results, the steps of fusing the first and second effective current values ​​in chronological order to generate the continuous current detection output of the driving power supply include: establishing a segmentation type sequence according to the chronological order of each steady-state segment and transient segment on the original time axis, where each element in the segmentation type sequence records the label type of the corresponding time-domain segment unit; filling the first effective current value of each steady-state segment into the corresponding time interval according to the segmentation type sequence, and filling the second effective current value of each transient segment into the corresponding time interval; at the boundary between the steady-state segment and the transient segment, taking the arithmetic mean of the effective current value at the end of the previous interval and the effective current value at the beginning of the next interval as the boundary transition value; and splicing the effective current values ​​filled into all time intervals and the boundary transition value in chronological order to form a continuous current detection output sequence. This fusion method ensures that the effective current value is continuous and without jumps throughout the entire detection period, and in particular, avoids numerical abrupt changes at the transition between steady-state and transient states through the boundary transition value, making the output more consistent with the actual physical process.

[0013] As a technical solution of this invention, it further includes a step of adaptively adjusting the range of the continuous current detection output: statistically analyzing the maximum and minimum current values ​​in the continuous current detection output sequence, calculating the difference between the maximum and minimum current values ​​as the current dynamic range; based on the current dynamic range, selecting the smallest usable range from multiple ranges built into the electrical sensor, where the full-scale value of the smallest usable range is greater than or equal to the current dynamic range; sending the gain coefficient corresponding to the selected range to the front-end amplifier circuit of the electrical sensor to adjust the voltage amplification factor at subsequent sampling times; after adjusting the range, multiplying the previously generated continuous current detection output sequence by the normalization conversion factor of the range to obtain the final current output with uniform dimensions. By introducing the adaptive range adjustment mechanism, the system can automatically match the optimal range according to the actual current dynamic range, maintaining a wide dynamic range while controlling quantization error and front-end noise at a low level, further ensuring the accuracy and resolution of current detection.

[0014] Based on the same inventive concept, this invention also provides an LED driver power supply current detection system based on electrical sensing, including a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, it performs the following steps: acquiring initial voltage signal sequences of multiple sampling points in the output circuit of the LED driver power supply through an electrical sensor array; constructing a transient current distribution matrix of the driver power supply based on the initial voltage signal sequences of all sampling points; using a reference resistor network built into the electrical sensor to perform temperature drift compensation on each element in the transient current distribution matrix to generate a compensation current vector; dividing the compensation current vector into time-domain segments and marking each segment as a steady-state segment or a transient segment according to the current change rate of each segment; calculating the first effective current value for the steady-state segment using a low-frequency integration algorithm and calculating the second effective current value for the transient segment using a high-frequency pulse counting algorithm; and fusing the first effective current value and the second effective current value in time order to generate a continuous current detection output for the driver power supply. This system integrates electrical sensor array signal acquisition, temperature compensation, adaptive segmentation, and multi-mode current RMS value calculation capabilities through hardware and software collaboration. Without increasing additional hardware costs, it can significantly improve the real-time performance, accuracy, and wide operating condition adaptability of LED driver power supply current detection using built-in algorithms.

[0015] The technical effects and advantages provided by the present invention in the above technical solution are as follows: When compensating for temperature drift in each element of the transient current distribution matrix, the reference resistor network built into the electrical sensor is used to read the measured resistance value of each reference resistor at the current temperature and compare it with the standard resistance value to obtain the resistance drift rate of each reference resistor. Then, the transient current component of each sampling point is weighted according to its physical distance from each reference resistor in the reference resistor network to generate a unique comprehensive drift correction coefficient for each sampling point. The reciprocal of this coefficient is multiplied by the corresponding transient current element to complete adaptive compensation. This scheme does not rely on a single ambient temperature sensor but is based on the actual resistance change of the reference resistor network inside the array. Even with local temperature differences in the sensor array, it can provide differentiated drift correction amounts for sampling points at different spatial locations, effectively reducing measurement inconsistencies caused by thermal field inhomogeneity during multi-point sampling, and ensuring that the compensated current vector maintains high temperature stability throughout the entire detection area.

[0016] After segmenting the compensation current vector in the time domain and labeling it as a steady-state segment or a transient segment, a low-frequency integration algorithm is used to calculate the first effective value of the current for the steady-state segment. This algorithm extracts all compensation current vectors within the segment, performs an arithmetic mean on each current element to obtain the steady-state average current vector, and then obtains the effective value by calculating the sum of squares, taking the mean, and the square root. The low-frequency integration path is insensitive to high-frequency noise during the steady-state period and can provide stable and representative current quantization results. For the transient segment, a high-frequency pulse counting algorithm is used to calculate the second effective value of the current. By detecting the difference between the compensation current vector and the vector at each sampling time, a pulse event is recorded when the difference exceeds a preset difference threshold. The pulse density of the entire transient segment is counted and multiplied by the unit current equivalent to obtain the effective value. This method directly reflects the current mutation density and mutation intensity in the transient interval, avoiding the problem of underestimation of the effective value caused by the averaging of short-term high-amplitude pulse mutations during the transient period in the traditional root mean square algorithm. Finally, the two types of effective values ​​are merged in time order, and the arithmetic mean is introduced at the boundary as the transition value to generate a continuous current detection output sequence. This makes the current detection result have high accuracy and low noise characteristics in the steady state range, and high dynamic tracking capability in the transient range. The overall output is smooth and continuous without segmented jumps. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this invention. For those skilled in the art, other drawings can be obtained based on these drawings.

[0018] Figure 1 This is a flowchart of an LED driver power supply current detection method based on electrical sensing. Figure 2 This is a flowchart of the construction of the transient current distribution matrix of the LED driver power supply output circuit; Figure 3 This is a flowchart of current sampling temperature drift compensation based on a reference resistor network; Figure 4 These are curves showing the change of transient current components over time at multiple sampling points; Figure 5 It is a comparison curve of transient current components before and after sampling point current drift compensation. Detailed Implementation

[0019] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0020] See Figure 1 This invention provides a current detection method for LED driver power supplies based on electrical sensing. The method involves acquiring initial voltage signal sequences from multiple sampling points in the output circuit of the LED driver power supply using an electrical sensor array. Based on these initial voltage signal sequences, a transient current distribution matrix of the driver power supply is constructed. Using a reference resistor network built into the electrical sensors, temperature drift compensation is applied to each element in the transient current distribution matrix to generate a compensation current vector. The compensation current vector is then segmented in the time domain, and each segment is labeled as a steady-state segment or a transient segment according to its current change rate. A low-frequency integration algorithm is used to calculate the first effective current value for the steady-state segment, and a high-frequency pulse counting algorithm is used to calculate the second effective current value for the transient segment. The first and second effective current values ​​are then fused in time sequence to generate a continuous current detection output for the driver power supply.

[0021] Example 1 In specific implementation, please refer to Figure 2 Each electrical sensor in the electrical sensor array is installed at multiple sampling points in the output circuit of the LED driver power supply. The sampling points are selected to cover different spatial nodes in the output circuit, and each sampling point corresponds to an independent voltage acquisition channel. The voltage acquisition channels are electrically isolated from each other, and each voltage acquisition channel includes a front-end signal conditioning circuit, an anti-aliasing low-pass filter, and an analog-to-digital converter.

[0022] When all voltage acquisition channels are started synchronously, a synchronous trigger pulse is output from the same clock source. The trigger pulse arrives simultaneously at the sample-and-hold circuit of each voltage acquisition channel, enabling all voltage acquisition channels to simultaneously acquire the analog voltage signal of each sampling point at the same sampling frequency. The sampling frequency is set according to the highest operating frequency of the LED driver power supply, and is set to more than ten times the highest operating frequency.

[0023] During the anti-aliasing filtering process for the analog voltage signals at each sampling point, the cutoff frequency of the anti-aliasing low-pass filter in each voltage acquisition channel is set to less than half of the sampling frequency, filtering out high-frequency components in the analog voltage signal that are higher than half the sampling frequency. After the anti-aliasing filtering is completed, the analog-to-digital converter (ADC) converts the filtered analog voltage signal into an initial digital voltage sequence corresponding to the sampling point. The resolution of the ADC is selected based on the accuracy requirements of the current detection, and the quantization error of the ADC is less than one-tenth of the target current detection accuracy requirement.

[0024] The initial digital voltage sequences corresponding to all sampling points are arranged in order of sampling point numbering to form an initial voltage signal sequence group. The sampling point numbering order is arranged according to the physical spatial location of the sampling points in the output circuit. For example, from the output terminal of the drive power supply to the load terminal, they are numbered sequentially as sampling point 1, sampling point 2, up to sampling point N, where N is the total number of sampling points. The initial voltage signal sequence group contains N initial digital voltage sequences, each with a length of M, where M is the total number of sampling times.

[0025] In constructing the transient current distribution matrix of the driving power supply, the voltage difference between two adjacent sampling times in the initial voltage signal sequence of each sampling point is extracted as the voltage change feature value of the sampling point. For each sampling point... In the initial digital voltage sequence, the first The voltage value at each sampling time is denoted as The voltage value at the previous sampling time is recorded as Then the sampling point In the Voltage change characteristic value within each sampling interval Obtained through the following formula:

[0026] in, Index the sampling points. The range of values ​​is to , This represents the total number of sampling points; For sampling time index, The range of values ​​is to , This represents the total number of sampling times. Indicates sampling point At sampling time The voltage value; Indicates sampling point At sampling time The voltage value at the previous sampling time; Indicates sampling point At sampling time The voltage change characteristic value is calculated at the location.

[0027] Dividing the voltage change characteristic value at each sampling point by the known equivalent internal resistance of the corresponding electrical sensor yields the transient current component at each sampling point. The known equivalent internal resistance of the electrical sensor is the resistance value calculated during factory calibration by injecting a known current through a standard current source and measuring the corresponding voltage difference; this equivalent internal resistance value is pre-stored in the system memory. For each sampling point… The known equivalent internal resistance of an electrical sensor is denoted as . transient current component Calculated using the following formula:

[0028] in, Indicates sampling point At sampling time The transient current component, Indicates sampling point At sampling time The characteristic value of voltage change, Indicates sampling point The known equivalent internal resistance of the corresponding electrical sensor. The resistance value is determined by the factory calibration data and is read from the memory and loaded into the arithmetic unit each time the system is powered on and initialized.

[0029] Arrange the transient current components of all sampling points into a row vector according to the spatial location of the sampling points. For the sampling time... Construct row vectors ,in to Sampling points To the sampling point At sampling time The transient current component. The order of elements in the row vector is consistent with the order of sampling point numbers, reflecting the spatial order of sampling points.

[0030] Then, the row vectors from different sampling times are stacked in chronological order to form a transient current distribution matrix. The sampling times are then... from to corresponding row vector In turn, as the first of the matrix Line, transient current distribution matrix For one OK A matrix of columns, where row indices correspond to the sampling time sequence and column indices correspond to the sampling point positions. Transient current distribution matrix. The Middle Line 1 The elements of the column are ,in This is the row index, and its value range is... to , For column indexes, the value range is... to The transient current distribution matrix fully characterizes the transient current distribution state of the drive power supply output circuit at different sampling times and spatial locations of different sampling points.

[0031] See Figure 4 In the graph, the horizontal axis represents time in milliseconds, and the vertical axis represents the transient current component in amperes. The curves show the waveforms of the transient current components at sampling points 1 to 5 as a function of time, distinguished by different line types such as solid lines, dashed lines, and dotted lines. The transient current component waveforms at each sampling point exhibit a periodic sine wave shape, with a peak value of approximately ±3 amperes, a trough of approximately -3 amperes, and a peak value of approximately 3 amperes, reflecting the current variation trend at different spatial sampling points in the LED driver power supply output circuit.

[0032] From the overall trend of the curves, the transient current component curves at the five sampling points have basically the same shape and are in phase synchronization, consistent with the characteristic that the sampling points are numbered sequentially from the output terminal of the drive power supply to the load terminal. There are slight differences in the current amplitude at different sampling points; the current amplitudes at sampling points 4 and 5 are slightly higher than those at sampling points 1, 2, and 3, indicating that there are certain amplitude differences in the current distribution at different spatial nodes in the output circuit. These slight fluctuations in the curves reflect the noise and dynamic characteristics of the system during the actual sampling process.

[0033] As described in Example 1, voltage signals are synchronously acquired at multiple sampling points using an electrical sensor array, and transient current components are calculated. The curves in the figure are the transient current component waveforms corresponding to different sampling points at multiple sampling times in the constructed transient current distribution matrix.

[0034] Example 2 In specific implementation, please refer to Figure 3The process of reading the measured resistance values ​​of each reference resistor in the reference resistor network at the current temperature is as follows: The electrical sensor integrates a reference resistor network, which consists of multiple reference resistors. Each reference resistor is made of the same precision alloy foil material as the current sampling resistor of the electrical sensor. The reference resistors and the current sampling resistors are placed on the same substrate surface and are in the same temperature field. During the operation of the LED driver power supply, the temperature acquisition module periodically reads the current temperature value output by the temperature sensor located near the reference resistor network. The temperature acquisition period is set to 1 second. Simultaneously, the resistance measurement circuit sequentially applies a constant excitation current to each reference resistor in the reference resistor network. The amplitude of the constant excitation current is set to one-tenth of the allowable current value of the reference resistor's nominal rated power. The voltage response across each reference resistor is measured, and the voltage response is divided by the amplitude of the constant excitation current to obtain the measured resistance value of each reference resistor at the current temperature.

[0035] The measured resistance value of each reference resistor at the current temperature is compared with the standard resistance value of the corresponding reference resistor to calculate the resistance drift rate of each reference resistor. The standard resistance value of the reference resistor is the resistance value obtained by measuring it using a four-wire Kelvin bridge method at a reference temperature of 25 degrees Celsius. The standard resistance value and the reference temperature value are pre-programmed into the non-volatile memory of the electrical sensor. For the k-th reference resistor in the reference resistor network, the standard resistance value of the k-th reference resistor is denoted as... The measured resistance of the k-th reference resistor at the current temperature is denoted as... Then the resistance drift rate of the k-th reference resistor Calculated using the following formula:

[0036] Where k is the reference resistor number index, the value of k ranges from 1 to K, and K is the total number of reference resistors in the reference resistor network; This represents the standard resistance value of the k-th reference resistor at a reference temperature of 25 degrees Celsius. This represents the measured resistance value of the k-th reference resistor at the current temperature; This represents the resistance drift rate of the k-th reference resistor. For dimensionless numerical values, when A positive value indicates that the measured resistance is greater than the standard resistance. A negative value indicates that the measured resistance is less than the standard resistance.

[0037] In obtaining the comprehensive drift correction coefficient for each sampling point, the transient current component of each sampling point is weighted according to the physical distance between the sampling point and each reference resistor in the reference resistor network. The physical distance between the sampling point and each reference resistor is the straight-line distance between the geometric center point of the current sampling resistor corresponding to the sampling point on the printed circuit board inside the electrical sensor and the geometric center point of each reference resistor in the reference resistor network. The physical distance is determined when designing the layout of the printed circuit board of the electrical sensor, and the physical distance value is pre-stored in the memory of the electrical sensor.

[0038] For sampling point p, determine the physical distance between sampling point p and each reference resistor, and generate a distance weight for sampling point p corresponding to each reference resistor based on the physical distance. The distance weight is inversely proportional to the square of the physical distance, meaning that the closer the reference resistor is, the greater its influence on the temperature drift characteristics of sampling point p. The physical distance between sampling point p and the k-th reference resistor is then calculated. The distance weight of sampling point p corresponding to the k-th reference resistor is obtained through normalization. The normalization method is as follows: calculate the physical distance. The reciprocal of the square of the reference resistor is then summed, and the normalized distance weight for each reference resistor is obtained by dividing the reciprocal of the square of the reference resistor by the summation result.

[0039] The resistance drift rate of the k-th reference resistor The sample point p is multiplied by the normalized distance weight corresponding to the k-th reference resistor, and the sum of these products over all k reference resistors is obtained to get the overall drift coefficient of sample point p. Then, 1 is added to the overall drift coefficient to obtain the overall drift correction coefficient of sample point p. The expression is:

[0040] Where p is the sampling point index, the value of p ranges from 1 to N, and N is the total number of sampling points; k is the reference resistor index, the value of k ranges from 1 to K, and K is the total number of reference resistors in the reference resistor network; u is the reference resistor index for summation, the value of u ranges from 1 to K. This represents the physical distance between sampling point p and the k-th reference resistor. The unit is millimeters; This represents the physical distance between sampling point p and the u-th reference resistor. The unit is millimeters; This represents the resistance drift rate of the k-th reference resistor; This represents the overall drift correction coefficient for sampling point p. It is a dimensionless numerical value. The value of reflects the correction ratio of the current sampling resistor value at sampling point p at the current temperature relative to the standard reference state resistance value. When it equals 1, it means no correction is needed. A value greater than 1 indicates a positive resistance drift, requiring a downward correction of the current value. A value less than 1 indicates that the resistance is drifting negatively and the current value needs to be corrected upwards.

[0041] After calculating the overall drift correction coefficient, each element in the transient current distribution matrix is ​​multiplied by the reciprocal of the corresponding overall drift correction coefficient to obtain the temperature-compensated current element. For the element in the i-th row and j-th column of the transient current distribution matrix... That is, the transient current component at sampling point j at the (i+1)th sampling time, and the temperature-compensated current element. Obtained through the following formula:

[0042] in, This represents the element in the i-th row and j-th column of the transient current distribution matrix; i is the row index, ranging from 1 to M-1, where M is the total number of sampling times; j is the column index, ranging from 1 to N, where N is the total number of sampling points. This represents the overall drift correction coefficient for sampling point j; This represents the current element after temperature compensation.

[0043] All temperature-compensated current elements at the same sampling time are arranged in the order of sampling points to form the compensated current vector at that sampling time. For the (i+1)th sampling time, the compensated current vector... Defined as:

[0044] in, Let N represent the compensation current vector at the (i+1)th sampling time. The vector dimension is N, where N is the total number of sampling points. to These represent the temperature-compensated current elements at sampling points 1 to N at the (i+1)th sampling time. The compensated current vector is used to replace the original transient current components as input data for subsequent time-domain segmentation and RMS current value calculation.

[0045] See Figure 5 In the graph, the horizontal axis represents time in seconds, and the vertical axis represents current in amperes. The dashed curve represents the "current component before compensation," indicating the trend of the transient current component without temperature drift compensation over time; the solid curve represents the "current component after compensation," indicating the comprehensive drift correction coefficient calculated based on the resistance drift rate measured using the built-in reference resistor network as described in Example 2. The change in current after temperature compensation processing of transient current components.

[0046] As shown in the figure, the current component before compensation generally shows an increasing trend over time. The current amplitude gradually increases from about 1.50A to about 1.62A after 5 seconds. The curve is relatively smooth but has some upward fluctuations, reflecting that the measured value of the uncompensated current sampling resistor is gradually higher due to temperature drift. After compensation, the fluctuation range of the current component curve is significantly reduced, and the current oscillates between about 1.48A and 1.52A. The overall trend remains basically stable, without significant upward or downward trends, indicating that the current component has been adjusted according to the resistance drift rate of the reference resistor. The overall drift correction coefficient is calculated using the distance weights between the sampling point and the reference resistor. After correction, the measurement error caused by temperature drift was effectively eliminated.

[0047] Example 3 In practice, the compensation current vector sequence is divided into multiple initial segments of equal length according to the sampling time sequence. The compensation current vector sequence is composed of compensation current vectors from each sampling time arranged chronologically, with each compensation current vector corresponding to one sampling time. The dimension of the compensation current vector is the same as the total number of sampling points. The time length of the initial segment is set according to the nominal output current ripple period of the LED driver power supply, and is set to one-fifth of the nominal output current ripple period. The nominal output current ripple period is determined by the reciprocal of the design operating frequency of the LED driver power supply. When the design operating frequency is 100 kHz, the nominal output current ripple period is 10 microseconds, so the time length of the initial segment is set to 2 microseconds. Based on the sampling frequency and the time length of the initial segment, the number of compensation current vectors contained in each initial segment is calculated. The compensation current vector sequence is then sequentially divided into multiple non-overlapping initial segments. If the number of compensation current vectors contained in the last initial segment is insufficient, it is discarded from the end of the sequence.

[0048] Calculate the current amplitude difference between the first and last compensation current vectors within each initial segment. For the r-th initial segment, extract the first and last compensation current vectors within the r-th initial segment. The compensation current vectors are N-dimensional vectors, where N is the total number of sampling points. Summate the absolute values ​​of all N elements in the first compensation current vector to obtain its amplitude; similarly, sum the absolute values ​​of all N elements in the last compensation current vector to obtain its amplitude. The absolute value of the difference between the amplitudes of the first and last compensation current vectors is taken as the current amplitude difference between the first and last compensation current vectors within the r-th initial segment. Divide the current amplitude difference of the r-th initial segment by the time length of the r-th initial segment to obtain the current change rate of the r-th initial segment. The unit of the current change rate is set to amperes per second.

[0049] Initial segments with current change rates less than a preset threshold are marked as steady-state segments, while initial segments with current change rates greater than or equal to the preset threshold are marked as transient segments. The preset threshold is determined based on the steady-state fluctuation range of the LED driver power supply's output current under rated load conditions. Under rated load conditions, the LED driver power supply's output current is continuously recorded for 60 seconds using a high-precision ammeter, and the maximum rate of change of the output current is calculated. 1.2 times the maximum rate of change is set as the preset threshold. The value of the preset threshold is written to the configuration register of the electrical sensor and is read from the configuration register and loaded into the time-domain segmentation module each time the system is powered on and initialized.

[0050] Adjacent initial segments with the same label are merged into a single final segment. After labeling all initial segments, the initial segment sequence is traversed in chronological order. Initial segments with the same label type and temporal proximity are grouped into the same merging group, with all initial segments within each merging group having the same label type. The compensation current vectors contained in all initial segments within each merging group are concatenated in chronological order to form the merged final segment. The merged final segment serves as the time-domain segmentation unit for subsequent current RMS value calculations. Each time-domain segmentation unit has a unified label type, which can be either a steady-state segment or a transient segment.

[0051] Extract all compensated current vectors within the time-domain segmented cells labeled as steady-state segments. Let a time-domain segmented cell labeled as a steady-state segment contain W compensated current vectors, where W is the total number of compensated current vectors within that steady-state segment. Each compensated current vector is an N-dimensional vector, and N is the total number of sampling points. Perform an arithmetic mean on the current elements at corresponding positions in the extracted W compensated current vectors. This involves summing the first elements of all W compensated current vectors and dividing by W to obtain the first element of the steady-state average current vector; summing the second elements of all W compensated current vectors and dividing by W to obtain the second element of the steady-state average current vector; and so on, until the Nth element of the steady-state average current vector is obtained, thus acquiring the steady-state average current vector. The steady-state average current vector is denoted as […]. ,in This represents the nth element in the steady-state average current vector, where n ranges from 1 to N, and N is the total number of sampling points.

[0052] The steady-state average current vector Squaring each current element and summing the results, then dividing by the steady-state average current vector. The total number of elements is calculated to obtain the square mean of the steady-state current. The square root of this square mean is then taken as the first effective value of the current in the time-domain segment of the steady-state period. Calculated using the following formula:

[0053] in, This represents the first effective current value of the time-domain segmented unit in the steady-state segment, in amperes. Represents the steady-state average current vector The nth current element in the sample point index, where n is the sampling point number index, and the value of n ranges from 1 to N. N is the total number of sampling points, i.e., the total number of elements in the steady-state average current vector. It represents the sum of the squares of all N current elements in the steady-state average current vector.

[0054] For a time-domain segmented unit labeled as a transient segment, extract all compensation current vectors within the unit and determine the number of sampling times within that unit. A transient segmented unit consists of multiple consecutive sampling times. Let T be the number of sampling times within the unit, where T is the total number of compensation current vectors. Each sampling time corresponds to one compensation current vector, which is an N-dimensional vector, and N is the total number of sampling points.

[0055] The vector difference between the compensation current vector at the current sampling time and the compensation current vector at the previous sampling time is detected at each sampling time. For the t-th sampling time within the transient time-domain segment unit, where t ranges from 2 to T, the compensation current vectors at the t-th and (t-1)-th sampling times are extracted. Each element of the compensation current vector at the t-th sampling time is subtracted from the corresponding element of the compensation current vector at the (t-1)-th sampling time, resulting in N differences. The absolute values ​​of these N differences are taken and summed, and the sum is used as the vector difference. The vector difference reflects the overall change in the compensation current vector between two adjacent sampling times.

[0056] The vector difference is compared with a preset difference threshold. The preset difference threshold is determined based on the minimum resolution value of the current step during transient switching of the LED driver power supply. In the dimming mode switching test of the LED driver power supply, the output current step value corresponding to the change in dimming command is recorded, and 0.8 times the minimum step value is set as the preset difference threshold. The value of the preset difference threshold is written into the configuration register of the electrical sensor, and is read from the configuration register and loaded into the pulse detection module each time the system is powered on and initialized.

[0057] When the vector difference exceeds a preset difference threshold, a pulse event is recorded. The occurrence time and direction of each pulse event are numbered and stored. The occurrence time of the pulse event is recorded as the timestamp of the current sampling time, which accumulates starting from system startup. The direction of the vector difference is determined by the sign distribution of the differences between the compensation current vector at sampling time t and the compensation current vector at sampling time (t-1): when the number of positive values ​​exceeds the number of negative values ​​among all N differences, the vector difference direction is marked as positive; when the number of negative values ​​exceeds the number of positive values ​​among all N differences, the vector difference direction is marked as negative; when the number of positive values ​​equals the number of negative values, the vector difference direction is marked as zero.

[0058] The cumulative number of all pulse events within the transient time-domain segmented unit is counted. This cumulative number is then divided by the number of sampling times within the transient time-domain segmented unit to obtain the pulse density. The pulse density is a dimensionless value, ranging from 0 to 1. Multiplying the pulse density by a preset unit current equivalent yields the second effective current value of the transient time-domain segmented unit. The preset unit current equivalent represents the equivalent current change corresponding to a single pulse event. This preset unit current equivalent is determined as follows: a standard current sensor is connected in series in the LED driver power supply output circuit. Under various typical transient operating conditions, the pulse density detected by the electrical sensor array and the effective current value measured by the standard current sensor are recorded synchronously. A linear regression model between the pulse density and the effective current value is established, and the slope of the linear regression model is the preset unit current equivalent. The preset unit current equivalent value is written into the configuration register of the electrical sensor and is read from the configuration register and loaded into the effective value calculation module each time the system is powered on and initialized.

[0059] Example 4 In practice, a segmentation type sequence is established according to the chronological order of the steady-state and transient segments on the original time axis. The original time axis uses the system startup time as the zero point and the sampling period as the smallest unit of the time axis. Each time-domain segment unit occupies a continuous time interval on the original time axis. All time-domain segment units are traversed, and the label type and the start and end times of each time-domain segment unit on the original time axis are extracted. The label type of each time-domain segment unit is taken as an element and arranged sequentially according to the start times of the time-domain segment units from earliest to latest, forming a segmentation type sequence. Each element in the segmentation type sequence records the label type of the corresponding time-domain segment unit, and the label type value is either a steady-state segment or a transient segment.

[0060] Based on the segmentation type sequence, the first effective current value of each steady-state segment is filled into the corresponding time interval of the steady-state segment. For the y-th element in the segmentation type sequence, when the label type of the y-th element is a steady-state segment, the start time of the time-domain segmentation unit corresponding to the y-th element on the original time axis is obtained. and termination time The first effective value of the current of the steady-state segmented time domain unit is assigned to the time interval. Each sampling moment within the time interval. The first effective value of the current within the time interval. The value remains constant and does not change with the location of the sampling points within the interval.

[0061] The second effective current value of each transient segment is filled into the time interval corresponding to the transient segment. For the z-th element in the segmentation type sequence, when the label type of the z-th element is transient segment, the start time of the time-domain segmentation unit corresponding to the z-th element on the original time axis is obtained. and termination time The effective value of the second current of the transient segment time-domain segmented unit is assigned to the time interval. At each sampling moment within the time interval. The effective value of the second current within the time interval. The internal temperature remains constant.

[0062] At the boundary between the steady-state and transient segments, the arithmetic mean of the effective current value at the end of the preceding segment and the effective current value at the beginning of the following segment is taken as the boundary transition value. The boundary refers to the position where the label type of two adjacent elements in the segmentation type sequence changes; that is, the label type of the preceding element is steady-state and the label type of the following element is transient, or the label type of the preceding element is transient and the label type of the following element is steady-state. For each boundary case, the effective current value at the end of the preceding segment and the effective current value at the beginning of the following segment are obtained.

[0063] The effective value of the current at the end of the previous interval refers to the effective value of the current filled in by the previous time-domain segmented unit at its termination time, and the effective value of the current at the beginning of the next interval refers to the effective value of the current filled in by the next time-domain segmented unit at its start time. The effective value of the current at the end of the previous interval is denoted as... The effective value of the current at the beginning of the next interval is denoted as Boundary transition value Calculated using the following formula:

[0064] in, This represents the effective value of the current at the end of the previous interval, in amperes, when the current type of the previous time-domain segment is a steady-state segment. The value is taken as the first effective value of the current, when the current time-domain segmentation unit is marked as a transient segment. The value is taken as the second effective value of the current; This represents the effective value of the current at the beginning of the next interval, in amperes, when the label type of the next time-domain segment is a steady-state segment. The value is taken as the first effective value of the current, when the tag type of the subsequent time-domain segment unit is a transient segment. The value is taken as the second effective value of the current; This indicates the transition value at the boundary, and the unit is amperes.

[0065] The timing of the boundary transition value is set to the midpoint between the end time of the previous time-domain segment and the start time of the next time-domain segment. When the midpoint falls exactly on a sampling time, the boundary transition value is directly filled into that sampling time; when the midpoint is between two adjacent sampling times, the boundary transition value is filled into the sampling time before the midpoint, and the effective value of the first-end current of the next interval is filled into the sampling time after the midpoint.

[0066] The RMS current values ​​and transition values ​​filled in all time intervals are concatenated in chronological order to form a continuous current detection output sequence. Following the chronological order on the original time axis, starting from the beginning of the first time-domain segment, the filled RMS current values ​​or transition values ​​are extracted at each sampling moment and arranged sequentially to form the continuous current detection output sequence. Each sampling moment in the continuous current detection output sequence corresponds to one RMS current value, and the time interval between adjacent sampling moments is equal to the sampling period.

[0067] The maximum and minimum current values ​​in the continuous current detection output sequence are statistically analyzed. All current values ​​in the continuous current detection output sequence are iterated through, and the magnitude of each current value is compared. The maximum and minimum current values ​​encountered during the iteration are recorded. The difference between the maximum and minimum current values ​​is calculated, and this difference is used as the current dynamic range. The current dynamic range represents the amplitude of current value variation in the continuous current detection output sequence, measured in amperes.

[0068] Based on the current dynamic range, the smallest usable range is selected from the multiple ranges built into the electrical sensor. The electrical sensor has four built-in ranges: a first range, a second range, a third range, and a fourth range. The full-scale value of the first range is set to 100 mA, the second range to 500 mA, the third range to 2 amps, and the fourth range to 10 amps. After obtaining the current dynamic range, the current dynamic range is compared with the full-scale value of the first, second, third, and fourth ranges in sequence. When the current dynamic range is less than or equal to the full-scale value of a certain range, that range is selected as a candidate range. Among all candidate ranges, the one with the smallest full-scale value is selected as the minimum usable range. The full-scale value of the minimum usable range is greater than or equal to the current dynamic range.

[0069] The gain coefficient corresponding to the selected measurement range is sent to the front-end amplifier circuit of the electrical sensor. Each measurement range corresponds to a preset gain coefficient, which is stored in the configuration register of the electrical sensor. The preset gain coefficient for the first measurement range is set to 50 times, for the second range to 10 times, for the third range to 2.5 times, and for the fourth range to 0.5 times. After determining the minimum available measurement range, the preset gain coefficient corresponding to the minimum available measurement range is read from the configuration register and sent to the programmable gain amplifier of the front-end amplifier circuit via the serial peripheral interface. The programmable gain amplifier adjusts the voltage amplification factor at subsequent sampling times based on the received preset gain coefficient, so that the amplitude of the subsequently acquired analog voltage signal remains within the optimal input range of the analog-to-digital converter.

[0070] After adjusting the measurement range, the previously generated continuous current detection output sequence is multiplied by the normalization factor of the measurement range to obtain the final current output with uniform dimensions. The normalization factor is stored in the configuration register of the electrical sensor. Each measurement range corresponds to a normalization factor, and the value of the normalization factor is set to the full-scale value of the reference range divided by the full-scale value of the corresponding range. The reference range is selected as the second range, and the full-scale value of the second range is 500 mA. The normalization factor for the first range is 500 divided by 100, which equals 5; the normalization factor for the second range is 500 divided by 500, which equals 1; the normalization factor for the third range is 500 divided by 2000, which equals 0.25; and the normalization factor for the fourth range is 500 divided by 10000, which equals 0.05. Each effective current value in the continuous current detection output sequence is multiplied by the normalization factor corresponding to the smallest available measurement range to unify the current value to the reference range, forming the final current output sequence. Each sampling moment in the final current output sequence corresponds to a final current value with unified dimensions.

[0071] Example 5 In practical implementation, the LED driver power supply current detection system based on electrical sensing includes a memory, a processor, and a computer program stored in the memory and running on the processor. The memory uses a non-volatile storage medium, which stores computer program instructions, the known equivalent internal resistance of the electrical sensors, the standard resistance values ​​of each reference resistor in the reference resistor network, preset rate of change thresholds, preset difference thresholds, preset unit current equivalents, range configuration parameters, and intermediate data generated during system operation. The processor is an embedded microprocessor, which is connected to the memory, electrical sensor array, analog-to-digital converter, temperature acquisition module, and front-end amplifier circuit via a system bus. The embedded microprocessor reads computer program instructions from the memory and executes them one by one.

[0072] When executing the computer program, the processor implements the steps of acquiring initial voltage signal sequences from multiple sampling points in the output circuit of the LED driver power supply using an electrical sensor array. The processor sends a synchronization acquisition command to the electrical sensor array, which includes sampling frequency parameters and acquisition channel enable parameters. Upon receiving the synchronization acquisition command, each electrical sensor in the array synchronously acquires the analog voltage signal of its corresponding sampling point at the sampling frequency specified by the sampling frequency parameters. The analog voltage signal from each electrical sensor is processed by an independent anti-aliasing filter and analog-to-digital converter, converted into an initial digital voltage sequence, and stored in an input buffer allocated by the processor. The processor reads all initial digital voltage sequences from the input buffer in order of sampling point number, organizing them into an initial voltage signal sequence group.

[0073] When executing the computer program, the processor implements the steps of constructing the transient current distribution matrix of the driving power supply based on the initial voltage signal sequence of all sampling points. The processor reads the voltage value of each sampling point from the input buffer at each sampling time, and calculates the voltage difference between two adjacent sampling times for each sampling point as the voltage change characteristic value. The processor reads the known equivalent internal resistance value corresponding to each electrical sensor from memory, divides the voltage change characteristic value by the corresponding known equivalent internal resistance value, and obtains the transient current component of each sampling point. The processor allocates storage space for the transient current distribution matrix in memory, with a storage space size of (M-1) rows multiplied by N columns, where M is the total number of sampling times and N is the total number of sampling points. The processor arranges the transient current components of all sampling points at each sampling time into a row vector according to the spatial position of the sampling points, and then writes the row vectors of different sampling times row by row into the storage space of the transient current distribution matrix in chronological order, with the row index increasing in the same direction as the sampling time.

[0074] When executing the computer program, the processor performs the following steps: It uses a reference resistor network built into the electrical sensor to perform temperature drift compensation on each element of the transient current distribution matrix, generating a compensation current vector. The processor sends a temperature reading command to the temperature acquisition module, which returns the current temperature value. The processor then sends a resistance measurement command to the resistance measurement circuit, which sequentially measures the measured resistance of each reference resistor in the reference resistor network at the current temperature and returns the measurement result. The processor reads the standard resistance value of each reference resistor from memory and calculates the resistance drift rate of each reference resistor. Finally, the processor reads a physical distance table between the sampling points and each reference resistor from memory. This physical distance table is stored in a two-dimensional array, where the row index is the sampling point number, the column index is the reference resistor number, and each element in the two-dimensional array represents the physical distance between the corresponding sampling point and the corresponding reference resistor. The processor calculates the comprehensive drift correction coefficient for each sampling point based on the physical distance table, multiplies all elements belonging to the same sampling point in the transient current distribution matrix by the reciprocal of the comprehensive drift correction coefficient of the corresponding sampling point, arranges the temperature-compensated current elements at the same sampling time in the order of the sampling points to form a compensation current vector, and stores the compensation current vectors at all sampling times into the compensation current vector buffer allocated by the processor in the memory.

[0075] When executing the computer program, the processor performs time-domain segmentation of the compensation current vector and marks each segment as a steady-state segment or a transient segment according to its current change rate. The processor reads the initial segment's time length parameter and a preset change rate threshold from memory. The processor reads the compensation current vector sequence from the compensation current vector buffer in chronological order, calculates the number of compensation current vectors in each initial segment based on the initial segment's time length parameter and sampling frequency, and divides the compensation current vector sequence into multiple initial segments of equal time length. The processor calculates the current amplitude difference between the first and last compensation current vectors within each initial segment, and divides this difference by the initial segment's time length to obtain the current change rate. The processor compares the current change rate of each initial segment with the preset change rate threshold; initial segments with a current change rate less than the preset change rate threshold are marked as steady-state segments, and initial segments with a current change rate greater than or equal to the preset change rate threshold are marked as transient segments. The processor merges adjacent initial segments with the same label into a final segment. The merged final segment is used as a time-domain segmentation unit. The label type, start time, end time, and index range of the compensation current vector contained in each time-domain segmentation unit are stored in a segmentation information table allocated by the processor in memory.

[0076] When executing the computer program, the processor implements the steps of calculating the first effective value of the current using a low-frequency integration algorithm for the steady-state segment and calculating the second effective value of the current using a high-frequency pulse counting algorithm for the transient segment. The processor traverses the segmentation information table. For time-domain segmentation units marked as steady-state segments, the processor reads all corresponding compensation current vectors from the compensation current vector buffer based on the compensation current vector index range, calculates the steady-state average current vector, squares each element in the steady-state average current vector, sums the squares, and divides by the total number of elements to obtain the steady-state current square mean. The square root of the steady-state current square mean is taken to obtain the first effective value of the current, and the first effective value of the current is written into the record of the corresponding time-domain segmentation unit in the segmentation information table. For time-domain segmentation units marked as transient segments, the processor reads all corresponding compensation current vectors from the compensation current vector buffer according to the compensation current vector index range. At each sampling moment, it calculates the vector difference between the compensation current vector at the current sampling moment and the compensation current vector at the previous sampling moment. The processor reads a preset difference threshold value from memory and compares the vector difference value with the preset difference threshold. When the vector difference value exceeds the preset difference threshold, a pulse event is recorded. The occurrence time and vector difference direction of the pulse event are numbered and stored in a pulse event record table allocated by the processor in memory. The processor counts the cumulative number of pulse events belonging to the current transient segment time-domain segmentation unit in the pulse event record table. The cumulative number is divided by the number of all sampling moments within the current transient segment time-domain segmentation unit to obtain the pulse density. A preset unit current equivalent value is read from memory, and the pulse density is multiplied by the preset unit current equivalent value to obtain the second effective current value. The second effective current value is then written into the record of the corresponding time-domain segmentation unit in the segmentation information table.

[0077] When executing the computer program, the processor performs the following steps: fusing the first and second effective current values ​​in chronological order to generate a continuous current detection output for the driving power supply. The processor iterates through all records of time-domain segmentation units in the segmentation information table, establishing a segmentation type sequence according to the start time of each segmentation unit from earliest to latest. The processor fills each sampling moment within the corresponding time interval with the first effective current value of each steady-state segmentation unit, and fills each sampling moment within the corresponding time interval with the second effective current value of each transient segmentation unit. The processor detects changes in the label type of adjacent elements in the segmentation type sequence. At the location where the label type changes, it reads the effective current value at the end of the previous interval and the effective current value at the beginning of the next interval, calculates their arithmetic mean as the boundary transition value, and fills the boundary transition value into the sampling moment corresponding to the boundary position. The processor concatenates the effective current values ​​and boundary transition values ​​of all time intervals in chronological order to form a continuous current detection output sequence and stores it in the output buffer allocated by the processor in the memory.

[0078] In some embodiments, when executing the computer program, the processor further implements the step of adaptively adjusting the range of the continuous current detection output. The processor reads the continuous current detection output sequence from the output buffer, iterates through all current values ​​in the continuous current detection output sequence, records the maximum and minimum current values, and calculates the difference between the maximum and minimum current values ​​as the current dynamic range. The processor reads the range configuration table from memory, which stores the full-scale value, gain coefficient, and normalization factor of each range in ascending order of range number. The processor compares the current dynamic range sequentially with the full-scale value of each range in ascending order of range number. When the current dynamic range is less than or equal to the full-scale value of a certain range, that range is selected as a candidate range. Among all candidate ranges, the range with the smallest full-scale value is selected as the minimum available range. The processor reads the gain coefficient corresponding to the smallest available measurement range from the range configuration table, and sends the gain coefficient to the programmable gain amplifier in the front-end amplifier circuit of the electrical sensor through the serial peripheral interface. The programmable gain amplifier adjusts the voltage amplification factor at subsequent sampling times according to the gain coefficient. The processor reads the normalization factor corresponding to the smallest available measurement range from the range configuration table, multiplies each current value in the continuous current detection output sequence by the normalization factor to obtain a final current output sequence with uniform dimensions, and writes the final current output sequence into the final output buffer allocated by the processor in the memory for the host computer or display module to read.

[0079] It is understandable that during the execution of a computer program, the buffers allocated in the memory are managed using a circular queue structure. The input buffer, compensation current vector buffer, output buffer, and final output buffer are each configured with independent read and write pointers. The processor triggers a data write operation after the analog-to-digital converter completes a conversion through an interrupt service routine. During the processor's idle period, the main loop program performs calculation tasks such as constructing the transient current distribution matrix, temperature drift compensation, time-domain segmentation and marking, current RMS value calculation, fusion output, and adaptive range adjustment, thereby realizing the real-time continuous electrical sensing LED driver power supply current detection function.

[0080] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.

Claims

1. A method for detecting the current of an LED driver power supply based on electrical sensing, characterized in that, include: The initial voltage signal sequence of multiple sampling points in the output circuit of the LED driver power supply is acquired by an electrical sensor array; Based on the initial voltage signal sequence of all sampling points, construct the transient current distribution matrix of the driving power supply; By utilizing the reference resistor network built into the electrical sensor, temperature drift compensation is performed on each element in the transient current distribution matrix to generate a compensation current vector. The compensation current vector is segmented in the time domain, and the segments are marked as steady-state segments or transient segments according to the current change rate of each segment. The first effective value of the current is calculated using a low-frequency integral algorithm for the steady-state segment, and the second effective value of the current is calculated using a high-frequency pulse counting algorithm for the transient segment. The first and second effective current values ​​are merged in time sequence to generate a continuous current detection output for the drive power supply.

2. The LED driver power supply current detection method based on electrical sensing according to claim 1, characterized in that, The specific process of acquiring the initial voltage signal sequence of multiple sampling points in the output circuit of the LED driver power supply through an electrical sensor array includes: Each electrical sensor in the electrical sensor array is installed at multiple sampling points in the output circuit, and each sampling point corresponds to an independent voltage acquisition channel. All voltage acquisition channels are started simultaneously to acquire the analog voltage signal of each sampling point at the same sampling frequency. Each analog voltage signal is subjected to anti-aliasing filtering and analog-to-digital conversion to obtain the initial digital voltage sequence corresponding to each sampling point; Arrange all initial digital voltage sequences in order of sampling point number to form an initial voltage signal sequence group.

3. The LED driver power supply current detection method based on electrical sensing according to claim 1, characterized in that, The specific process of constructing the transient current distribution matrix of the driving power supply based on the initial voltage signal sequence of all sampling points includes: Extract the voltage difference between two adjacent sampling times from the initial voltage signal sequence of each sampling point, and use it as the voltage change feature value of that sampling point; Divide the voltage change characteristic value of each sampling point by the known equivalent internal resistance of the electrical sensor corresponding to that sampling point to obtain the transient current component of each sampling point; Arrange the transient current components of all sampling points into row vectors according to the spatial location of the sampling points, and then stack the row vectors at different sampling times in chronological order to form a transient current distribution matrix; The row index of this transient current distribution matrix represents the sampling time, and the column index represents the sampling point location.

4. The LED driver power supply current detection method based on electrical sensing according to claim 1, characterized in that, The specific process of using the reference resistor network built into the electrical sensor to compensate for temperature drift in each element of the transient current distribution matrix and generate a compensation current vector includes: Read the measured resistance value of each reference resistor in the reference resistor network at the current temperature, compare it with the standard resistance value of each reference resistor, and calculate the resistance drift rate of each reference resistor. The transient current components at each sampling point are weighted according to the physical distance between the sampling point and each reference resistor in the reference resistor network to obtain the comprehensive drift correction coefficient for each sampling point. Multiply each element in the transient current distribution matrix by the reciprocal of the corresponding comprehensive drift correction coefficient to obtain the temperature-compensated current element; All temperature-compensated current elements at the same sampling moment are arranged in the order of the sampling points to form the compensation current vector at that sampling moment.

5. The LED driver power supply current detection method based on electrical sensing according to claim 1, characterized in that, The specific process of segmenting the compensation current vector in the time domain and marking each segment as a steady-state segment or a transient segment according to the current change rate of each segment includes: According to the order of sampling time, the compensation current vector sequence is divided into multiple initial segments of equal time length; Calculate the difference in current amplitude between the first and last compensated current vectors within each initial segment, and divide this difference in current amplitude by the time length of the initial segment to obtain the rate of change of current in the initial segment. The initial segment with a current change rate less than a preset change rate threshold is marked as a steady-state segment, and the initial segment with a current change rate greater than or equal to the preset change rate threshold is marked as a transient segment. Adjacent initial segments with the same label are merged into a final segment, which is then used as the time-domain segmentation unit for subsequent calculations.

6. The LED driver power supply current detection method based on electrical sensing according to claim 5, characterized in that, The specific process of calculating the effective value of the first current in the steady-state segment using a low-frequency integral algorithm includes: Extract all compensation current vectors within the time-domain segmented cells marked as steady-state segments; The steady-state average current vector is obtained by averaging the current elements at each corresponding position in all extracted compensation current vectors. The sum of the squares of each current element in the steady-state average current vector, and then divided by the total number of elements in the steady-state average current vector, yields the square mean of the steady-state current. Take the square root of the mean square of the steady-state current, and use the resulting value as the first effective value of the current in the steady-state segment.

7. The LED driver power supply current detection method based on electrical sensing according to claim 5, characterized in that, The specific process of calculating the effective value of the second current using a high-frequency pulse counting algorithm for the transient segment includes: Extract all compensation current vectors within the time-domain segmented units labeled as transient segments, and determine the number of all sampling times within that transient segment; The vector difference between the compensation current vector at the current sampling time and the compensation current vector at the previous sampling time is detected at each sampling time. When the vector difference exceeds the preset difference threshold, a pulse event is recorded, and the occurrence time and direction of the vector difference are numbered and stored. The cumulative number of all pulse events within the transient segment is counted, and the cumulative number is divided by the number of all sampling times within the transient segment to obtain the pulse density. The pulse density is then multiplied by a preset unit current equivalent to obtain the second effective current value of the transient segment.

8. The LED driver power supply current detection method based on electrical sensing according to claim 1, characterized in that, The specific process of fusing the first current RMS value and the second current RMS value in chronological order to generate the continuous current detection output of the driving power supply includes: According to the order of each steady-state segment and transient segment on the original time axis, a segmentation type sequence is established. Each element in the segmentation type sequence records the label type of the corresponding time-domain segmentation unit. According to the segmentation type sequence, the first effective value of the current in each steady-state segment is filled into the time interval corresponding to the steady-state segment, and the second effective value of the current in each transient segment is filled into the time interval corresponding to the transient segment. At the boundary between the steady-state and transient sections, the arithmetic mean of the effective value of the end current of the previous section and the effective value of the beginning current of the next section is taken as the boundary transition value. The effective current values ​​and transition values ​​of all time intervals are spliced ​​together in chronological order to form a continuous current detection output sequence.

9. The LED driver power supply current detection method based on electrical sensing according to claim 1, characterized in that, It also includes the specific process of adaptively adjusting the range of the continuous current detection output: The maximum and minimum current values ​​in the continuous current detection output sequence are statistically analyzed, and the difference between the maximum and minimum current values ​​is calculated as the current dynamic range. Based on the current dynamic range, select the smallest available range from the multiple ranges built into the electrical sensor. The full-scale value of the smallest available range is greater than or equal to the current dynamic range. The gain coefficient corresponding to the selected range is sent to the front-end amplifier circuit of the electrical sensor to adjust the voltage amplification factor at subsequent sampling times. After adjusting the range setting, the previously generated continuous current detection output sequence is multiplied by the normalization conversion factor of that range setting to obtain the final current output with uniform dimensions.

10. An LED driver power supply current detection system based on electrical sensing, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the LED driver power supply current detection method based on electrical sensing as described in any one of claims 1 to 9.