CN115175401A - RGB LED adjusting method and related assembly - Google Patents

RGB LED adjusting method and related assembly Download PDF

Info

Publication number
CN115175401A
CN115175401A CN202210928499.7A CN202210928499A CN115175401A CN 115175401 A CN115175401 A CN 115175401A CN 202210928499 A CN202210928499 A CN 202210928499A CN 115175401 A CN115175401 A CN 115175401A
Authority
CN
China
Prior art keywords
value
rgb
target
duty ratio
led
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210928499.7A
Other languages
Chinese (zh)
Inventor
宋大成
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Goertek Techology Co Ltd
Original Assignee
Goertek Techology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Goertek Techology Co Ltd filed Critical Goertek Techology Co Ltd
Priority to CN202210928499.7A priority Critical patent/CN115175401A/en
Publication of CN115175401A publication Critical patent/CN115175401A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H05ELECTRIC TECHNIQUES NOT OTHERWISE PROVIDED FOR
    • H05BELECTRIC HEATING; ELECTRIC LIGHT SOURCES NOT OTHERWISE PROVIDED FOR; CIRCUIT ARRANGEMENTS FOR ELECTRIC LIGHT SOURCES, IN GENERAL
    • H05B45/00Circuit arrangements for operating light-emitting diodes [LED]
    • H05B45/20Controlling the colour of the light
    • HELECTRICITY
    • H05ELECTRIC TECHNIQUES NOT OTHERWISE PROVIDED FOR
    • H05BELECTRIC HEATING; ELECTRIC LIGHT SOURCES NOT OTHERWISE PROVIDED FOR; CIRCUIT ARRANGEMENTS FOR ELECTRIC LIGHT SOURCES, IN GENERAL
    • H05B45/00Circuit arrangements for operating light-emitting diodes [LED]
    • H05B45/10Controlling the intensity of the light
    • HELECTRICITY
    • H05ELECTRIC TECHNIQUES NOT OTHERWISE PROVIDED FOR
    • H05BELECTRIC HEATING; ELECTRIC LIGHT SOURCES NOT OTHERWISE PROVIDED FOR; CIRCUIT ARRANGEMENTS FOR ELECTRIC LIGHT SOURCES, IN GENERAL
    • H05B45/00Circuit arrangements for operating light-emitting diodes [LED]
    • H05B45/20Controlling the colour of the light
    • H05B45/22Controlling the colour of the light using optical feedback
    • HELECTRICITY
    • H05ELECTRIC TECHNIQUES NOT OTHERWISE PROVIDED FOR
    • H05BELECTRIC HEATING; ELECTRIC LIGHT SOURCES NOT OTHERWISE PROVIDED FOR; CIRCUIT ARRANGEMENTS FOR ELECTRIC LIGHT SOURCES, IN GENERAL
    • H05B45/00Circuit arrangements for operating light-emitting diodes [LED]
    • H05B45/30Driver circuits
    • H05B45/32Pulse-control circuits
    • H05B45/325Pulse-width modulation [PWM]
    • HELECTRICITY
    • H05ELECTRIC TECHNIQUES NOT OTHERWISE PROVIDED FOR
    • H05BELECTRIC HEATING; ELECTRIC LIGHT SOURCES NOT OTHERWISE PROVIDED FOR; CIRCUIT ARRANGEMENTS FOR ELECTRIC LIGHT SOURCES, IN GENERAL
    • H05B47/00Circuit arrangements for operating light sources in general, i.e. where the type of light source is not relevant
    • H05B47/10Controlling the light source
    • H05B47/165Controlling the light source following a pre-assigned programmed sequence; Logic control [LC]

Landscapes

  • Control Of Indicators Other Than Cathode Ray Tubes (AREA)

Abstract

The invention discloses an adjusting method and a related component of an RGB LED, and relates to the field of RGB LED control. And then, determining a new brightness value in the target HSV value according to the brightness value in the current HSV value and the target brightness adjustment value, converting the target HSV value into a target RGB value so as to obtain a target duty ratio of a PWM signal for controlling the RGB LED based on the target RGB value, and controlling the RGB LED to display ideal brightness without influencing the display color and the saturation of the RGB LED after the PWM signal of the target duty ratio is output to the RGB LED by the PWM driving device.

Description

