Five-channel LED dimming method and system based on gray level distribution
Through the five-channel LED dimming method based on grayscale allocation, the existing dimming method cannot meet user needs, realizing the color temperature stability and smooth switching of dimming mode, providing a softer dimming experience.
Patent Information
- Application Number
- CN202511029017.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-25
- Publication Date
- 2025-08-22
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing LED dimming methods cannot dynamically adapt to user-defined needs, and there are problems such as color shift and dimming mode switching.
A five-channel LED dimming method based on grayscale allocation is adopted, including R channel, G channel, B channel, CW channel, and WW channel. By obtaining dimming mode and corresponding parameters, the grayscale value of each channel is calculated, and converted into a PWM signal to drive the LED to emit light, supporting white light, color light and atmosphere modes.
It realizes that LED dimming can dynamically adapt to user needs, avoid color temperature jumps and dimming mode switching is not smooth, and provides a softer dimming experience.
Smart Images

Figure CN120529451A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of LED dimming, and in particular to a five-channel LED dimming method and system based on grayscale distribution. Background Art
[0002] With the rapid development of LED lighting technology, multi-channel LEDs (such as RGB+cool white / warm white) have become the mainstream solution for smart lighting.
[0003] RGB is a color standard in the industry. It obtains various colors by changing the three color channels of red (R), green (G), and blue (B) and superimposing them on each other. RGB represents the colors of the three channels of red, green, and blue. This standard covers almost all colors that can be perceived by human vision and is one of the most widely used color systems.
[0004] Cool white refers to cool white light (CW), which usually has a color temperature range of 5000K to 8000K. The color is bluish or greenish, giving people a fresh and bright feeling. The light is relatively glaring and is suitable for places that require high-brightness lighting.
[0005] Warm white refers to warm white light (WW), which generally has a color temperature range of 2700K to 3500K. The color is yellowish or reddish, giving people a warm and comfortable feeling. The light is soft and does not cause eye fatigue, making it suitable for occasions where long periods of reading are required.
[0006] Traditional LED dimming methods typically use PWM (pulse width modulation) or analog current control, but these methods suffer from issues such as color shift and uneven dimming mode switching, making it difficult to dynamically adapt to user-defined needs. Summary of the Invention
[0007] Technical problem solved by the present invention: The present invention provides a five-channel LED dimming method and system based on grayscale distribution, which solves the problem that existing LED dimming cannot meet user needs.
[0008] The present invention solves the above technical problems by adopting a technical solution: a five-channel LED dimming method based on grayscale allocation, wherein the five channels include an R channel, a G channel, a B channel, a CW channel, and a WW channel, comprising the following steps: S1. Obtain a dimming mode, where the dimming mode includes a white light mode, a color light mode, and an atmosphere mode; S2. If the dimming mode is white light mode, obtain the set color temperature and brightness, map the set brightness to a grayscale value, convert the set color temperature to a color temperature ratio, and calculate the grayscale value of the WW channel and the grayscale value of the CW channel based on the color temperature ratio and the grayscale value; S3. If the dimming mode is color light mode, obtain the set RGB value and brightness, map the set brightness to a grayscale value, and calculate the R channel grayscale value, the G channel grayscale value, and the B channel grayscale value based on the RGB component ratio and the grayscale value; S4. If the dimming mode is the atmosphere mode, a pre-stored light effect script is used to generate real-time R channel grayscale values, G channel grayscale values, and B channel grayscale values; S5. Drive the LED to emit light according to the grayscale value of the R channel, the grayscale value of the G channel, the grayscale value of the B channel, the grayscale value of the CW channel, and the grayscale value of the WW channel.
[0009] Furthermore, the formula for setting brightness mapping to grayscale value is: ,in, Indicates the brightness of the setting. represents the maximum grayscale value, Represents the grayscale value of the mapping.
[0010] Furthermore, the formula for converting color temperature to color temperature ratio is: ,in, Indicates the maximum value in the color temperature range. Indicates the minimum value in the color temperature range. Indicates color temperature, Indicates the color temperature ratio.
[0011] Furthermore, the calculation formula of the grayscale value of the WW channel is: ,in, Indicates the grayscale value of the WW channel.
[0012] Furthermore, the calculation formula for the grayscale value of the CW channel is: ,in, Indicates the grayscale value of the CW channel.
[0013] Furthermore, the calculation formula for the grayscale value of the R channel is: ,in, Represents the grayscale value of the R channel, r represents the set R value, g represents the set G value, and b represents the set B value.
[0014] Furthermore, the calculation formula for the grayscale value of the G channel is: ,in, Represents the grayscale value of the G channel, r represents the set R value, g represents the set G value, and b represents the set B value.
[0015] Furthermore, the calculation formula for the grayscale value of the B channel is: ,in, Represents the grayscale value of the B channel, r represents the set R value, g represents the set G value, and b represents the set B value.
[0016] Furthermore, driving the LED to emit light includes: converting the R channel grayscale value, the G channel grayscale value, the B channel grayscale value, the CW channel grayscale value, and the WW channel grayscale value into corresponding PWM signals to drive the LED.
[0017] The present invention also provides a five-channel LED dimming system based on grayscale allocation, which implements the five-channel LED dimming method based on grayscale allocation as described above. The system includes a setting module, an R channel grayscale calculation module, a G channel grayscale calculation module, a B channel grayscale calculation module, a CW channel grayscale calculation module, a WW channel grayscale calculation module, a light effect script module and a driving module; the setting module is used to set the dimming mode and corresponding parameters; if the dimming mode is the white light mode, the CW channel grayscale calculation module is used to calculate the CW channel grayscale value, and the WW channel grayscale calculation module is used to calculate the CW channel grayscale value. The grayscale calculation module calculates the grayscale value of the WW channel; if the dimming mode is the color light mode, the R channel grayscale value is calculated by the R channel grayscale calculation module, the G channel grayscale value is calculated by the G channel grayscale calculation module, and the B channel grayscale value is calculated by the B channel grayscale calculation module; if the dimming mode is the atmosphere mode, the real-time R channel grayscale value, G channel grayscale value and B channel grayscale value are generated by the light effect script module; the driving module drives the LED to emit light according to the R channel grayscale value, G channel grayscale value, B channel grayscale value, CW channel grayscale value and WW channel grayscale value.
[0018] Beneficial effects of the present invention: The present invention provides a five-channel LED dimming method and system based on grayscale distribution. When the dimming mode is the white light mode, the set color temperature and brightness are obtained, the set brightness is mapped to a grayscale value, the set color temperature is converted into a color temperature ratio, and the WW channel grayscale value and the CW channel grayscale value are calculated based on the color temperature ratio and the grayscale value. When the dimming mode is the color light mode, the set RGB value and brightness are obtained, the set brightness is mapped to a grayscale value, and the R channel grayscale value, the G channel grayscale value and the B channel grayscale value are calculated based on the RGB component ratio and the grayscale value. When the dimming mode is the atmosphere mode, the real-time R channel grayscale value, G channel grayscale value and B channel grayscale value are generated by a pre-stored light effect script. According to the R channel grayscale value, the G channel grayscale value, the B channel grayscale value, the CW channel grayscale value and the WW channel grayscale value, the LED is driven to emit light, thereby solving the problem that the existing LED dimming cannot adapt to user needs. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 It is a flow chart of the five-channel LED dimming method based on grayscale distribution provided by the present invention. DETAILED DESCRIPTION
[0020] Aiming at the problem that the existing LED dimming cannot meet the needs of users, the present invention provides a five-channel LED dimming method based on grayscale distribution. The five channels include R channel, G channel, B channel, CW channel and WW channel. Figure 1 As shown, the following steps are included: S1. Obtain a dimming mode, where the dimming mode includes a white light mode, a color light mode, and an atmosphere mode.
[0021] Specifically, for different dimming modes, corresponding parameters need to be set. For example, the white light mode requires setting the color temperature and brightness, the color light mode requires setting the RGB value and brightness, and the atmosphere mode requires the address of a pre-stored light effect script.
[0022] S2. If the dimming mode is white light mode, obtain the set color temperature and brightness, map the set brightness to a grayscale value, convert the set color temperature to a color temperature ratio, and calculate the WW channel grayscale value and the CW channel grayscale value based on the color temperature ratio and the grayscale value.
[0023] Specifically, the formula for setting brightness mapping to grayscale value is: ,in, Indicates the brightness of the setting. Indicates the maximum grayscale value, which is determined by the software protocol. Represents the mapped grayscale value. The formula for converting color temperature to color temperature ratio is: ,in, Indicates the maximum value in the color temperature range. Indicates the minimum value in the color temperature range. Indicates color temperature, Indicates the color temperature ratio. The calculation formula for the grayscale value of the WW channel is: ,in, Indicates the grayscale value of the WW channel. The calculation formula for the grayscale value of the CW channel is: ,in, Indicates the grayscale value of the CW channel.
[0024] For example, if the brightness is set to 50%, the color temperature is 4000, the color temperature range is 2700 to 6500, and the maximum grayscale value is 1023, then the grayscale value of the brightness mapping is 511.5, and the color temperature ratio is: , the grayscale value of the WW channel is about 337, and the grayscale value of the CW channel is about 175. This avoids color temperature jumps.
[0025] S3. If the dimming mode is the color light mode, obtain the set RGB value and brightness, map the set brightness to a grayscale value, and calculate the R channel grayscale value, the G channel grayscale value, and the B channel grayscale value based on the RGB component ratio and the grayscale value.
[0026] Specifically, the calculation formula for the R channel grayscale value is: ,in, Indicates the grayscale value of the R channel, r indicates the set R value, g indicates the set G value, and b indicates the set B value. The calculation formula for the grayscale value of the G channel is: ,in, Represents the grayscale value of the G channel, r represents the set R value, g represents the set G value, and b represents the set B value. The calculation formula for the grayscale value of the B channel is: ,in, Represents the grayscale value of the B channel, r represents the set R value, g represents the set G value, and b represents the set B value.
[0027] For example, if the RGB value is set to (255, 100, 50), the brightness is 80%, and the maximum grayscale value is 1023, the grayscale value of the brightness mapping is 818.4, the grayscale value of the R channel is approximately 515, the grayscale value of the G channel is approximately 79, and the grayscale value of the B channel is approximately 20.
[0028] S4. If the dimming mode is the atmosphere mode, a pre-stored light effect script is used to generate real-time R channel grayscale values, G channel grayscale values, and B channel grayscale values.
[0029] Specifically, there may be multiple pre-stored light effect scripts, which are called through the addresses of the light effect scripts. The light effect scripts generate real-time R channel grayscale values, G channel grayscale values, and B channel grayscale values according to set rules or randomly.
[0030] S5. Drive the LED to emit light according to the grayscale value of the R channel, the grayscale value of the G channel, the grayscale value of the B channel, the grayscale value of the CW channel, and the grayscale value of the WW channel.
[0031] Specifically, driving the LED to emit light includes: converting the R channel grayscale value, G channel grayscale value, B channel grayscale value, CW channel grayscale value and WW channel grayscale value into corresponding PWM signals to drive the LED. The LED uses 5 types of lamp beads, corresponding to the R channel, G channel, B channel, CW channel and WW channel respectively, and the driver IC uses BP5758D or BP1658CJ.
[0032] In particular, S5 also includes all-zero detection, that is, if the grayscale value of the R channel, the grayscale value of the G channel, the grayscale value of the B channel, the grayscale value of the CW channel, and the grayscale value of the WW channel are all 0, the driver is turned off and the system enters the sleep mode.
[0033] In S5, an overload protection mechanism is also included, that is, the currents of the five channels are monitored in real time. If the current of any channel exceeds the threshold, the grayscale values of all channels are proportionally compressed so that the current of each channel does not exceed the threshold.
[0034] The present invention also provides a five-channel LED dimming system based on grayscale allocation, which implements the five-channel LED dimming method based on grayscale allocation as described above. The system includes a setting module, an R channel grayscale calculation module, a G channel grayscale calculation module, a B channel grayscale calculation module, a CW channel grayscale calculation module, a WW channel grayscale calculation module, a light effect script module and a driving module; the setting module is used to set the dimming mode and corresponding parameters; if the dimming mode is the white light mode, the CW channel grayscale calculation module is used to calculate the CW channel grayscale value, and the WW channel grayscale calculation module is used to calculate the CW channel grayscale value. The grayscale calculation module calculates the grayscale value of the WW channel; if the dimming mode is the color light mode, the R channel grayscale value is calculated by the R channel grayscale calculation module, the G channel grayscale value is calculated by the G channel grayscale calculation module, and the B channel grayscale value is calculated by the B channel grayscale calculation module; if the dimming mode is the atmosphere mode, the real-time R channel grayscale value, G channel grayscale value and B channel grayscale value are generated by the light effect script module; the driving module drives the LED to emit light according to the R channel grayscale value, G channel grayscale value, B channel grayscale value, CW channel grayscale value and WW channel grayscale value.
[0035] Specifically, the correspondence between the dimming modes and the corresponding parameters is: the white light mode corresponds to color temperature and brightness, the color light mode corresponds to RGB value and brightness, and the atmosphere mode corresponds to the address of a pre-stored light effect script.
[0036] In the present invention, the mode, brightness, color temperature, RGB value, the address of the pre-stored light effect script corresponding to the atmosphere mode, etc. can be set through a mobile application or a voice assistant.
Claims
1. A five-channel LED dimming method based on grayscale allocation, wherein the five channels include R channel, G channel, B channel, CW channel, and WW channel, characterized in that: The following steps are involved: S1. Obtain a dimming mode, where the dimming mode includes a white light mode, a color light mode, and an atmosphere mode; S2. If the dimming mode is white light mode, obtain the set color temperature and brightness, map the set brightness to a grayscale value, convert the set color temperature to a color temperature ratio, and calculate the grayscale value of the WW channel and the grayscale value of the CW channel based on the color temperature ratio and the grayscale value; S3. If the dimming mode is color light mode, obtain the set RGB value and brightness, map the set brightness to a grayscale value, and calculate the R channel grayscale value, the G channel grayscale value, and the B channel grayscale value based on the RGB component ratio and the grayscale value; S4. If the dimming mode is the atmosphere mode, a pre-stored light effect script is used to generate real-time R channel grayscale values, G channel grayscale values, and B channel grayscale values; S5. Drive the LED to emit light according to the grayscale value of the R channel, the grayscale value of the G channel, the grayscale value of the B channel, the grayscale value of the CW channel, and the grayscale value of the WW channel.
2. The five-channel LED dimming method based on grayscale allocation according to claim 1, characterized in that: The formula for setting brightness mapping to grayscale value is: ,in, Indicates the brightness of the setting. represents the maximum grayscale value, Represents the grayscale value of the mapping.
3. The five-channel LED dimming method based on grayscale allocation according to claim 2, characterized in that: The formula for converting color temperature to color temperature scale is: ,in, Indicates the maximum value in the color temperature range. Indicates the minimum value in the color temperature range. Indicates color temperature, Indicates the color temperature ratio.
4. The five-channel LED dimming method based on grayscale allocation according to claim 3, characterized in that: The calculation formula of the grayscale value of the WW channel is: ,in, Indicates the grayscale value of the WW channel.
5. The five-channel LED dimming method based on grayscale allocation according to claim 4, characterized in that: The calculation formula for the grayscale value of the CW channel is: ,in, Indicates the grayscale value of the CW channel.
6. The five-channel LED dimming method based on grayscale allocation according to claim 2, characterized in that: The calculation formula for the grayscale value of the R channel is: ,in, Represents the grayscale value of the R channel, r represents the set R value, g represents the set G value, and b represents the set B value.
7. The five-channel LED dimming method based on grayscale allocation according to claim 2, characterized in that: The calculation formula for the grayscale value of the G channel is: ,in, Represents the grayscale value of the G channel, r represents the set R value, g represents the set G value, and b represents the set B value.
8. The five-channel LED dimming method based on grayscale allocation according to claim 2, characterized in that: The calculation formula for the grayscale value of the B channel is: ,in, Represents the grayscale value of the B channel, r represents the set R value, g represents the set G value, and b represents the set B value.
9. The five-channel LED dimming method based on grayscale allocation according to claim 1, characterized in that: Driving the LED to emit light includes: converting the R channel grayscale value, the G channel grayscale value, the B channel grayscale value, the CW channel grayscale value, and the WW channel grayscale value into corresponding PWM signals to drive the LED.
10. A five-channel LED dimming system based on grayscale allocation, implementing the five-channel LED dimming method based on grayscale allocation as claimed in claim 1, characterized in that: The system includes a setting module, an R channel grayscale calculation module, a G channel grayscale calculation module, a B channel grayscale calculation module, a CW channel grayscale calculation module, a WW channel grayscale calculation module, a light effect script module and a driving module; The setting module is used to set the dimming mode and corresponding parameters; If the dimming mode is white light mode, the CW channel grayscale value is calculated by the CW channel grayscale calculation module, and the WW channel grayscale value is calculated by the WW channel grayscale calculation module; If the dimming mode is the color light mode, the R channel grayscale value is calculated by the R channel grayscale calculation module, the G channel grayscale value is calculated by the G channel grayscale calculation module, and the B channel grayscale value is calculated by the B channel grayscale calculation module; if the dimming mode is the atmosphere mode, the real-time R channel grayscale value, G channel grayscale value and B channel grayscale value are generated by the light effect script module; the driving module drives the LED to emit light according to the R channel grayscale value, G channel grayscale value, B channel grayscale value, CW channel grayscale value and WW channel grayscale value.
Citation Information
Patent Citations
Control system for implementing dimming and color mixing of indoor lamp of car
CN108811252A
Color light lamp lighting control method and terminal equipment
CN112616225A
Intelligent spectrum tuning code scanning auxiliary lighting method, system and equipment and medium
CN120264524A
Script-based intelligent lamp dynamic regulation and control method
CN120282353A