The content of the invention
For overcome the deficiencies in the prior art, an object of the present invention is to provide a kind of light-dimming method of LED lamp,
It can LED lamp be continuous in dimming process, smoothly exports, and eliminates the flicker and shake of light.
The second object of the present invention is to provide a kind of light modulating device of LED lamp, its can realize the purpose of the present invention it
One.
An object of the present invention is realized using following technical scheme:
A kind of light-dimming method of LED lamp, comprises the following steps:
Step 1:The control signal from DMX consoles is received, the control signal has target brightness value;
Step 2:Present intensity difference is obtained according to the target brightness value and present intensity value, it is poor according to present intensity
Value is calculated present intensity and increases data;
Step 3:Data are increased according to present intensity and obtain new present intensity value with present intensity value, are judged current bright
Whether angle value is equal to target brightness value, if so, then stopping continuing to obtain new present intensity value, otherwise, according to new current bright
Angle value obtains present intensity difference with target brightness value, performs step 4 afterwards;
Step 4:New present intensity is obtained according to present intensity mathematic interpolation and increases data, afterwards return to step three.
Preferably, " obtain present intensity in step 2 according to present intensity mathematic interpolation and increase data " to include following step
Suddenly:
Step A:Judge whether present intensity difference is more than or equal to preset time, if so, then performing step B, otherwise, hold
Row step C;
Step B:First brightness is obtained according to preset time and present intensity difference and increases data and the second brightness increased numbers
According to, judge present intensity difference whether be less than or equal to the second brightness increase data, if so, then present intensity increase data=the
One brightness increases data+1, and otherwise present intensity increases the brightness of data=first and increases data;Afterwards, basis is worked as each time for definition
Preceding luminance difference be calculated present intensity increase data when a length of relatively time, compare the time=be 1;
Step C:3rd brightness is obtained according to preset time and present intensity difference and increases data and the 4th brightness increased numbers
According to present intensity difference is more than or equal to the 3rd brightness and increases data, and present intensity difference is more than the 4th brightness and increases data
When, then due to this comparison time=compare the time+1;Otherwise, this comparison time=preset time divided by present intensity are defined
Difference.
Preferably, in the step B, " according to preset time and present intensity difference obtain the first brightness increase data and
Second brightness increases data " specifically comprise the following steps:
Step B1:According to formula:Fade_data1=Dled/Tmax tries to achieve the first brightness and increases data, wherein, Dled is
Present intensity difference, Tmax are preset time;
Step B2:According to formula:Fade_data2=Dled%Tmax tries to achieve the 5th brightness and increases data, wherein, Fade_
Data2 is that the 5th brightness increases data;
Step B3:According to formula:Fade_data3=Tmax-Fade_data2 tries to achieve the 6th brightness and increases data, wherein,
Fade_data3 is that the 6th brightness increases data;
Step B4:According to formula:Fade_data4=Fade_data3*Fade_data1 tries to achieve the 7th brightness increased numbers
According to, wherein, Fade_data4 is that the 7th brightness increases data;
Step B5:Second brightness is tried to achieve according to formula F ade_data5=Dled-Fade_data4 and increases data, wherein,
Fade_data5 is that the second brightness increases data.
Preferably, in step C, " the 3rd brightness is obtained according to preset time and present intensity difference and increases data and the 4th
Brightness increases data " specifically comprise the following steps:
Step C1:According to formula:Fade_data6=Tmax/2 tries to achieve the 3rd brightness and increases data, wherein, Fade_
Data6 is that the 3rd brightness increases data;
Step C2:According to formula:Fade_data7=Dled*2 tries to achieve the 8th brightness and increases data, wherein, Fade_
Data7 is that the 8th brightness increases data;
Step C3:According to formula:Fade_data8=Fade_data7-Tmax tries to achieve the 4th brightness and increases data, wherein,
Fade_data8 is that the 4th brightness increases data.
Preferably, in addition to step 5:New present intensity value is incrementally divided into some groups of brightness values to carry out
Output.
The second object of the present invention is realized using following technical scheme:
A kind of light modulating device of LED lamp, including such as lower unit:
Receiving unit:For receiving the control signal from DMX consoles, the control signal has target brightness value;
First computing unit:For obtaining present intensity difference according to the target brightness value and present intensity value, according to
Present intensity mathematic interpolation obtains present intensity and increases data;
Cycling element:New present intensity value is obtained with present intensity value for increasing data according to present intensity, is judged
Whether present intensity value is equal to target brightness value, if so, then stopping continuing to obtain new present intensity value, otherwise, according to new
Present intensity value obtains present intensity difference with target brightness value, performs the second computing unit afterwards;
Second computing unit:Increase data for obtaining new present intensity according to present intensity mathematic interpolation, return afterwards
Return cycling element.
Preferably, the first computing unit includes judge module, the first computing module and the second computing module,
Judge module:For judging whether present intensity difference is more than or equal to preset time, if so, then performing the first meter
Module is calculated, otherwise, performs the second computing module;
First computing module:Increase data and second for obtaining the first brightness according to preset time and present intensity difference
Brightness increases data, judges whether present intensity difference is less than or equal to the second brightness and increases data, if so, then present intensity increases
The brightness of long data=first increases data+1, and otherwise present intensity increases the brightness of data=first and increases data;Afterwards, definition is every
Once according to present intensity mathematic interpolation obtain present intensity increase data when it is a length of relatively the time, compare the time=1;
Second computing module:Increase data and the 4th for obtaining the 3rd brightness according to preset time and present intensity difference
Brightness increases data, and when whether present intensity difference is more than or equal to the 3rd brightness growth data, and present intensity difference is more than
4th brightness increases data, if so, then due to this comparison time=compare the time+1;Otherwise, define this comparison time=
Preset time divided by present intensity difference.
Preferably, in the first computing module, " the first brightness is obtained according to preset time and present intensity difference and increases data
Increase data with the second brightness " specifically comprise the following steps:
Step B1:According to formula:Fade_data1=Dled/Tmax tries to achieve the first brightness and increases data, wherein, Dled is
Present intensity difference, Tmax are preset time;
Step B2:According to formula:Fade_data2=Dled%Tmax tries to achieve the 5th brightness and increases data, wherein, Fade_
Data2 is that the 5th brightness increases data;
Step B3:According to formula:Fade_data3=Tmax-Fade_data2 tries to achieve the 6th brightness and increases data, wherein,
Fade_data3 is that the 6th brightness increases data;
Step B4:According to formula:Fade_data4=Fade_data3*Fade_data1 tries to achieve the 7th brightness increased numbers
According to, wherein, Fade_data4 is that the 7th brightness increases data;
Step B5:Second brightness is tried to achieve according to formula F ade_data5=Dled-Fade_data4 and increases data, wherein,
Fade_data5 is that the second brightness increases data.
Preferably, in the second computing module, " the 3rd brightness is obtained according to preset time and present intensity difference and increases data
Increase data with the 4th brightness " specifically comprise the following steps:
Step C1:According to formula:Fade_data6=Tmax/2 tries to achieve the 3rd brightness and increases data, wherein, Fade_
Data6 is that the 3rd brightness increases data;
Step C2:According to formula:Fade_data7=Dled*2 tries to achieve the 8th brightness and increases data, wherein, Fade_
Data7 is that the 8th brightness increases data;
Step C3:According to formula:Fade_data8=Fade_data7-Tmax tries to achieve the 4th brightness and increases data, wherein,
Fade_data8 is that the 4th brightness increases data.
Preferably, in addition to differentiation unit:For new present intensity value to be incrementally divided into some groups of brightness
Value is exported.
Compared with prior art, the beneficial effects of the present invention are:
This invention ensures that LED lamp energy in 0-100% light modulation overall process is continuous, smooth transition, without the sudden strain of a muscle of light
Bright and shake, and it is linear with good light modulation, while avoid the bright dark fringe that camera picture occurs in video recording or shooting
Or shadow, meet the use of light in scene to greatest extent.
Embodiment
Below, with reference to accompanying drawing and embodiment, the present invention is described further:
A kind of light-dimming method of LED lamp of present invention offer, including step are as follows:
S1:The control signal from DMX consoles is received, the control signal has target brightness value;
There is CPU, the CPU is to be electrically connected with DMX consoles, and is received inside the LED lamp that the present invention is applied
The control of DMX consoles, the signal that DMX consoles occur are 0-255 passage DM values, are stored with CPU corresponding different
The brightness value of passage DM values, for example, the passage DM values of last control signal are 10, the passage DM of this control signal received
It is worth for 80, then CPU gets corresponding 10 and 80 brightness value, brightness value i.e. target brightness value corresponding to 80.
S2:Present intensity difference is obtained according to the target brightness value and present intensity value, according to present intensity difference meter
Calculation obtains present intensity and increases data;
In S2, for example, present intensity value be 150, target brightness value 220, then present intensity difference be target brightness value with
The absolute value of difference between present intensity value, that is, 70.Conventional way is exactly the brightness of direct output 220, of the invention
The intermediate portions to be done are exactly that this present intensity difference is carried out to break up multiple output, rather than disposable with regard to directly exporting target
Brightness value, by repeatedly steady output, ensure the flicker and shake of no light.Such as present intensity difference is 70, by this 70
Data be divided into it is multigroup be added in present intensity value, and present intensity value is constantly updated, until present intensity value is equal to target brightness value.
Interruption is provided with system, when system performs the computing, often perform a cycle time add 1.Timer it is initial when
Between be 0.
S3:Data are increased according to present intensity and obtain new present intensity value with present intensity value, judge present intensity value
Whether target brightness value is equal to, if so, then stopping continuing to obtain new present intensity value, otherwise, according to new present intensity value
Present intensity difference is obtained with target brightness value, performs S4 afterwards;
In S3 when present intensity value is equal to target brightness value, that is to say, that the current brightness value has reached demand, is
Finally need the brightness exported, it is not necessary to continue computing output on its basis again.When receiving new target brightness value
When, start to calculate again.In addition, if being in calculating process, when present intensity value and not up to target brightness value, connect again
The control signal of DMX consoles is received, and target brightness value is obtained by the control signal and changed, then is stopped originally
Calculate, rerun using new target brightness value as target.
S4:New present intensity is obtained according to present intensity mathematic interpolation and increases data, returns to S3 afterwards.
" obtain present intensity in S2 according to present intensity mathematic interpolation and increase data " to comprise the following steps:
Step A:Judge whether present intensity difference is more than or equal to preset time, if so, then performing step B, otherwise, hold
Row step C;
Step B:First brightness is obtained according to preset time and present intensity difference and increases data and the second brightness increased numbers
According to, judge present intensity difference whether be less than or equal to the second brightness increase data, if so, then present intensity increase data=the
One brightness increases data+1, and otherwise present intensity increases the brightness of data=first and increases data;Afterwards, basis is worked as each time for definition
Preceding luminance difference be calculated present intensity increase data when it is a length of relatively the time, comparison time=1;Computing is arrived each time
Here, it can all be assigned to and compare the time for 1.
Step C:3rd brightness is obtained according to preset time and present intensity difference and increases data and the 4th brightness increased numbers
According to judging whether to meet condition:Present intensity difference is more than or equal to the 3rd brightness and increases data, and present intensity difference is more than
4th brightness increases data, if so, then defining this comparison time=compare the time+1;Otherwise, define this comparison time=
Preset time divided by present intensity difference.
In the step B, " the first brightness is obtained according to preset time and present intensity difference and increases data and the second brightness
Increase data " specifically comprise the following steps:
Step B1:According to formula:Fade_data1=Dled/Tmax tries to achieve the first brightness and increases data, wherein, Dled is
Present intensity difference, Tmax are preset time;Tmax refers to that the regulation unit interval reaches object brightness from from present intensity value
The transformation period of value, Tmax=Ttime*N in the present invention, N is the data of the constant that could dictate that and change, and Ttime determines for system
When device break period.In this step, tried to achieve except value is that the first brightness increases data.
Step B2:According to formula:Fade_data2=Dled%Tmax tries to achieve the 5th brightness and increases data, wherein, Fade_
Data2 is that the 5th brightness increases data;This step is complementation.
Step B3:According to formula:Fade_data3=Tmax-Fade_data2 tries to achieve the 6th brightness and increases data, wherein,
Fade_data3 is that the 6th brightness increases data;
Step B4:According to formula:Fade_data4=Fade_data3*Fade_data1 tries to achieve the 7th brightness increased numbers
According to, wherein, Fade_data4 is that the 7th brightness increases data;
Step B5:Second brightness is tried to achieve according to formula F ade_data5=Dled-Fade_data4 and increases data, wherein,
Fade_data5 is that the second brightness increases data.
In step C, " the 3rd brightness is obtained according to preset time and present intensity difference and increases data and the 4th brightness growth
Data " specifically comprise the following steps:
Step C1:According to formula:Fade_data6=Tmax/2 tries to achieve the 3rd brightness and increases data, wherein, Fade_
Data6 is that the 3rd brightness increases data;
Step C2:According to formula:Fade_data7=Dled*2 tries to achieve the 8th brightness and increases data, wherein, Fade_
Data7 is that the 8th brightness increases data;
Step C3:According to formula:Fade_data8=Fade_data7-Tmax tries to achieve the 4th brightness and increases data, wherein,
Fade_data8 is that the 4th brightness increases data.
Such as:Preset time is 50, i.e. Tmax=50, that is to say, that 50 cycles are performed, present intensity value is 200,
Target brightness value is 347;Then present intensity difference is 147, then by above-mentioned steps, the first brightness can be calculated and increase data
For 147/50=2, it be 147%50=47 that the 5th brightness, which increases data, and the 6th brightness growth data are 50-47=3, the 7th brightness
Growth data are 3*2=6, and it is 147-6=141 that the second brightness, which increases data, now contrast present intensity difference and the second brightness
Whether it is less than or equal to the second brightness and increases data, it can be seen that 147 are more than 141, thus in this execution cycle, it is current bright
Degree increases the brightness of data=first and increases data, that is, equal to 2, then present intensity value=200+2=202, the present intensity
Value 202 replaces original present intensity value 200, next execution cycle, is then calculated using 202 as present intensity value.
It should be understood that the first brightness increases data in the present invention, the second brightness increases data, the 5th brightness increases data,
6th brightness, which increases data and the value of the 7th brightness growth data, just to be calculated in a cycle, ensuing 49
What is changed in the individual cycle is present intensity difference, then it is appreciated that present intensity increase data also can there may be change.
By calculating it can be found that three cycles in 50 cycles before, present intensity growth data are all equal to the
One brightness increases data, and in 47 cycles below, present intensity increases data and is all equal to the first brightness growth data+1,
Namely 3.And for the concept of the comparison time in the present invention, illustrated by following case:
If preset time is 50, present intensity difference is 40, and it is 1 to compare the time, and a comparison time is equal to a week
Phase, then it is 50/2=25 to calculate the 3rd brightness to increase data, and now present intensity difference 40 is more than the 3rd brightness growth data 25,
8th brightness increases data=40*2=80, and the 4th brightness increases data=80-50=30, and now present intensity difference 40 is more than
4th brightness increases data 30, so this comparison time in this circulation is 1+1=2.After ten circulations
20 comparison times are walked, now above 20 cycles have walked 10 brightness values;And when present intensity difference is less than 30, this
Secondary relatively time=1, then 30 cycles have walked 30 brightness values below, and brightness value sums to 40, just 50 it is default
40 numbers have been walked in time.
If preset time or 50, but present intensity difference is 20, then it is 25 that the 3rd brightness, which increases data, current bright
Spend difference and be less than the 3rd brightness and increase data, then it is preset time divided by present intensity difference to compare the time, that is, 50/20=
2, this link due to brightness be change it is very small, so have it is detailed be made in completed in the Tmax times 20 place
Reason.
In addition, when the present invention in try to achieve new present intensity value after, for ensure high frequency output, by new present intensity value with
The mode of average incremental is assigned in Dcur-r [j] array, is divided into some groups of brightness values and is exported.Namely to present intensity
Value carries out differentiation output.
Example:Dcur is divided into 60 groups of outputs
For example, Dcur=150, led_lsb_1=150/60=2, led_msb_1=150%60=30;
First for circulation show that 60 numbers are all 2 in Dcur-r [j] array, and second for circulation is calculated again
Preceding 30 numbers in Dcur-r [j] array all carry out plus 1 processing, then preceding 30 numbers in Dcur-r [j] array are all 3.Two
The result of individual circulation is that preceding 30 numbers are equal to 3, and rear 30 numbers are equal to 2, that is to say, that 150 points are exported for 60 groups, it is preceding
The each group of incremental difference in 30 groups of face is 3, behind 30 groups of incremental differences be 2.The like, if Dcur=151, two
The result of individual circulation is that preceding 31 numbers are equal to 3, and rear 29 numbers are equal to 2.LED dimming resolutions had both been improved in this way,
Also provide the even transition when flatness, followability and the mashed up light modulation of color of LED light modulations.The low frequency way of output originally,
Light modulation square wave schematic diagram as shown in Fig. 2 the present invention data distribution that original low frequency exports is exported into several small square waves,
To reach the effect of high frequency light modulation, as shown in Figure 3.T in Fig. 2 represents a total cycle of output present intensity value, will in Fig. 3
Fig. 2 square wave is subdivided into the small square waves outputs of n, and T1 then represents that present intensity value is subdivided into n groups exports for the T of n/mono-, T1,
Cycle corresponding to each group of output.
On the other hand, the present invention provides a kind of light modulating device of LED lamp, including such as lower unit,
Receiving unit:For receiving the control signal from DMX consoles, the control signal has target brightness value;
First computing unit:For obtaining present intensity difference according to the target brightness value and present intensity value, according to
Present intensity mathematic interpolation obtains present intensity and increases data;
Cycling element:New present intensity value is obtained with present intensity value for increasing data according to present intensity, is judged
Whether present intensity value is equal to target brightness value, if so, then stopping continuing to obtain new present intensity value, otherwise, according to new
Present intensity value obtains present intensity difference with target brightness value, performs the second computing unit afterwards;
Second computing unit:Increase data for obtaining new present intensity according to present intensity mathematic interpolation, return afterwards
Return cycling element;
Break up unit:Exported for new present intensity value to be incrementally divided into some groups of brightness values.
In the first computing unit, it includes judge module, the first computing module and the second computing module, these three moulds
The step for block is used to perform in the first computing unit " obtain present intensity according to present intensity mathematic interpolation and increase data ", tool
Body is as follows:
Judge module:For judging whether present intensity difference is more than or equal to preset time, if so, then performing the first meter
Module is calculated, otherwise, performs the second computing module;
First computing module:Increase data and second for obtaining the first brightness according to preset time and present intensity difference
Brightness increases data, judges whether present intensity difference is less than or equal to the second brightness and increases data, if so, then present intensity increases
The brightness of long data=first increases data+1, and otherwise present intensity increases the brightness of data=first and increases data;Afterwards, definition is every
Present intensity is once obtained according to present intensity mathematic interpolation and increases data to compare the time, compares the time=1;
Second computing module:Increase data and the 4th for obtaining the 3rd brightness according to preset time and present intensity difference
Brightness increases data, judges whether to meet condition:Present intensity difference is more than or equal to the 3rd brightness and increases data, and current bright
Spend difference and be more than the 4th brightness and increase data, if so, then defining this comparison time=compare the time+1;Otherwise, this is defined
Compare the time=preset time divided by present intensity difference.
In first computing module, " the first brightness is obtained according to preset time and present intensity difference and increases data and second
Brightness increases data " specifically comprise the following steps:
Step B1:According to formula:Fade_data1=Dled/Tmax tries to achieve the first brightness and increases data, wherein, Dled is
Present intensity difference, Tmax are preset time;
Step B2:According to formula:Fade_data2=Dled%Tmax tries to achieve the 5th brightness and increases data, wherein, Fade_
Data2 is that the 5th brightness increases data;
Step B3:According to formula:Fade_data3=Tmax-Fade_data2 tries to achieve the 6th brightness and increases data, wherein,
Fade_data3 is that the 6th brightness increases data;
Step B4:According to formula:Fade_data4=Fade_data3*Fade_data1 tries to achieve the 7th brightness increased numbers
According to, wherein, Fade_data4 is that the 7th brightness increases data;
Step B5:Second brightness is tried to achieve according to formula F ade_data5=Dled-Fade_data4 and increases data, wherein,
Fade_data5 is that the second brightness increases data.
In second computing module, " the 3rd brightness is obtained according to preset time and present intensity difference and increases data and the 4th
Brightness increases data " specifically comprise the following steps:
Step C1:According to formula:Fade_data6=Tmax/2 tries to achieve the 3rd brightness and increases data, wherein, Fade_
Data6 is that the 3rd brightness increases data;
Step C2:According to formula:Fade_data7=Dled*2 tries to achieve the 8th brightness and increases data, wherein, Fade_
Data7 is that the 8th brightness increases data;
Step C3:According to formula:Fade_data8=Fade_data7-Tmax tries to achieve the 4th brightness and increases data, wherein,
Fade_data8 is that the 4th brightness increases data.
It will be apparent to those skilled in the art that technical scheme that can be as described above and design, make other various
Corresponding change and deformation, and all these changes and deformation should all belong to the protection domain of the claims in the present invention
Within.