RGB LED adjusting method and related assembly
Technical Field
The invention relates to the field of RGB LED control, in particular to an RGB LED adjusting method and a related component.
Background
The intelligent sound box is often provided with RGB LEDs, the RGB LEDs are important ways for interaction between the intelligent sound box and a user, and different working states of the intelligent sound box can be represented by controlling the RGB LEDs to flicker or display different colors. A common method for controlling the brightness and color of the RGB LED is to change the brightness of the RGB LED by adjusting the duty ratio of the PWM, and to generate various color mixtures by controlling the brightness ratios of the red LED, the green LED, and the blue LED in the RGB LED. When the display colors of the RGB LEDs are mixed, the duty ratio of the PWM needs to be adjusted if the luminance of the display colors is changed, but adjusting the duty ratio of the PWM affects the display colors of the RGB LEDs and causes deviation from a desired display effect.
Disclosure of Invention
The invention aims to provide an adjusting method of an RGB LED and a related component, which can control the RGB LED to display the ideal brightness without influencing the displayed hue and saturation of the RGB LED.
In order to solve the above technical problem, the present invention provides a method for adjusting an RGB LED, comprising:
determining a current RGB value corresponding to a color currently displayed by the RGB LED, and converting the current RGB value into a current HSV value;
determining a new brightness value in the target HSV value according to the brightness value in the current HSV value and the target brightness adjustment value, and converting the target HSV value into a target RGB value;
and obtaining a target duty ratio of PWM signals for controlling the RGB LED based on the target RGB value so as to output the PWM signals with the duty ratio of the target duty ratio to the RGB LED through a PWM driving device.
Preferably, determining a new brightness value of the target HSV values according to the brightness value of the current HSV values and the target brightness adjustment value includes:
dividing the target brightness adjustment value by the brightness value corresponding to the current HSV value to obtain a quotient used as a brightness adjustment proportion;
multiplying the brightness value in the current HSV value by the brightness adjustment proportion to obtain a brightness value corresponding to the brightness adjustment value;
and taking the brightness value corresponding to the brightness adjustment value as a new brightness value in the target HSV value.
Preferably, before converting the target HSV value into the target RGB value, the method further includes:
when the new brightness value in the target HSV value is not less than a preset maximum brightness value, taking the preset maximum brightness value as the new brightness value in the target HSV value;
and when the new brightness value in the target HSV value is not greater than a preset minimum brightness value, taking the preset minimum brightness value as the new brightness value in the target HSV value.
Preferably, before determining the current RGB value corresponding to the color currently displayed by the RGB LED, the method further includes:
after the color currently displayed by the RGB LED is judged to be mixed color, the step of determining the current RGB value corresponding to the color currently displayed by the RGB LED is carried out;
after the color currently displayed by the RGB LED is judged to be a single color, the following steps are executed:
acquiring a current monochromatic RGB value corresponding to the currently displayed color of the RGB LED;
determining a target monochrome RGB value according to the brightness value corresponding to the current monochrome RGB value and the monochrome brightness adjustment value;
and obtaining a target single-color duty ratio of a PWM signal for controlling the RGB LED based on the target single-color RGB value, so that the PWM driving device outputs the PWM signal with the duty ratio of the target single-color duty ratio to the RGB LED.
Preferably, when adjusting the color of the RGB LED, the method further includes:
acquiring a target display color of the RGB LED;
determining a target color RGB value corresponding to the target display color;
and respectively obtaining a red PWM signal duty ratio, a green PWM signal duty ratio and a blue PWM signal duty ratio according to a red RGB value, a green RGB value and a blue RGB value in the target color RGB value, so that the PWM driving device respectively outputs a red PWM signal with the duty ratio of the red PWM signal duty ratio, a green PWM signal with the duty ratio of the green PWM signal duty ratio and a blue PWM signal with the duty ratio of the blue PWM signal duty ratio to a red LED, a green LED and a blue LED in the RGB LEDs.
Preferably, deriving the target duty cycle of the PWM signal for controlling the RGB LED based on the target RGB value includes:
acquiring a red RGB value, a green RGB value and a blue RGB value in the target RGB value;
substituting the red RGB value, the green RGB value and the blue RGB value into a duty ratio calculation formula respectively to obtain the duty ratio of a red PWM signal, the duty ratio of a green PWM signal and the duty ratio of a blue PWM signal;
the duty ratio calculation formula is X = RGB/255 × 100% × K, where X is a duty ratio of the PWM signal, RGB is the red RGB value, the green RGB value, and the blue RGB value, and K is a preset calibration constant.
In order to solve the above technical problem, the present invention further provides an RGB LED adjusting system, including:
the first conversion unit is used for determining a current RGB value corresponding to a color currently displayed by the RGB LED and converting the current RGB value into a current HSV value;
the second conversion unit is used for determining a new brightness value in the target HSV values according to the brightness value in the current HSV values and the target brightness adjustment value, and converting the target HSV values into target RGB values;
and the duty ratio calculation unit is used for obtaining a target duty ratio of a PWM signal for controlling the RGB LED based on the target RGB value so as to output the PWM signal with the duty ratio of the target duty ratio to the RGB LED through a PWM driving device.
In order to solve the above technical problem, the present invention further provides an RGB LED adjusting device, including:
a memory for storing a computer program;
and the processor is used for realizing the steps of the RGB LED adjusting method when executing the computer program.
In order to solve the technical problem, the invention further provides an intelligent sound box which comprises the RGB LED adjusting device.
In order to solve the above technical problem, the present invention further provides a computer-readable storage medium, where a computer program is stored, and the computer program, when executed by a processor, implements the steps of the RGB LED adjusting method.
In summary, the present invention provides an RGB LED adjusting method and related components, which first determine a current RGB value corresponding to a color currently displayed by an RGB LED, and convert the current RGB value into a current HSV value so as to change the brightness of the RGB LED by adjusting a brightness value in the current HSV value. And then, determining a new brightness value in the target HSV value according to the brightness value in the current HSV value and the target brightness adjustment value, converting the target HSV value into a target RGB value so as to obtain a target duty ratio for controlling a PWM signal of the RGB LED based on the target RGB value, and controlling the RGB LED to display ideal brightness without influencing the display color and the saturation of the RGB LED after the PWM signal of the target duty ratio is output to the RGB LED by the PWM driving device.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required in the prior art and the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
FIG. 1 is a schematic flow chart of a RGB LED adjusting method according to the present invention;
FIG. 2 is a schematic flow chart of another RGB LED adjusting method provided by the present invention;
FIG. 3 is a schematic flow chart of another RGB LED adjusting method provided by the present invention;
FIG. 4 is a schematic structural diagram of an RGB LED regulation system according to the present invention;
fig. 5 is a schematic structural diagram of an RGB LED adjusting device provided in the present invention.
Detailed Description
The core of the invention is to provide an RGB LED adjusting method and related components, which can control the RGB LED to display the ideal brightness without influencing the displayed hue and saturation of the RGB LED.
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, belong to the protection scope of the present invention.
Referring to fig. 1, fig. 1 is a schematic flow chart of an RGB LED adjusting method according to the present invention, where the RGB LED adjusting method includes:
s1: determining a current RGB value corresponding to a color currently displayed by the RGB LED, and converting the current RGB value into a current HSV value;
PWM dimming is a dimming technique that repeatedly switches an RGB LED using digital pulses, and adjusts the brightness of the RGB LED by setting the digital pulse width of PWM, that is, the duty ratio of PWM, to change the average output current output to the RGB LED. The RGB LED comprises a red LED, a green LED and a blue LED, the LED of each color corresponds to one path of PWM, and the proportion of the brightness of the red LED, the green LED and the blue LED is different by adjusting the proportion of the duty ratio of each path of PWM, so that the RGB LED displays other colors except red, green and blue. Therefore, when the RGB LED is monochromatic light (red, green, or blue), the brightness of the RGB LED can be adjusted by only proportionally adjusting the duty ratio of the PWM corresponding to the LED of a certain color, but when the RGB LED is color-mixed (combination of any two or three of red, green, and blue), it is difficult to adjust only the brightness, and the hue and saturation of the RGB LED are often affected.
The HSV model is a method for representing points of an RGB color model in a cylindrical coordinate system, and comprises three dimensions: the hue H is the color, the saturation S is the purity of the color, and the value V is the brightness of the color. In the application, considering that only the brightness value is adjusted under the HSV model and the hue and the saturation are not changed, therefore, in order to achieve the purpose that the RGB LED can only adjust the brightness without changing the color and the saturation thereof under the condition of displaying the mixed color, firstly, the color currently displayed by the RGB LED is determined and the corresponding RGB value is calculated according to the color currently displayed by the RGB LED, and how to calculate the corresponding RGB value according to the color is not described in more detail in the application. After the current RGB value is calculated, the current RGB value is converted into a current HSV value, which may be performed, for example, using an RGB HSV conversion model.
S2: determining a new brightness value in the target HSV value according to the brightness value in the current HSV value and the target brightness adjustment value, and converting the target HSV value into a target RGB value;
adjusting the brightness value under the RGB model is equivalent to adjusting the brightness value under the HSV model, so that a new brightness value in the target HSV value can be determined according to the target brightness adjustment value input by the user. And finally, obtaining a target HSV value according to the brightness value in the current HSV value and the new brightness value, namely, controlling the corresponding HSV value when the RGB LED is controlled to display the target brightness. For example, the lightness value in the current HSV value may be replaced with a new lightness value, and the hue and saturation in the current HSV value remain unchanged, so that the target lightness value may be obtained.
After the target HSV is obtained, in order to determine the duty ratio of the PWM for controlling the display color of the RGB LED, the target HSV value needs to be converted into the target RGB value, for example, the target HSV value is converted into the target RGB value by using an HSV RGB conversion model, which is not particularly limited in this application.
S3: and obtaining a target duty ratio of the PWM signal for controlling the RGB LED based on the target RGB value, so that the PWM signal with the duty ratio as the target duty ratio is output to the RGB LED through the PWM driving device.
After the target RGB value is obtained, the target duty ratio of the PWM signal for controlling the RGB LED display condition can be obtained based on the target RGB value, for example, the target duty ratio of the target PWM signal is obtained by using an RGB PWM duty ratio calculation formula, which is not described herein in more detail.
In summary, based on the principle that only the brightness value is adjusted under the HSV model and the hue and the saturation are not changed, the present RGB value corresponding to the color currently displayed by the RGB LED is determined, and the present RGB value is converted into the present HSV value, so that the brightness of the RGB LED is changed by adjusting the brightness value in the present HSV value. And then, determining a new brightness value in the target HSV value according to the brightness value in the current HSV value and the target brightness adjustment value, converting the target HSV value into a target RGB value so as to obtain a target duty ratio of a PWM signal for controlling the RGB LED based on the target RGB value, and controlling the RGB LED to display ideal brightness without influencing the display color and the saturation of the RGB LED after the PWM signal of the target duty ratio is output to the RGB LED by the PWM driving device.
On the basis of the above-described embodiment:
as a preferred embodiment, determining a new brightness value of the target HSV values according to the brightness value of the current HSV values and the target brightness adjustment value includes:
dividing the target brightness adjustment value by the quotient of the brightness values corresponding to the current HSV value to serve as a brightness adjustment proportion;
multiplying the brightness value in the current HSV value by the brightness adjustment proportion to obtain a brightness value corresponding to the brightness adjustment value;
and taking the brightness value corresponding to the brightness adjustment value as a new brightness value in the target HSV value.
In this embodiment, the target brightness adjustment value input by the user is converted into a brightness ratio corresponding to the current display color of the RGB LED, that is, the brightness value corresponding to the current HSV value, and since the brightness value in the HSV model is equivalent to the brightness value, the brightness adjustment ratio is also equivalent to the adjustment ratio for the brightness value in the current HSV value, the brightness value corresponding to the brightness adjustment value is obtained by multiplying the brightness value in the current HSV value by the brightness adjustment ratio in this embodiment, and finally the brightness value corresponding to the brightness adjustment value is used as a new brightness value in the target HSV value. Referring to fig. 2, fig. 2 is a schematic flow chart of another RGB LED adjusting method according to the present invention.
For example, if the brightness value corresponding to the current HSV value is the reference value Vref of 100% brightness, and the brightness adjustment ratio is determined to be 20% based on the brightness adjustment value input by the user, the new brightness value in the target HSV value is Vtmp = Vref (100% + 20%).
In addition, when a user only wants to change the brightness of the RGB LED, the hue and the saturation in the target HSV value are consistent with the original hue and the saturation in the current HSV value; when a user wants to adjust the brightness and color of the RGB LED at the same time, the hue and saturation in the target HSV value may be different from the hue and saturation in the current HSV value.
In summary, in the embodiment, based on the principle that the brightness value under the HSV model is equivalent to the brightness value under the RGB model, after the brightness adjustment ratio is determined based on the brightness adjustment value input by the user, the brightness adjustment ratio is multiplied by the brightness value in the current HSV value to obtain a new brightness value in the target HSV value, so that the calculation amount is relatively small, and the calculation method is simple.
As a preferred embodiment, before converting the target HSV value into the target RGB value, the method further includes:
when the new brightness value in the target HSV value is not smaller than the preset maximum brightness value, taking the preset maximum brightness value as the new brightness value in the target HSV value;
and when the new brightness value in the target HSV value is not greater than the preset minimum brightness value, taking the preset minimum brightness value as the new brightness value in the target HSV value.
In this embodiment, in order to ensure that the new value of the target HSV values is within the valid range, before the target HSV values are converted into the target RGB values, it is first determined whether the new value of the target HSV values is within a reasonable range of a preset minimum value of the brightness and a preset maximum value of the brightness, and when the new value of the target HSV values is not less than the preset maximum value of the brightness, the preset maximum value of the brightness is used as the new value of the target HSV values; and when the new brightness value in the target HSV value is not greater than the preset minimum brightness value, taking the preset minimum brightness value as the new brightness value in the target HSV value to ensure that the new brightness value in the target HSV value is within a reasonable range.
The specific values of the preset minimum brightness value and the preset maximum brightness value are not particularly limited in the present application, for example, a brightness value of 0 under the HSV model is set as the preset minimum brightness value, and a brightness value of 1 under the HSV model is defined as the preset maximum brightness value.
In conclusion, in this embodiment, it is ensured that the new brightness value in the target HSV value is within the reasonable range, and a guarantee is provided for normal display of the RGB LED.
As a preferred embodiment, before determining the current RGB value corresponding to the color currently displayed by the RGB LED, the method further includes:
after judging that the color currently displayed by the RGB LED is mixed, entering a step of determining a current RGB value corresponding to the color currently displayed by the RGB LED;
after the color currently displayed by the RGB LED is judged to be monochromatic, the following steps are executed:
acquiring a current monochromatic RGB value corresponding to a currently displayed color of the RGB LED;
determining a target monochrome RGB value according to a brightness value corresponding to the current monochrome RGB value and a monochrome brightness adjustment value;
a target monochrome duty ratio of a PWM signal for controlling the RGB LED is obtained based on the target monochrome RGB value, so that the PWM driving device outputs the PWM signal having the duty ratio of the target monochrome duty ratio to the RGB LED.
Considering that only when the current display color of the RGB LED is mixed, the current RGB value needs to be converted into an HSV value in order to avoid changing the brightness of the RGB LED and also affecting the color and saturation of the RGB LED, and after a brightness value in the HSV value is adjusted according to a user requirement to obtain a target HSV value, the target HSV value is converted into a target RGB value so as to obtain a duty ratio of a PWM signal.
Specifically, after the color currently displayed by the RGB LED is judged to be the mixed color, the step of determining the current RGB value corresponding to the color currently displayed by the RGB LED is performed, which is not described in detail herein. After the color currently displayed by the RGB LED is judged to be a single color, firstly, a current single-color RGB value corresponding to the color currently displayed by the RGB LED is obtained, then, a target single-color RGB value is determined according to a brightness value corresponding to the current single-color RGB value and a single-color brightness adjusting value input by a user, and finally, a target single-color duty ratio of a PWM signal for controlling the RGB LED is obtained based on the target single-color RGB value, so that the PWM driving device outputs the PWM signal with the duty ratio being the target single-color duty ratio to the RGB LED.
For example, the color currently displayed by the RGB LED is red, the current monochrome RGB value is RGB (100, 0), the luminance value corresponding to the current monochrome RGB value is taken as a reference, i.e., vref =100, the luminance adjustment ratio is determined to be x% based on the monochrome luminance adjustment value input by the user, and then the target monochrome RGB value is Vtmp = Vref (1 + x%), and in order to ensure that the target monochrome RGB value is within the valid range, it is further necessary to take 255 as the target monochrome RGB value when the target monochrome RGB value is not less than the maximum value of the RGB model, i.e., 255, vn = MIN (255, vtemp), and then Vn is taken as a new RGB value to obtain the target monochrome RGB value: RGB (Vn, 0).
In summary, in the embodiment, different PWM signal duty ratio calculation methods are selected for different situations where the currently displayed color of the RGB LED is mixed color or single color, so that the calculation process of the duty ratio of the PWM signal is simplified.
As a preferred embodiment, when adjusting the color of the RGB LED, the method further includes:
acquiring target display colors of RGB LEDs;
determining a target color RGB value corresponding to a target display color;
and respectively obtaining a red PWM signal duty ratio, a green PWM signal duty ratio and a blue PWM signal duty ratio according to a red RGB value, a green RGB value and a blue RGB value in the target color RGB value, so that the PWM driving device respectively outputs a red PWM signal with the duty ratio of the red PWM signal duty ratio, a green PWM signal with the duty ratio of the green PWM signal duty ratio and a blue PWM signal with the duty ratio of the blue PWM signal duty ratio to a red LED, a green LED and a blue LED in the RGB LEDs.
In view of that, besides the brightness value of the RGB LED needs to be adjusted, the actual color of the RGB LED sometimes needs to be adjusted, therefore, in this embodiment, when the color of the RGB LED needs to be adjusted, the target display color of the RGB LED is first obtained, then the target color RGB value is determined based on the target display color, the target color RGB value includes a red RGB value, a green RGB value, and a blue RGB value, a red PWM signal duty ratio, a green PWM signal duty ratio, and a blue PWM signal duty ratio are obtained based on the red RGB value, the green RGB value, and the blue RGB value, respectively, and the PWM driving device outputs PWM signals whose duty ratios are the red PWM signal duty ratio, the green PWM signal duty ratio, and the blue PWM signal duty ratio, respectively, to the red LED, the green LED, and the blue LED, so as to control the RGB LED to display different colors. Referring to fig. 3, fig. 3 is a schematic flow chart of another RGB LED adjusting method provided in the present invention.
The present application is not particularly limited as to how to determine the RGB value of the target color based on the target display color and how to obtain the duty ratio of the corresponding PWM signal according to the RGB value, as long as the above-mentioned purpose can be achieved.
As a preferred embodiment, deriving a target duty cycle of a PWM signal for controlling an RGB LED based on a target RGB value includes:
acquiring a red RGB value, a green RGB value and a blue RGB value in a target RGB value;
substituting the red RGB value, the green RGB value and the blue RGB value into a duty ratio calculation formula respectively to obtain the duty ratio of a red PWM signal, the duty ratio of a green PWM signal and the duty ratio of a blue PWM signal;
the duty ratio calculation formula is X = RGB/255 × 100% × K, where X is the duty ratio of the PWM signal, RGB is a red RGB value, a green RGB value, and a blue RGB value, and K is a preset calibration constant.
In practical applications, the RGB model is usually used to change and control the color and brightness of the RGB LED, the RGB model describes three primary colors with 3 data of 8 bits, each data is between 0 and 255, in this embodiment, a linear dimming scheme is adopted to establish a linear correspondence relationship between the RGB model and the PWM duty ratio: x = RGB/255 × 100% × K, so that after the target RGB values are obtained, the duty ratio of the red PWM signal, the duty ratio of the green PWM signal, and the duty ratio of the blue PWM signal can be obtained by substituting the red RGB values, the green RGB values, and the blue RGB values in the target RGB values into the duty ratio calculation formula, and the calculation method is relatively simple.
It should be noted that, a K-bit preset calibration constant in the duty ratio calculation formula determines a coefficient required for calibrating the duty ratio calculation formula into linearity through multiple experiments before controlling the RGB LED, and the coefficient is used as the preset calibration constant.
In the embodiment, a linear corresponding relation between the RGB model and the PWM duty ratio, namely a duty ratio calculation formula is established, so that the calculation process and difficulty of the duty ratio of the PWM signal can be simplified, and the control of the RGB LED is facilitated.
Referring to fig. 4, fig. 4 is a schematic structural diagram of an RGB LED adjusting system provided in the present invention, the system includes:
the first conversion unit 11 is configured to determine a current RGB value corresponding to a color currently displayed by the RGB LED, and convert the current RGB value into a current HSV value;
a second converting unit 12, configured to determine a new brightness value of the target HSV values according to the brightness value of the current HSV values and the target brightness adjustment value, and convert the target HSV value into a target RGB value;
and a duty ratio calculation unit 13 for obtaining a target duty ratio of the PWM signal for controlling the RGB LED based on the target RGB value, so as to output the PWM signal having the duty ratio of the target duty ratio to the RGB LED through the PWM driving apparatus.
For the related introduction of the RGB LED adjusting system provided by the present invention, please refer to the above embodiment of the RGB LED adjusting method, which is not described herein again.
On the basis of the above-described embodiment:
as a preferred embodiment, the second conversion unit 12 includes:
the brightness adjustment ratio determining unit is used for dividing the target brightness adjustment value by the brightness value corresponding to the current HSV value to obtain a brightness adjustment ratio;
the brightness value determining unit is used for multiplying the brightness value in the current HSV value by the brightness adjustment proportion to obtain a brightness value corresponding to the brightness adjustment value;
the target HSV value determining unit is used for taking the brightness value corresponding to the brightness adjusting value as a new brightness value in the target HSV value;
and the target RGB value determining unit is used for converting the target HSV value into a target RGB value.
As a preferred embodiment, the method further comprises the following steps:
a first control unit, configured to, before converting the target HSV value into the target RGB value, take the preset maximum lightness value as a new lightness value in the target HSV values when the new lightness value in the target HSV values is not less than the preset maximum lightness value;
and a second control unit for taking the preset minimum lightness value as a new lightness value in the target HSV values when the new lightness value in the target HSV values is not greater than the preset minimum lightness value before the target HSV values are converted into the target RGB values.
As a preferred embodiment, the method further comprises the following steps:
the color mixing control unit is used for entering the step of determining the current RGB value corresponding to the color currently displayed by the RGB LED after judging that the color currently displayed by the RGB LED is mixed before determining the current RGB value corresponding to the color currently displayed by the RGB LED;
the single-color control unit is used for triggering the current single-color RGB value acquisition unit after judging that the color currently displayed by the RGB LED is a single color before determining the current RGB value corresponding to the color currently displayed by the RGB LED;
the current monochrome RGB value acquisition unit is used for acquiring a current monochrome RGB value corresponding to a color currently displayed by the RGB LED;
the target monochrome RGB value determining unit is used for determining a target monochrome RGB value according to the brightness value corresponding to the current monochrome RGB value and the monochrome brightness adjusting value;
and the target single-color duty ratio determining unit is used for obtaining a target single-color duty ratio of the PWM signal for controlling the RGB LED based on the target single-color RGB value so that the PWM driving device outputs the PWM signal with the duty ratio of the target single-color duty ratio to the RGB LED.
As a preferred embodiment, the method further comprises the following steps:
a target display color acquisition unit for acquiring a target display color of the RGB LED when adjusting the color of the RGB LED;
the target color RGB value determining unit is used for determining a target color RGB value corresponding to the target display color;
and the RGB value acquisition unit of each color is used for respectively obtaining a red PWM signal duty ratio, a green PWM signal duty ratio and a blue PWM signal duty ratio according to the red RGB value, the green RGB value and the blue RGB value in the target color RGB value, so that the PWM driving device respectively outputs the red PWM signal with the duty ratio of the red PWM signal duty ratio, the green PWM signal with the duty ratio of the green PWM signal duty ratio and the blue PWM signal with the duty ratio of the blue PWM signal duty ratio to a red LED, a green LED and a blue LED in the RGB LEDs.
As a preferred embodiment, the duty ratio calculation unit 13 includes:
the device comprises a target RGB value acquisition unit of each color, a color filter unit and a color filter unit, wherein the target RGB value acquisition unit of each color is used for acquiring a red RGB value, a green RGB value and a blue RGB value in a target RGB value;
the calculating unit is used for substituting the red RGB value, the green RGB value and the blue RGB value into a duty ratio calculating formula respectively to obtain the duty ratio of the red PWM signal, the duty ratio of the green PWM signal and the duty ratio of the blue PWM signal;
the duty ratio calculation formula is X = RGB/255 × 100% × K, where X is the duty ratio of the PWM signal, RGB is a red RGB value, a green RGB value, and a blue RGB value, and K is a preset calibration constant.
Referring to fig. 5, fig. 5 is a schematic structural diagram of an RGB LED adjusting device provided in the present invention, the device includes:
a memory 21 for storing a computer program;
and a processor 22, configured to implement the steps of the RGB LED adjusting method when executing the computer program.
For the related introduction of the RGB LED adjusting device provided by the present invention, please refer to the above embodiment of the RGB LED adjusting method, which is not described herein again.
The invention also provides an intelligent sound box which comprises the RGB LED adjusting device.
For the related introduction of the intelligent sound box provided by the present invention, please refer to the above embodiment of the RGB LED adjusting method, which is not described herein again.
The invention further provides a computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the steps of the RGB LED adjusting method described above.
For the related introduction of a computer-readable storage medium provided by the present invention, please refer to the above embodiment of the RGB LED adjusting method, which is not described herein again.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed in the embodiment corresponds to the method disclosed in the embodiment, so that the description is simple, and the relevant points can be referred to the description of the method part.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A method for adjusting an RGB LED, comprising:
determining a current RGB value corresponding to a currently displayed color of the RGB LED, and converting the current RGB value into a current HSV value;
determining a new brightness value in the target HSV value according to the brightness value in the current HSV value and the target brightness adjustment value, and converting the target HSV value into a target RGB value;
and obtaining a target duty ratio of PWM signals for controlling the RGB LED based on the target RGB value so as to output the PWM signals with the duty ratio of the target duty ratio to the RGB LED through a PWM driving device.
2. The method of adjusting an RGB LED of claim 1, wherein determining a new one of target HSV values from the lightness value of the current HSV values and a target lightness adjustment value includes:
dividing the target brightness adjustment value by the brightness value corresponding to the current HSV value to obtain a quotient used as a brightness adjustment proportion;
multiplying the brightness value in the current HSV value by the brightness adjustment proportion to obtain a brightness value corresponding to the brightness adjustment value;
and taking the brightness value corresponding to the brightness adjustment value as a new brightness value in the target HSV value.
3. The method of adjusting an RGB LED of claim 1, further comprising, before converting the target HSV value to a target RGB value:
when the new brightness value in the target HSV value is not smaller than a preset maximum brightness value, taking the preset maximum brightness value as the new brightness value in the target HSV value;
and when the new brightness value in the target HSV value is not greater than a preset minimum brightness value, taking the preset minimum brightness value as the new brightness value in the target HSV value.
4. The method for RGB LED adjustment according to claim 1, further comprising, before determining the current RGB value corresponding to the color currently displayed by the RGB LED:
after the color currently displayed by the RGB LED is judged to be mixed color, the step of determining the current RGB value corresponding to the color currently displayed by the RGB LED is carried out;
after the color currently displayed by the RGB LED is judged to be a single color, the following steps are executed:
acquiring a current monochromatic RGB value corresponding to the currently displayed color of the RGB LED;
determining a target monochrome RGB value according to the brightness value corresponding to the current monochrome RGB value and the monochrome brightness adjustment value;
and obtaining a target single-color duty ratio of a PWM signal for controlling the RGB LED based on the target single-color RGB value, so that the PWM driving device outputs the PWM signal with the duty ratio of the target single-color duty ratio to the RGB LED.
5. The RGB LED adjusting method of claim 1, further comprising, when adjusting the color of the RGB LED:
acquiring a target display color of the RGB LED;
determining a target color RGB value corresponding to the target display color;
and respectively obtaining a red PWM signal duty ratio, a green PWM signal duty ratio and a blue PWM signal duty ratio according to a red RGB value, a green RGB value and a blue RGB value in the target color RGB value, so that the PWM driving device respectively outputs a red PWM signal with the duty ratio of the red PWM signal duty ratio, a green PWM signal with the duty ratio of the green PWM signal duty ratio and a blue PWM signal with the duty ratio of the blue PWM signal duty ratio to a red LED, a green LED and a blue LED in the RGB LEDs.
6. The method for adjusting an RGB LED as claimed in any one of claims 1 to 5, wherein obtaining a target duty cycle of PWM signals for controlling the RGB LED based on the target RGB value includes:
acquiring a red RGB value, a green RGB value and a blue RGB value in the target RGB value;
substituting the red RGB value, the green RGB value and the blue RGB value into a duty ratio calculation formula respectively to obtain the duty ratio of a red PWM signal, the duty ratio of a green PWM signal and the duty ratio of a blue PWM signal;
the duty ratio calculation formula is X = RGB/255 × 100% × K, where X is a duty ratio of the PWM signal, RGB is the red RGB value, the green RGB value, and the blue RGB value, and K is a preset calibration constant.
7. A regulation system for RGB LEDs, comprising:
the first conversion unit is used for determining a current RGB value corresponding to a color currently displayed by the RGB LED and converting the current RGB value into a current HSV value;
the second conversion unit is used for determining a new brightness value in the target HSV values according to the brightness value in the current HSV values and the target brightness adjustment value, and converting the target HSV values into target RGB values;
and the duty ratio calculation unit is used for obtaining a target duty ratio of PWM signals for controlling the RGB LED based on the target RGB value so as to output the PWM signals with the duty ratio of the target duty ratio to the RGB LED through a PWM driving device.
8. An adjusting device for RGB LED, comprising:
a memory for storing a computer program;
processor for implementing the steps of the RGB LED adjusting method according to any of claims 1 to 6 when executing the computer program.
9. A smart sound box comprising the RGB LED adjusting device of claim 8.
10. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which computer program, when being executed by a processor, carries out the steps of the RGB LED adjusting method according to one of the claims 1 to 6.
CN202210928499.7A 2022-08-03 2022-08-03 RGB LED adjusting method and related assembly Pending CN115175401A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210928499.7A CN115175401A (en) 2022-08-03 2022-08-03 RGB LED adjusting method and related assembly

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210928499.7A CN115175401A (en) 2022-08-03 2022-08-03 RGB LED adjusting method and related assembly

