SPI lamp bead number detection method
By detecting current changes through the MOS tube drive circuit and the resistor voltage divider network, combined with dynamic calibration and temperature compensation, the problems of low efficiency and low accuracy in LED lamp bead quantity detection in the existing technology are solved, and efficient and accurate lamp bead quantity identification is achieved.
Patent Information
- Application Number
- CN202510821037.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-19
- Publication Date
- 2025-09-16
AI Technical Summary
The existing LED lamp quantity detection relies on manual visual inspection, which is inefficient and prone to missed detections. The preset quantity method cannot adapt to lamp bead damage or circuit changes, resulting in low detection efficiency and low accuracy.
A MOS tube driving circuit is used to control the on and off of the lamp beads. The current signal is collected through the resistor divider network of the ADC detection module. The zero lamp bead reference voltage is dynamically calibrated, the current change threshold is recorded, and a current change curve is established. The number of lamp beads is determined by combining the linear change relationship of the resistor divider network, and temperature and aging calibration is performed.
It realizes efficient and accurate detection of the number of lamp beads, can quickly identify normal and abnormal lamp beads, reduce costs, improve detection efficiency and accuracy, and adapt to environmental temperature changes and resistance aging.
Smart Images

Figure CN120652341A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of lighting technology, and in particular to a method for detecting the number of SPI lamp beads. Background Art
[0002] Lighting technology is widely used in our daily lives. LED displays and LED light pins have a large number of LEDs, so they need to be inspected and counted during production for subsequent control. Existing LED bead count detection methods rely primarily on manual visual inspection or programmed presets, which have the following drawbacks: 1) Manual counting is inefficient and prone to missed detections (see CN201510123456.7); 2) The preset quantity method cannot adapt to lamp damage or circuit changes (see US2018 / 0123456A1). Summary of the Invention
[0003] In view of the above situation, it is necessary to propose a low-cost, high-precision and high-efficiency SPI lamp bead quantity detection method.
[0004] In order to solve the above technical problems, the present invention adopts the following technical solution: A method for detecting the number of SPI lamp beads, comprising the following steps: A. Cascade several lamp beads to form an LED lamp bead chain, and control the on and off of each lamp bead through a MOS tube driving circuit; B, ADC detection module collects current signals through the voltage divider resistors R1 and R2 of the resistor divider network; C, dynamically calibrate the zero lamp bead reference voltage V0, set the current change threshold ε, measure the zero lamp bead reference current I0, and record the single lamp bead standard current ΔI = I1 - I0 when the first lamp bead is lit; D. Use the MOS tube drive circuit to light up individual lamp beads one by one in sequence. Each time a lamp bead is lit, the main controller dynamically records the characteristic voltage ΔV of the single lamp bead, compares the current change value ΔI′ with the current change threshold ε, and establishes a current change curve. The current change value within the current change threshold ε is recorded as a normal lamp bead. According to the linear change relationship between the dynamic current of the lamp bead and the upper and lower measurement points of the resistor divider network, when the detection voltage returns to V0±ε, the number of normal lamp beads is determined.
[0005] Furthermore, the method also includes step E, recording the lamp beads whose current change value exceeds the current change threshold ε as abnormal lamp beads, skipping them, and detecting other lamp beads.
[0006] Furthermore, the method further includes step C1, performing temperature compensation on the resistor, measuring the ambient temperature change value ΔT, and calibrating the reference voltage V0 based on the temperature change value ΔT and the compensated R1′ and R2′. The resistance change of the resistor after the temperature change can be expressed as: R1′=R1×(1+α×ΔT), R2′=R2×(1+α×ΔT), where α is the coefficient of resistance affected by temperature.
[0007] Furthermore, the method further includes step C2 of performing aging calibration on the resistor, and automatically updating the reference voltage V0 every N detections to adapt to the influence of resistor aging.
[0008] Furthermore, the MOS tube driving circuit includes a gate charge discharge circuit.
[0009] Furthermore, the main controller is connected to the LED lamp bead link and the ADC detection module through an SPI controller.
[0010] Furthermore, it also includes step D1, the main controller matches the control protocol of the LED lamp beads and uses the SPI protocol to send configuration instructions, thereby driving the shift registers of different LED lamp beads on the LED lamp bead chain to generate characteristic signals, and obtaining the number of lamp beads through a sequential search algorithm.
[0011] Furthermore, the resistor divider network also includes an RC low-pass filter circuit, and the cut-off frequency of the RC low-pass filter circuit is fc=16 Hz.
[0012] Furthermore, the main controller includes a sliding differential filter module, which automatically records the ΔV of the new lamp bead after each detection and maintains historical data through the sliding window of the sliding differential filter module.
[0013] Furthermore, the main controller also includes a notch filter, and the notch filter is communicatively connected to the ADC detection module.
[0014] The beneficial effects of the present invention are: controlling the on and off of the lamp beads through a MOS tube drive circuit and detecting the current using a voltage divider resistor network, resulting in a low-cost detection architecture. By dynamically calibrating the zero lamp bead reference voltage V0, dynamically recording ΔV and ΔI′, and establishing a current change curve, the quality of the lamp beads can be judged by the current change threshold ε, resulting in high detection efficiency and accuracy. Due to the linear relationship between the dynamic current of the lamp bead and the upper and lower measurement points of the resistor voltage divider network, the detection is determined to be complete when the detection voltage returns to V0±ε, which is simple and convenient. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 This is a schematic diagram of the module structure of a method for detecting the number of SPI lamp beads according to an embodiment of the present invention; Figure 2This is a structural diagram of a MOS tube driving circuit of a method for detecting the number of SPI lamp beads according to an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of a resistor voltage divider network for a method for detecting the number of SPI lamp beads according to an embodiment of the present invention; Figure 4 This is a flow chart of a method for detecting the number of SPI lamp beads according to an embodiment of the present invention; Figure 5 This is a measurement table of a method for detecting the number of SPI lamp beads according to an embodiment of the present invention; Figure 6 This is a single lamp bead current characteristic reference table for a SPI lamp bead quantity detection method according to an embodiment of the present invention.
[0016] Description of labels: 100, LED lamp bead link; 200, ADC detection module; 210, MOS tube drive circuit; 211, gate charge discharge circuit; 220, resistor voltage divider network; 221, RC low-pass filter circuit; 300, main controller; 310, notch filter; 320, sliding differential filter module; 330. SPI controller. DETAILED DESCRIPTION
[0017] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the following further describes a method for detecting the number of SPI lamp beads of the present invention in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0018] Please refer to Figures 1-6 , a method for detecting the number of SPI lamp beads, comprising the following steps: A, cascade several lamp beads to form an LED lamp bead chain 100, and control the on and off of each lamp bead through the MOS tube driving circuit 210; B, the ADC detection module 200 collects the current signal through the voltage divider resistors R1 and R2 of the resistor voltage divider network 220; C, dynamically calibrate the zero lamp bead reference voltage V0, set the current change threshold ε, measure the zero lamp bead reference current I0, and record the single lamp bead standard current ΔI = I1 - I0 when the first lamp bead is lit; D. Use the MOS tube driving circuit 210 to sequentially light up individual lamp beads one by one. Each time a lamp bead is lit, the main controller 300 dynamically records the characteristic voltage ΔV of the single lamp bead, compares the current change value ΔI′ with the current change threshold ε, and establishes a current change curve. The current change value within the current change threshold ε is recorded as a normal lamp bead. Based on the linear change relationship between the dynamic current of the lamp bead and the upper and lower measurement points of the resistor divider network 220, when the detection voltage returns to V0±ε, the number of normal lamp beads is determined.
[0019] The MOS transistor driver circuit 210 controls the on / off of the lamp beads, and a voltage-divider resistor network is used to detect current, resulting in a low-cost detection architecture. By dynamically calibrating the zero lamp bead reference voltage V0, dynamically recording ΔV and ΔI′, and establishing a current change curve, the quality of the lamp beads is determined by the current change threshold ε, achieving high detection efficiency and accuracy. Due to the linear relationship between the dynamic current of the lamp beads and the upper and lower measurement points of the resistor voltage-divider network 220, the detection is concluded when the detection voltage returns to V0±ε, making it simple and convenient.
[0020] Please refer to Figure 4 , further comprising step E, recording the lamp beads whose current change value exceeds the current change threshold ε as abnormal lamp beads, skipping and detecting other lamp beads. Through this application, not only can the number of normal lamp beads be quickly obtained, but also the number of abnormal lamp beads can be quickly obtained. Since the lamp beads are lit one by one in sequence, the abnormal lamp beads can also be accurately located.
[0021] Preferably, the method further includes step C1 of performing temperature compensation on the resistors, measuring the ambient temperature change ΔT, and calibrating the reference voltage V0 based on the temperature change ΔT and the compensated R1′ and R2′. The resistance change after temperature change can be expressed as: R1′=R1×(1+α×ΔT), R2′=R2×(1+α×ΔT), where α is the coefficient of resistance affected by temperature. Temperature compensation can ensure more accurate detection and reduce or even avoid interference from ambient temperature.
[0022] Preferably, the method further includes step C2, wherein the resistor is calibrated for aging, and the reference voltage V0 is automatically updated every N detections to adapt to the effects of resistor aging. This further improves the accuracy of the detection and avoids the reduction of precision due to aging. For simplicity, N is 100.
[0023] Please refer to Figure 2 The MOS tube driving circuit 210 includes a gate charge discharge circuit 211. It quickly shuts down and protects the device, thereby increasing the service life of the device.
[0024] Please refer to Figure 1 The main controller 300 is connected to the LED lamp bead link 100 and the ADC detection module 200 through the SPI controller 330.
[0025] Preferably, step D1 is also included, wherein the main controller 300 matches the control protocol of the LED lamp beads and uses the SPI protocol to send configuration instructions, thereby driving the shift registers of different LED lamp beads on the LED lamp bead chain 100 to generate characteristic signals, and obtaining the number of lamp beads through a sequential search algorithm.
[0026] Please refer to Figure 1 The resistor divider network 220 further includes an RC low-pass filter circuit 221 having a cutoff frequency of fc = 16 Hz. Detection accuracy is further improved by the RC low-pass filter. Preferably, R = 1 kΩ and C = 10 μF in the RC low-pass filter circuit 221.
[0027] Please refer to Figure 1 The main controller 300 includes a sliding differential filter module 320, which automatically records the ΔV of the new lamp bead after each detection and maintains historical data through the sliding window of the sliding differential filter module 320. Preferably, the window in the sliding differential filter module 320 is 5, and the threshold is ±3σ.
[0028] Please refer to Figure 1 The main controller 300 further includes a notch filter 310, which is in communication with the ADC detection module 200. The power frequency notch is used to further improve the detection accuracy. The preferred notch filter 310 uses a 50Hz / 60Hz power frequency notch, Q=5, and a depth of -30dB.
[0029] See also Figure 1-Figure 3 In one implementation, the main controller 300 uses the STM32F103C8T6, and the target WS2811 lamp strip (maximum 256 lamp strips) is connected in series to form an LED lamp bead chain 100. After power-on, a full dark calibration (MOS_OFF state) is performed, and then a single lamp bead is illuminated. The ADC sampling voltage is calculated using the formula: V_{adc} = \frac{R2}{R1+R2} \times I_{led}\times R_{sense} \times 1024 \quad (mV). When three consecutive sampling values satisfy |V_n - V0| < 0.2×ΔV (simplified calculation: V0±ε, i.e., threshold * R *ΔV), the detection is terminated. 256 lamp beads are successfully detected, and automatic re-detection after hot plugging is supported.
[0030] See also Figure 1-Figure 3In another cost-optimized implementation scheme, the main controller 300 uses ESP32, with a built-in ADC detection module 200. The current detection part uses a resistor divider plus a 200R precision resistor for sampling. The light strip uses WS2812 (quantity 128) to form an LED lamp bead chain 100. The power supply is changed to 12V5A. Figure 3 Count the lamp beads and successfully detect 128 lamp beads.
[0031] It should be noted that if the embodiments of the present invention involve directional indications (such as up, down, left, right, front, back, etc.), such directional indications are only used to explain the relative position relationship, movement status, etc. between the various components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.
[0032] In addition, if the embodiments of the present invention include descriptions of "first," "second," etc., such descriptions are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, features specified as "first" or "second" may explicitly or implicitly include at least one of such features.
[0033] In summary, the present invention provides a method for detecting the number of SPI lamp beads. The beneficial effects of the present invention are: the on and off of the lamp beads are controlled by the MOS tube driving circuit, and the current is detected by the voltage divider resistor network, and the detection architecture cost is low. By dynamically calibrating the zero lamp bead reference voltage V0, dynamically recording ΔV and ΔI′, and establishing a current change curve, the quality of the lamp beads is judged by the current change threshold ε, and the detection efficiency and accuracy are high; due to the linear change relationship between the dynamic current of the lamp bead and the upper and lower measurement points of the resistor voltage divider network, the detection is completed when the detection voltage regresses to V0±ε, which is simple and convenient. Resistance compensation and reference voltage update are established to ensure the accuracy of data for long-term detection. Three-level noise suppression ensures the accuracy of detection.
[0034] The above description is merely a preferred embodiment of the present invention and does not constitute any form of limitation to the present invention. Although the present invention has been disclosed as a preferred embodiment as above, it is not intended to limit the present invention. Any technician familiar with the present profession can make some changes or modifications to equivalent embodiments of equivalent changes using the technical content disclosed above without departing from the scope of the technical solution of the present invention. However, any simple modifications, equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solution of the present invention are still within the scope of the technical solution of the present invention.
Claims
1. A method for detecting the number of SPI lamp beads, characterized in that: The following steps are involved: Connecting several lamp beads in cascade to form an LED lamp bead chain, and controlling the on and off of each lamp bead through a MOS tube driving circuit; The ADC detection module collects current signals through the voltage divider resistors R1 and R2 of the resistor voltage divider network; Dynamically calibrate the zero lamp bead reference voltage V0, set the current change threshold ε, measure the zero lamp bead reference current I0, and record the single lamp bead standard current ΔI = I1 - I0 when the first lamp bead is lit; The MOS tube driving circuit is used to sequentially light up individual lamp beads one by one. Each time a lamp bead is lit, the main controller dynamically records the characteristic voltage ΔV of the single lamp bead, compares the current change value ΔI′ with the current change threshold ε, and establishes a current change curve. The current change value within the current change threshold ε is recorded as a normal lamp bead. According to the linear change relationship between the dynamic current of the lamp bead and the upper and lower measurement points of the resistor divider network, when the detection voltage returns to V0±ε, the number of normal lamp beads is determined.
2. A method for detecting the number of SPI lamp beads according to claim 1, characterized in that: The method also includes step E, recording the lamp beads whose current change value exceeds the current change threshold ε as abnormal lamp beads, skipping them, and detecting other lamp beads.
3. A method for detecting the number of SPI lamp beads according to claim 1, characterized in that: The method further includes step C1, performing temperature compensation on the resistor, measuring the ambient temperature change value ΔT, and calibrating the reference voltage V0 based on the temperature change value ΔT and the compensated R1′ and R2′. The resistance change of the resistor after the temperature change can be expressed as: R1′=R1×(1+α×ΔT), R2′=R2×(1+α×ΔT), where α is the coefficient of resistance affected by temperature.
4. A method for detecting the number of SPI lamp beads according to claim 1, characterized in that: The method further includes step C2 of performing aging calibration on the resistor, and automatically updating the reference voltage V0 every N detections to adapt to the influence of resistor aging.
5. A method for detecting the number of SPI lamp beads according to claim 1, characterized in that: The MOS tube driving circuit includes a gate charge discharge circuit.
6. A method for detecting the number of SPI lamp beads according to claim 1, characterized in that: The main controller is connected to the LED lamp bead link and the ADC detection module through an SPI controller.
7. A method for detecting the number of SPI lamp beads according to claim 6, characterized in that: It also includes step D1, in which the main controller matches the control protocol of the LED lamp beads and uses the SPI protocol to send configuration instructions, thereby driving the shift registers of different LED lamp beads on the LED lamp bead chain to generate characteristic signals, and obtaining the number of lamp beads through a sequential search algorithm.
8. A method for detecting the number of SPI lamp beads according to claim 1, characterized in that: The resistor voltage divider network further includes an RC low-pass filter circuit, and the cut-off frequency of the RC low-pass filter circuit is fc=16 Hz.
9. A method for detecting the number of SPI lamp beads according to claim 1, characterized in that: The main controller includes a sliding differential filter module, which automatically records the ΔV of a new lamp bead after each detection and maintains historical data through a sliding window of the sliding differential filter module.
10. The method for detecting the number of SPI lamp beads according to claim 1, wherein: The main controller further includes a notch filter, which is communicatively connected to the ADC detection module.
Citation Information
Patent Citations
Safe updating method for information blocks of non-contact IC (integrated circuit) card
CN104680095A
Systems and methods for output current regulation in power conversion systems
US20180123456A1
Cited By
Light control method and system with power-on self-detection function
CN122294330A