Dimming method based on PWM dimming technology and intelligent lamp
Through the PWM dimming technology method, the problems of dimming are solved, and the smooth gradient and strobe reduction of brightness changes are achieved, which improves the perception experience of the human eye.
Patent Information
- Application Number
- CN202310747963.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-21
- Publication Date
- 2024-12-24
AI Technical Summary
The dimming equipment is not smooth enough when the brightness or color temperature changes, causing the human eye to perceive the stairs and the dimming depth to be insufficient, resulting in sudden visual experience when the light is turned off, and the strobe problem is serious when the light is low.
Using the PWM dimming technology method, by receiving the target brightness and dimming time, calculating the number of tasks and brightness level differences, performing the minimum resolution gradient algorithm, adjusting the number of pulses and task numbers, achieving smooth gradient of brightness changes, and adjusting Fine division of the light curve that keeps the frequency unchanged to improve the brightness level.
The smooth changes in the dimming process are achieved, the sudden outage feeling is avoided when the light is turned off, and the risk of strobes is reduced at low brightness, improving the perception of brightness changes by the human eye.
Smart Images

Figure CN119183231A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a dimming method and a smart lamp based on PWM dimming technology, and belongs to the field of Internet of Things home lighting. Background Art
[0002] With the development of lighting technology, digital dimming technology has developed rapidly in recent years compared with traditional analog dimming technology. In order to improve the lighting experience, there are still many shortcomings in the lighting equipment on the market.
[0003] 1. As shown in Figure 1(a), the dimming is not smooth enough. When the brightness or color temperature changes, it is not a smooth gradual process. The brightness or color temperature changes seen by the human eye are stepped, which greatly reduces the user experience. As shown in Figure 1(b), the smaller the difference between each brightness level, the smoother the dimming.
[0004] 2. The dimming depth is not deep enough. Most products only support 1% or 3%-100% dimming. When turning off the light, it will be turned off directly from 1% or 3%, which will produce a sudden visual experience.
[0005] 3. Flicker problem: There are certain technical bottlenecks in achieving a dimming depth of 0.1%, which requires a lower frequency. However, the lower the frequency, the more serious the flicker will be. Many adjustable lamps can reach the exemption level of flicker at normal brightness, but they will be at a low-risk flicker level at low brightness or during dimming.
[0006] Through understanding the above technologies, it can be seen that most of the current dimmable devices have problems such as insufficient dimming depth, resulting in sudden light outage when turning off the lights, insufficient dimming, failure to satisfy the human eye's perception of brightness changes, and dimming frequency not reaching the high-frequency exemption level at low brightness. Summary of the invention
[0007] The purpose of the present invention is to provide a dimming method and a smart lamp based on PWM dimming technology, so as to solve the problems of sudden light off when turning off the light, uneven dimming, and step-by-step light changes when dimming at low brightness.
[0008] To achieve the above object, the solution of the present invention includes:
[0009] A dimming method based on PWM dimming technology comprises the following steps:
[0010] 1) Receive the dimming target brightness and the dimming time for dimming; calculate the number of dimming tasks that need to be performed according to the dimming time and the algorithm cycle;
[0011] 2) Calculate the brightness level difference based on the target brightness and the current brightness, and compare the brightness level difference with the number of task executions;
[0012] 3) If the brightness level difference is less than the number of tasks, calculate the number of unit tasks required to change one brightness level, and then calculate the pulse difference between the current brightness level and the adjacent brightness level in the dimming direction; each time the number of unit tasks is executed, change one brightness level and dim according to the pulse difference;
[0013] If the brightness level difference is greater than or equal to the number of tasks, calculate the number of brightness levels that need to be changed to execute each task; the current brightness level is changed according to the brightness level to obtain the next brightness level, and dimming is performed according to the number of pulses of the next brightness level.
[0014] The present invention obtains the dimming brightness level and dimming time, calculates the number of dimming tasks through the dimming time, compares the dimming brightness level difference with the number of tasks, and preliminarily divides the dimming algorithm to meet the number of tasks that need to be run under different brightness level differences, thereby obtaining different dimming algorithms.
[0015] Furthermore, it is determined whether the pulse difference is 1. When the pulse value is 1, the minimum resolution gradient algorithm is executed to obtain the number of pulses required to be output for executing each task in the unit task.
[0016] Furthermore, the minimum resolution gradient algorithm is: taking n tasks as a group, in the first group only a set number of tasks add 1 to the pulse value, and the next group adds 1 to the pulse value by more or less than the previous group, until the dimming is completed by outputting the brightness according to the pulse value plus 1.
[0017] Furthermore, n is obtained by n×(n-1)=m, where m is the number of tasks.
[0018] The above minimum resolution gradient algorithm sets different numbers of pulses in the current task group and finally adds 1 to the number of pulses, making it difficult for the human eye to perceive brightness changes.
[0019] Furthermore, it is necessary to determine whether the pulse difference is 0. When the pulse difference is 0, the number of pulses does not change when the unit number of tasks is executed.
[0020] Furthermore, the pulse difference is compared with the number of unit tasks; if the number of unit tasks is greater than the pulse difference, the number of unit tasks is divided by the pulse difference to obtain the number of pulse tasks that need to be executed for each change in the number of pulses, and each time a task in the number of pulse tasks is executed, one pulse is changed for dimming; if the number of unit tasks is less than the pulse difference, the pulse difference is divided by the number of unit tasks to calculate the number of pulses that need to be changed for each task in the unit task number, and each time a task in the unit task is executed, multiple pulses are changed for dimming.
[0021] By further dividing the number of pulses within a unit task, each task in the unit task is executed with a corresponding number of pulses, thereby achieving a smaller brightness change.
[0022] Furthermore, when the dimming time is equal to 0, the number of pulses corresponding to the target brightness level is searched, so that dimming is performed according to the number of pulses.
[0023] Furthermore, the number of pulses corresponding to the target brightness level is found from the dimming curve, and the dimming curve is a curve in which the brightness level increases exponentially with the increase of the number of pulses.
[0024] Furthermore, the dimming curve includes pulse values that increase along the vertical axis starting from the origin, and brightness levels that increase along the horizontal axis.
[0025] In the dimming curve, the brightness level division is more refined and the output power is smoother by keeping the set frequency unchanged.
[0026] An intelligent lamp of the present invention comprises a processor, wherein the processor comprises a dimming method based on PWM dimming technology, wherein at least one processing mode in the dimming method based on PWM dimming technology is processed by the processor to achieve smooth dimming change. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] FIG. 1( a ) is a dimming brightness diagram of the prior art;
[0028] FIG1( b ) is another dimming brightness diagram of the prior art;
[0029] Figure 2 It is a schematic diagram of a product software solution of the prior art;
[0030] Figure 3 is a dimming curve diagram of the present invention;
[0031] Figure 4 is a schematic diagram of a dimming algorithm of the present invention;
[0032] Figure 5 A schematic diagram showing a gradual increase in the number of pulses of the dimming algorithm of the present invention;
[0033] Figure 6 A schematic diagram of the gradual decrease in the number of pulses of the dimming algorithm of the present invention;
[0034] Figure 7 It is a schematic diagram of the LSBGCA process of the present invention. DETAILED DESCRIPTION
[0035] The present invention will be further described in detail below in conjunction with the accompanying drawings:
[0036] First, some explanations of the abbreviations that may appear:
[0037]
[0038] A dimming method embodiment based on PWM dimming technology:
[0039] like Figure 2 As shown, before the device dims, it is necessary to determine whether the device is online. If not, the dimming algorithm module is called according to the set initial conditions such as the device factory information, brightness, color temperature, gradient time, etc., and then the waveform of the corresponding duty cycle is output through the PWM output module; if the device is online, the protocol transceiver module completes the data interaction with the host through the received and sent data, and parses the received data control command and passes it to the NVM module or the dimming algorithm module. The NVM module saves the device information and lighting information. When the APP layer calls to read the data, it passes the data to the dimming algorithm module; the dimming algorithm module calls the algorithm module for dimming through the timer callback function; the PWM module passes the dimming value calculated by the dimming algorithm to the PWM module through the timer callback function to generate a PWM waveform.
[0040] This embodiment provides a dimming method based on PWM dimming technology based on the above-mentioned product software solution. Figure 4 As shown, the following steps are included:
[0041] When dimming the device, you need to set the target brightness and required time. The background starts dimming according to the received target brightness, current brightness and total brightness change time. There are three situations:
[0042] The first type: the target brightness is equal to the current brightness;
[0043] The second type: the target brightness is not equal to the current brightness, and the total time from the starting brightness to the target brightness is equal to 0;
[0044] The third type: the target brightness is not equal to the current brightness, and the total time from the starting brightness to the target brightness is not equal to 0.
[0045] When the device is dimmed according to the first case, the output power remains unchanged.
[0046] When the device is dimming according to the second case, the number of pulses of the target brightness level is queried in the array LightDuty
[251] of the dimming curve, and the number of pulses is passed to the PWM module, which outputs a waveform corresponding to the duty cycle, and ends the dimming.
[0047] The dimming curve referred to in this embodiment means that when the dimming PWM clock is 16MHz and the frequency is 16KHz, one PWM cycle requires 1000 system clocks. Because the PWM pulse is not greater than the PWM cycle, the PWM pulse range is 1 to 1000. The PWM outputs one pulse, that is, a 0.1% duty cycle waveform, which is equivalent to 0.1% power output of the device; the PWM outputs 100% duty cycle, that is, 1000 pulses, which is equivalent to 100% power output of the device.
[0048] By setting the number of pulses corresponding to each brightness level, each brightness level has a fixed output duty cycle, thus forming a dimming curve with 251 brightness levels. The number of pulses corresponding to the brightness level is defined in the array LightDuty
[251] .
[0049] like Figure 3 As shown, the dimming curve used in this embodiment uses the brightness level as the horizontal coordinate and the pulse number as the vertical coordinate, and starts to grow from the origin of the coordinates. This curve is not a parabola or a straight line, but an exponential growth curve that is slow at first and then fast.
[0050] When the device is dimming according to the third case, if the starting brightness level is not equal to the target brightness level, and the brightness change time is not equal to 0, the following PWM pulse number gradual change processing flow is executed:
[0051] like Figure 5 and Figure 6 As shown, the PWM pulse number gradual change process begins, and the number of tasks required to be performed from the start to the target brightness is calculated. The number of tasks NUM task =T fade ÷Talg, calculate the difference Diff between the current brightness and the adjacent brightness level in the dimming direction level =|Dst level -Src level |, determine the number of tasks and the size of the brightness level difference;
[0052] Such as: the total time T from the starting brightness to the target brightness fade =4s, then NUM task =4×1000ms÷1=4000;
[0053] If the brightness level difference is greater than or equal to the total number of tasks, then the total number of tasks will change multiple brightness levels each time they are executed. The brightness level change is equal to the brightness level difference divided by the number of tasks, that is, Step level =Diff level ÷NUM task Each time the dimming task is executed, the brightness level of the next task output is Next level Equal to the current brightness level Cur levelAdd or subtract the brightness level Step that will change each time it is executed level ,Right now:
[0054] Cur level =Cur level ±Step level ,
[0055] Target pulse of PWM output: PWM current =LightDuty[Cur level ]; Diff level ÷NUM task If it cannot be divided evenly, the calculated remainder will be added in the last algorithm task cycle.
[0056] Such as: Dst level =22, Src level =1,T fade =10ms; calculate NUM task =10, Diff level =21, Step level =2; then the algorithm task is executed 10 times, and the PWM output each time current , in order: LightDuty[3], LightDuty[5], LightDuty[7], LightDuty[9], LightDuty
[11] , LightDuty
[13] , LightDuty
[15] , LightDuty
[17] , LightDuty
[19] , LightDuty
[22] .
[0057] If the brightness level difference is less than the number of tasks, then multiple tasks need to be run to change a brightness level. Therefore, the algorithm needs to consider how to change a brightness level by running multiple tasks. The difference Diff between the current brightness level and the next brightness level pulse is calculated. pluse , and the number of unit tasks required to change each brightness level (N task =NUM task ÷Diff level ), judge according to the pulse difference;
[0058] The calculation formulas for the pulse difference in the following two cases are as follows:
[0059] If the current brightness level is lower than the next brightness level, the pulse difference
[0060] Diff pluse =LightDuty[Cur level +1]-LightDuty[Cur level ]
[0061] If the current brightness level is higher than the next brightness level, the pulse difference
[0062] Diff pluse =LightDuty[Cur level ]-LihgtDuty[Cur level -1]
[0063] If the pulse number difference Diff pluse If it is equal to 0, after running the unit task number, the next brightness level is equal to the current brightness level plus one, and the number of pulses corresponding to the current brightness level is equal to the number of pulses corresponding to the next brightness level, then the PWM module at the next brightness level accepts the target pulse number PWM current =LightDuty[Cur level ].
[0064] If the pulse number difference Diff pluse When it is equal to 1, the PWM power difference of adjacent brightness levels is the minimum adjustment value 1, and the minimum frequency dimming algorithm (LSBGCA) is executed, that is, a pulse is changed through multiple tasks between adjacent brightness levels, and the PWM control module accepts the target pulse PWM current .
[0065] The LSBGCA minimum resolution gradient algorithm in this embodiment is as follows: Figure 7 As shown, it is intended to solve the problem that the light changes are not smooth enough when the pulse number changes to the minimum resolution (the difference between adjacent brightness level pulses is 1).
[0066] n is calculated by the formula n×(n-1)=PerPulsetask, (PerPulsetask>1, PerPulsetask is the number of periodic tasks), and n tasks are grouped together. The first group has only one task with a pulse value of plus or minus 1, and the next group has one more task with a pulse value of plus or minus 1 than the previous group, until the output brightness is output according to the pulse value plus or minus 1 to complete the dimming. If n is not an integer, it is rounded off to an integer n1, and the last group has fewer tasks (obtained by n1×(n1-1)PerPulsetask).
[0067] For example: when the brightness level of the current device increases, the number of periodic tasks PerPulsetask = 12, and the current number of pulses PWM cureent =100, and through the formula n×(n-1)=PerPulsetask, n=4; then within the 12 algorithm task cycles, the number of output pulses each time is 100, 100, 100, 101, 100, 100, 101, 101, 100, 101, 101, 101.
[0068] Observing the above data, it can be considered that every 4 data are a group, and the "101" in each group increases successively, and the "100" decreases successively. After 12 task cycles, the number of PWM pulses is 101. In this way, the PWM current From 100 to 101, this algorithm allows the output power to gradually change from the current power to the target power.
[0069] If the pulse number difference Diff pluse When it is greater than 1, multiple task numbers correspond to multiple pulses. How to slowly transition to the next brightness level through multiple pulse numbers and multiple task numbers is something that this algorithm needs to reconsider. Therefore, it is necessary to compare the number of pulses with the number of tasks required to change a brightness level to perform the following corresponding algorithm:
[0070] If the pulse difference Diff pluse Less than the number of unit tasks N task , then the number of pulse tasks to be executed is PerPluse when the number of pulses changes by 1 task =N task ÷Diff pluse ;
[0071] If the pulse difference Diff pluse Greater than or equal to the number of unit tasks N task , calculate the number of pulses that need to be changed for each pulse task Step pluse ,The number of pulses that need to be changed for each pulse task Step pluse =Diff pluse ÷N task .
[0072] If the current brightness level is higher than the next brightness level, the number of pulses output by the next pulse task is:
[0073] PWM current =LightDuty[Cur level ]+Step pluse ;
[0074] On the contrary, the pulse number PWM current =LightDuty[Cur level ]-Step pluse .
[0075] For example: Unit pulse number N task =100, current brightness level Cur level =20, next brightness levelNext level =21,LightDuty[Cur level]=100,LightDuty[Next level ]=200,
[0076] Calculate Diff pluse =LightDuty[Next level ]-LightDuty[Cur level ]=200-100=100,Diff pluse Equal to N task , Step pluse =Diff pluse ÷N task =100÷100=1, then the PWM output of the next algorithm task current =LightDuty[Cur level ]+Step pluse =100+1=101, and so on.
[0077] The dimming value obtained by the dimming algorithm is passed to the PWM module to generate a PWM waveform.
[0078] An embodiment of a smart lamp:
[0079] The present invention provides a smart lamp, including a processor, the processor includes a dimming method based on PWM dimming technology, in which at least one processing method is processed by the processor, and the dimming value obtained by the processor is transmitted to the PWM module, and the PWM module outputs a corresponding duty cycle to generate a PWM waveform to achieve a corresponding brightness. The dimming method based on PWM dimming technology has been described in detail in an embodiment of a dimming method based on PWM dimming technology, and will not be repeated here.
Claims
1. A dimming method based on PWM dimming technology, characterized in that: The steps include: 1) Receive the dimming target brightness and the dimming time for dimming; calculate the number of dimming tasks required to be performed according to the dimming time and the algorithm cycle; 2) Calculate the brightness level difference based on the target brightness and the current brightness, and compare the brightness level difference with the number of task executions; 3) If the brightness level difference is less than the number of tasks, calculate the number of unit tasks required to change one brightness level, and then calculate the pulse difference between the current brightness level and the adjacent brightness level in the dimming direction; whenever the number of unit tasks is executed, Changing a brightness level and dimming according to the pulse difference; If the brightness level difference is greater than or equal to the number of tasks, the number of brightness levels that need to be changed to execute each task is calculated; the current brightness level is changed according to the brightness level to obtain the next brightness level, and dimming is performed according to the number of pulses of the next brightness level.
2. The dimming method based on PWM dimming technology according to claim 1, characterized in that: In the step 3), it is also determined whether the pulse difference is 1. When the pulse value is 1, the minimum resolution gradient algorithm is executed to obtain the number of pulses required to be output for each task in the unit task.
3. The dimming method based on PWM dimming technology according to claim 2, characterized in that: The minimum resolution gradient algorithm is as follows: n tasks are grouped together, in the first group only a set number of tasks add 1 to the pulse value, and the next group has more or less than the previous group a set number of tasks adding 1 to the pulse value until dimming is completed by outputting brightness according to the pulse value plus 1.
4. The dimming method based on PWM dimming technology according to claim 3, characterized in that: The n is obtained by n(n-1)=m, wherein m is the number of tasks performed by changing the number of pulses.
5. The dimming method based on PWM dimming technology according to claim 1 or 2, characterized in that: In the step 3), it is also necessary to determine whether the pulse difference is 0. When the pulse difference is 0, the number of pulses will not be changed when the unit task number is executed.
6. The dimming method based on PWM dimming technology according to claim 5, characterized in that: In the step 3); The pulse difference is also compared with the unit task number; If the number of unit tasks is greater than the pulse difference, the number of unit tasks is divided by the pulse difference to obtain the number of pulse tasks that need to be executed when the number of pulses changes by 1. When the number of pulse tasks is executed, one pulse is changed for dimming; If the number of unit tasks is less than the pulse difference, the pulse difference is divided by the number of unit tasks, and the number of pulses that need to be changed for each task in the unit task number is calculated. Each time a task in the unit task is executed, multiple pulses are changed for dimming.
7. The dimming method based on PWM dimming technology according to claim 1, characterized in that: In the step 1); when the dimming time is equal to 0, the number of pulses corresponding to the target brightness level is searched, and dimming is performed according to the number of pulses.
8. The dimming method based on PWM dimming technology according to claim 7, characterized in that: The number of pulses corresponding to the target brightness level is found from the dimming curve, where the dimming curve is a curve in which the brightness level increases exponentially with the increase of the number of pulses.
9. The dimming method based on PWM dimming technology according to claim 8, characterized in that: The dimming curve includes pulse values increasing along the vertical axis starting from the origin, and brightness levels increasing along the horizontal axis.
10. A smart lamp, characterized in that: It includes a processor, and the processor is used to execute the dimming method based on the PWM dimming technology as described in any one of claims 1-9.