Publications (1)

Publication Number Publication Date
CN115175401A true CN115175401A (en) 2022-10-11

Family

ID=83477392

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210928499.7A Pending CN115175401A (en) 2022-08-03 2022-08-03 RGB LED adjusting method and related assembly

Country Status (1)

Country Link
CN (1) CN115175401A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116939906A (en) * 2023-07-26 2023-10-24 嘉兴市成泰镜业有限公司 Artificial intelligence-based LED mixed-color lamplight color calibration and adjustment method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116939906A (en) * 2023-07-26 2023-10-24 嘉兴市成泰镜业有限公司 Artificial intelligence-based LED mixed-color lamplight color calibration and adjustment method
CN116939906B (en) * 2023-07-26 2024-04-19 嘉兴市成泰镜业有限公司 Artificial intelligence-based LED mixed-color lamplight color calibration and adjustment method

Similar Documents

Publication Publication Date Title
JP5481021B2 (en) Heterogeneous color gamut mapping method and apparatus
KR101523854B1 (en) Adaptive color correction for display with backlight modulation
JP3719411B2 (en) Image display system, projector, program, information storage medium, and image processing method
US20190265552A1 (en) Display device
CN1901681B (en) Video display device
DE60302695T2 (en) Projection image display system, information storage medium and image processing method
KR100708111B1 (en) Saturation controlling device of a displaying system and the method thereof
CN102770905B (en) System and method for adjusting display based on detected environment
JP2003280629A (en) Image display system, image processing method, program, and information storage medium
JP2004538721A (en) Method for independently controlling hue or saturation of individual colors in real-time digital video images
JPWO2003001499A1 (en) Image display system, projector, image processing method, and information storage medium
JP2010079285A (en) Image display apparatus
CN115175401A (en) RGB LED adjusting method and related assembly
JP2020532147A (en) Touch board and its manufacturing method, touch device
US20100156956A1 (en) Grayscale characteristic for non-crt displays
CN1963903B (en) Method and apparatus for power control in a display device
KR100595648B1 (en) Display revision method for liquid crystal display of mobile communication terminal
CN115397059A (en) Control method for improving color-changing transition effect of RGB light-emitting diode
CN100405455C (en) Set and method for adjusting brightness and contrast
KR100487371B1 (en) variable color space converter in image signal processor system
JP4257033B2 (en) Color signal matrix adjustment
JPH08194452A (en) Monitor adjusting device
CN116684564A (en) Method for improving television color standard
JP3379620B2 (en) A method for gradually adjusting color components of digital video data
KR100510686B1 (en) apparatus and method for automatic setting of optimum input ranging in DTV signal

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination