CN113543410B - Intelligent driving method and device for multicolor LED lamp and electronic equipment - Google Patents
Intelligent driving method and device for multicolor LED lamp and electronic equipment Download PDFInfo
- Publication number
- CN113543410B CN113543410B CN202110877197.7A CN202110877197A CN113543410B CN 113543410 B CN113543410 B CN 113543410B CN 202110877197 A CN202110877197 A CN 202110877197A CN 113543410 B CN113543410 B CN 113543410B
- Authority
- CN
- China
- Prior art keywords
- color
- led lamp
- led
- multicolor
- multicolor 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 69
- 239000003086 colorant Substances 0.000 claims description 27
- 230000008569 process Effects 0.000 claims description 13
- 230000001960 triggered effect Effects 0.000 claims description 9
- 238000004590 computer program Methods 0.000 claims description 7
- 230000000694 effects Effects 0.000 abstract description 40
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 description 20
- 239000011324 bead Substances 0.000 description 13
- 230000006870 function Effects 0.000 description 12
- 238000010586 diagram Methods 0.000 description 7
- 238000004891 communication Methods 0.000 description 6
- 238000004364 calculation method Methods 0.000 description 5
- 230000008859 change Effects 0.000 description 4
- 238000012545 processing Methods 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 230000001795 light effect Effects 0.000 description 3
- 238000001514 detection method Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000000007 visual effect Effects 0.000 description 2
- PLXMOAALOJOTIY-FPTXNFDTSA-N Aesculin Natural products OC[C@@H]1[C@@H](O)[C@H](O)[C@@H](O)[C@H](O)[C@H]1Oc2cc3C=CC(=O)Oc3cc2O PLXMOAALOJOTIY-FPTXNFDTSA-N 0.000 description 1
- 206010019233 Headaches Diseases 0.000 description 1
- 238000007792 addition Methods 0.000 description 1
- 208000003464 asthenopia Diseases 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000005611 electricity Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 231100000869 headache Toxicity 0.000 description 1
- 238000005286 illumination Methods 0.000 description 1
- 238000010191 image analysis Methods 0.000 description 1
- 230000007774 longterm Effects 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 238000005259 measurement Methods 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 201000003040 photosensitive epilepsy Diseases 0.000 description 1
- 238000007639 printing Methods 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 201000005070 reflex epilepsy Diseases 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H05—ELECTRIC TECHNIQUES NOT OTHERWISE PROVIDED FOR
- H05B—ELECTRIC HEATING; ELECTRIC LIGHT SOURCES NOT OTHERWISE PROVIDED FOR; CIRCUIT ARRANGEMENTS FOR ELECTRIC LIGHT SOURCES, IN GENERAL
- H05B45/00—Circuit arrangements for operating light-emitting diodes [LED]
- H05B45/30—Driver circuits
- H05B45/32—Pulse-control circuits
- H05B45/325—Pulse-width modulation [PWM]
-
- H—ELECTRICITY
- H05—ELECTRIC TECHNIQUES NOT OTHERWISE PROVIDED FOR
- H05B—ELECTRIC HEATING; ELECTRIC LIGHT SOURCES NOT OTHERWISE PROVIDED FOR; CIRCUIT ARRANGEMENTS FOR ELECTRIC LIGHT SOURCES, IN GENERAL
- H05B45/00—Circuit arrangements for operating light-emitting diodes [LED]
- H05B45/20—Controlling the colour of the light
-
- H—ELECTRICITY
- H05—ELECTRIC TECHNIQUES NOT OTHERWISE PROVIDED FOR
- H05B—ELECTRIC HEATING; ELECTRIC LIGHT SOURCES NOT OTHERWISE PROVIDED FOR; CIRCUIT ARRANGEMENTS FOR ELECTRIC LIGHT SOURCES, IN GENERAL
- H05B47/00—Circuit arrangements for operating light sources in general, i.e. where the type of light source is not relevant
- H05B47/10—Controlling the light source
- H05B47/16—Controlling the light source by timing means
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02B—CLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO BUILDINGS, e.g. HOUSING, HOUSE APPLIANCES OR RELATED END-USER APPLICATIONS
- Y02B20/00—Energy efficient lighting technologies, e.g. halogen lamps or gas discharge lamps
- Y02B20/40—Control techniques providing energy savings, e.g. smart controller or presence detection
Landscapes
- Circuit Arrangement For Electric Light Sources In General (AREA)
- Led Devices (AREA)
Abstract
The invention discloses an intelligent driving method and device for a multicolor LED lamp and electronic equipment, and relates to the technical field of embedded driving. According to the method, the overflow time of the single chip microcomputer is set according to the number of the multicolor LED lamps, and the PWM pulse signals are controlled to drive the multicolor LED lamps to emit light in turn according to a preset sequence. The multicolor LED lamp driving method does not need to enter interrupt timing, judges time through judging the overflow of the timer, reduces unnecessary PWM pulse signals to execute judging operation as much as possible, realizes that the multicolor LED lamp is driven to generate a color flowing effect by adopting the low-cost singlechip to output the PWM pulse signals with higher frequency, and ensures that the frequency of the PWM pulse signals is high enough to reduce stroboscopic.
Description
Technical Field
The invention relates to the technical field of embedded driving, in particular to an intelligent driving method and device for a multicolor LED lamp and electronic equipment.
Background
In the time-sharing lighting process of the multi-color LED lamps, the LED lamps are not always on, but are on or off at a certain frequency, and when the on-off frequency (stroboscopic frequency) of the LEDs exceeds 80HZ, the LED on-off process cannot be seen by eyes. And the LED lamp is normally turned on and off by PWM pulse signals. If the frequency of the pulse signal is not high enough, certain ripple exists under the shooting of a high-definition camera of the mobile phone, and the long-term exposure of eyes to the environment can cause headache and eyestrain, cause photosensitive epilepsy, lead to vision reduction, distraction and other problems.
In order to save cost, a small household appliance generally uses microcontrollers such as a singlechip with lower price to generate PWM pulse signals to drive the multicolor LED lamp, and when the singlechip I/O port time-sharing multiplexing is adopted to drive the multicolor LED lamp, the driving frequency is often only hundreds of hertz, which can not reach 3125HZ authentication level measurement standard required by Chinese LED industry standard. This often results in the problem of stroboscopic illumination of the multicoloured LED lamp.
Disclosure of Invention
In view of the above, the embodiments of the present invention provide a method, an apparatus, and an electronic device for intelligently driving a multicolor LED lamp, so as to solve the problem in the prior art that when a microcontroller is used to drive the multicolor LED lamp, the driving frequency is low, and thus a strobe occurs.
In a first aspect, an embodiment of the present invention provides an intelligent driving method for a multicolor LED lamp, which uses a microcontroller to drive a plurality of multicolor LED lamps, where each multicolor LED lamp at least includes red, green and blue light emitting sources, and the method includes:
Acquiring the number of the multicolor LED lamps, and marking the number as N, wherein N is a natural number larger than 1;
Determining the timer overflow time of the microcontroller and the frequency of the pulse signals output by the microcontroller according to the number of the multicolor LED lamps;
And controlling the pulse signals to drive N multicolor LED lamps according to the overflow time of the timer, and alternately emitting any one of red, green or blue light source colors according to a preset sequence.
Preferably, controlling the pulse signal to drive the N multi-color LED lamps with the frequency according to the timer overflow time to alternately emit any one of the light source colors of red, green or blue according to a preset sequence includes:
s31: waiting for the timer to overflow according to the overflow time;
s32: if the timer overflows, clearing an overflow mark and a watchdog for clearing the timer, and judging whether the overflow times of the timer reach preset times or not; if yes, executing S33; if not, executing S34;
s33: exchanging high and low values of a register of the microcontroller, and switching the light source color of the currently enabled multicolor LED lamp, wherein the register stores data of the overflow times of the timer;
S34, after the light source colors of the currently enabled multicolor LED lamp are switched, returning to S31.
Preferably, the method further comprises:
After executing S34, before returning to S31, it is detected whether the key is triggered, and if it is detected that the key is triggered, the corresponding operation of the key triggered is executed and then the process returns to S31.
Preferably, said exchanging the register high and low values of the microcontroller and switching the light source color of the currently enabled multicolor LED lamp includes:
The register value in the upper position and the register value in the lower position in the register of the microcontroller are exchanged;
judging the light source color of the currently enabled multicolor LED lamp;
if the color of the light source of the currently enabled multicolor LED lamp is red, switching to green;
if the color of the light source of the currently enabled multicolor LED lamp is green, switching to blue;
if the light source color of the currently enabled multicolor LED lamp is blue, the color is switched to red.
Preferably, N multi-color LED lamps are respectively denoted as LEDs 1,LED2,LED3……LEDN-1,LEDN, and the switching-enabled multi-color LED lamp includes:
Judging the currently enabled multicolor LED lamp;
If the currently enabled multi-color LED lamp is an LED 1, switching to an LED 2;
if the currently enabled multi-color LED lamp is an LED 2, switching to an LED 3;
And so on;
If the currently enabled multi-color LED lamp is an LED N-1, switching to an LED N;
If the currently enabled multi-color LED lamp is LED N, then it is switched to LED 1.
Preferably, the microcontroller is an OTP single chip microcomputer, and the phase difference between PWM pulse signals for driving the N multi-color LED lamps is a fixed value.
Preferably, before the driving of the plurality of multi-color LED lamps by the microcontroller, the plurality of multi-color LED lamps are divided into K groups, each group of multi-color LED lamps comprises 2 to 8 multi-color LED lamps, wherein K is a natural number greater than or equal to 2, at least one of the microcontrollers is used to drive a group of multi-color LED lamps, and the multi-color LED lamps in each group are connected in parallel.
Preferably, the K groups of multi-color LED lamps and the K microcontrollers form a color lighting device, and a color lighting unit of the color lighting device comprises a group of multi-color LED lamps and a microcontroller, and the method further comprises:
Collecting an image when the color light-emitting device emits light;
judging whether the image meets a preset condition or not;
if the preset condition is met, acquiring the total power consumption of the color light-emitting device;
When the total power consumption is larger than a preset power consumption threshold, extinguishing J groups of the multicolor LED lamps, wherein J is a natural number smaller than K;
judging whether the total power consumption is larger than the preset power consumption threshold value or not again;
if yes, continuing to extinguish L groups of the multicolor LED lamps until the total power consumption is smaller than or equal to the preset power consumption threshold, wherein L is a natural number smaller than or equal to J;
Collecting the real-time image when the color light-emitting device emits light again;
judging whether the real-time image meets a preset condition or not;
And if the preset condition is not met, any multicolor LED lamp in the extinguished groups of multicolor LED lamps is lightened until the image obtained when the color light-emitting device emits light meets the preset condition.
In a second aspect, an embodiment of the present invention provides an intelligent driving device for a multi-color LED lamp, where the driving device is configured to drive a plurality of multi-color LED lamps, and each multi-color LED lamp at least includes the following light source colors: red, green and blue, said device being controlled by a microcontroller, comprising:
the acquisition module is used for acquiring the number of the multicolor LED lamps and recording the number as N, wherein N is a natural number larger than 1;
The determining module is used for determining the timer overflow time of the microcontroller and the frequency of the pulse signals output by the microcontroller according to the number of the multicolor LED lamps;
And the driving module is used for controlling the pulse signals to drive the N multicolor LED lamps at the frequency according to the overflow time of the timer, and alternately emitting any one of red, green or blue light source colors according to a preset sequence.
In a third aspect, an embodiment of the present invention provides an electronic device, including: at least one microcontroller, at least one memory and computer program instructions stored in the memory, which when executed by the processor implement the method of the first aspect of the embodiments as described above.
In a fourth aspect, embodiments of the present invention provide a storage medium having stored thereon computer program instructions which, when executed by a processor, implement a method as in the first aspect of the embodiments described above.
In summary, the beneficial effects of the invention are as follows:
According to the intelligent driving method, the intelligent driving device and the intelligent driving electronic equipment for the multicolor LED lamps, the overflow time of the single chip microcomputer is set according to the number of the multicolor LED lamps, and the PWM pulse signals are controlled to drive the multicolor LED lamps to emit light in turn according to the preset sequence. The multicolor LED lamp driving method does not need to enter interrupt timing, judges time through judging the overflow of the timer, reduces unnecessary PWM pulse signals to execute judging operation as much as possible, realizes that a low-cost singlechip can also output higher PWM pulse signals to drive the multicolor LED lamp to generate a color running water effect, and ensures that the frequency of the PWM pulse signals is high enough to reduce stroboscopic.
Drawings
In order to more clearly illustrate the technical solution of the embodiments of the present invention, the drawings required to be used in the embodiments of the present invention will be briefly described, and it is within the scope of the present invention to obtain other drawings according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic flow chart of an intelligent driving method of a multicolor LED lamp according to an embodiment of the present invention.
Fig. 2 is a schematic flow chart of step S3 in fig. 1.
Fig. 3 is a schematic diagram of an intelligent driving circuit such as a multicolor LED according to a first embodiment of the present invention.
Fig. 4 is a waveform diagram of a PWM pulse signal according to a first embodiment of the present invention.
Fig. 5 is a schematic diagram of a lighting effect of a lighting area of an electronic device according to a first embodiment of the present invention.
Fig. 6 is a schematic structural diagram of an intelligent driving device for a multicolor LED lamp according to a third embodiment of the present invention.
Fig. 7 is a schematic structural diagram of an intelligent driving device for a multicolor LED lamp according to a fourth embodiment of the present invention.
Detailed Description
Features and exemplary embodiments of various aspects of the present invention will be described in detail below, and in order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in further detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely configured to illustrate the invention and are not configured to limit the invention. It will be apparent to one skilled in the art that the present invention may be practiced without some of these specific details. The following description of the embodiments is merely intended to provide a better understanding of the invention by showing examples of the invention.
It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Example 1
In order to ensure that the flowing water effect of the multicolor LED lamp reduces or inhibits stroboscopic effect as much as possible and protects eyes when the camera shoots, the driving frequency of the multicolor LED lamp needs to be increased as much as possible. In this embodiment, the output of the multiple paths of PWM pulse signals is realized by the timing interruption of the single chip microcomputer, that is, the main cycle in the program changes the duty ratio value of the PWM pulse signals by judging the proper time through the timing of the interruption function, when the interruption function is adopted to simulate the PWM pulse signals, because the single chip microcomputer needs time for interruption, time for calling the interruption function, time for entering the interruption function to save the current main cycle execution state value, time for exiting the interruption to reduce the main cycle execution state and time for returning to the main cycle are all needed, if the interruption function is added with the time for executing the multiple paths of PWM calculation and timing calculation, more time is needed, the frequency of the PWM pulse signals is not too high, the stroboscopic problem is easy to occur, and a large number of functions are called and the calculation processing capacity of the single chip microcomputer is too large, which is easy to cause problems, and the service life is affected.
Taking an OTP singlechip as an example, the maximum speed instruction execution speed of the conventional OTP singlechip is about 8MHz, the normal execution time of one instruction is 0.125us (instruction period), one instruction period is needed when one instruction is executed, two instruction periods (0.25 us are needed when the instruction is executed, and the interrupt function is added with the time of executing multi-path PWM calculation, timing calculation and the like, so that the interrupt can be carried out at least once in 10 us. When the color light is to be realized, the LED lamp with multiple colors is required to be realized, the period (LED driving period) of the PWM pulse signal is at least 10us times the PWM progression times 3 (the RGB three-color LED lamp is lighted in a time-sharing way), and in order to enable the color flowing effect to be smooth, namely the color cannot be suddenly changed instantaneously, the PWM progression of the LED lamp is at least 15 steps, so that the period (namely the LED driving period) of the PWM pulse signal can be at least 450us, and the maximum frequency is not more than 2.2KHZ. In addition, the singlechip drives the multicolor LED lamp to realize the sequential lighting of the color flowing effect, and simultaneously performs other functions such as key scanning (judging whether a key on the equipment is triggered), timing shutdown and the like (hundreds of microseconds (us) of time is usually consumed), so that the LED driving frequency (PWM pulse signal frequency) in practical application is often only hundreds of hertz. In addition, the more the number of the LED lamps is driven, the more the number of instructions is in the main program, the longer the interrupt period is, the longer the LED driving period is, the lower the driving frequency is, and even the driving frequency is as low as tens of hertz, so that the color running water effect cannot be realized at all.
Therefore, the embodiment of the invention is realized by adopting a timing scheme without interrupt, judging time by judging the overflow flag bit of the timer, completing one main cycle within the set overflow time, reducing unnecessary PWM execution judgment as much as possible, selecting a cycle with less judgment times and more residual time to execute key scanning, and performing intelligent control methods such as timing closing and the like on the multicolor LED lamp for realizing the color flow effect.
Referring to fig. 1, an embodiment of the invention provides an intelligent driving method for a multicolor LED lamp, which includes the following steps:
S1: acquiring the number of the multicolor LED lamps, and marking the number as N, wherein N is a natural number; the invention is not limited to the number of multicolor LED lamps, the number can be a plurality of strings of LED lamps, and the number of the LED lamps in each string is from a plurality of hundreds to hundreds.
S2: determining the timer overflow time of the microcontroller and the frequency of the pulse signals according to the number of the multicolor LED lamps; the number of the multicolor LED lamps is mainly set according to the requirement of a user, after the number of the multicolor LED lamps is obtained, the microcontroller automatically determines the overflow time of the timer and the frequency of the pulse signal, dynamically determines the overflow time and the frequency of the pulse signal based on the change of the number of the multicolor LED lamps, intelligent control is realized, and a specific determination mode is given below.
S3: and controlling the pulse signals to drive N multicolor LED lamps according to the overflow time of the timer, and alternately emitting any one of red, green or blue light source colors according to a preset sequence.
And setting the overflow time of the single chip microcomputer according to the number of the multicolor LED lamps, and controlling the PWM pulse signals to drive the plurality of multicolor LED lamps to emit light in turn according to a preset sequence. The multicolor LED lamp driving method does not need to enter interrupt timing, judges time through judging the overflow of the timer, reduces unnecessary PWM pulse signals to execute judging operation as much as possible, realizes that a low-cost singlechip can also output higher PWM pulse signals to drive the multicolor LED lamp to generate a color running water effect, and ensures that the frequency of the PWM pulse signals is high enough to reduce stroboscopic.
Referring to fig. 2, in the step S3, according to the timer overflow time, the pulse signal is controlled to drive the N multi-color LED lamps with the frequency to alternately emit any one of the light source colors of red, green or blue according to a preset sequence, and the method further includes:
s31: waiting for the timer to overflow according to the overflow time;
s32: if the timer overflows, clearing an overflow mark and clearing a watchdog, and judging whether the overflow times of the timer reach preset times or not; if yes, go to step S33; if not, executing step S34;
s33: exchanging high and low values of a register of the microcontroller, and switching the light source color of the currently enabled multicolor LED lamp, wherein the register stores data of the overflow times of the timer;
And S34, after the light source colors of the currently enabled multicolor LED lamp are switched, returning to the step S31 to continue waiting.
Specifically, it is determined whether the currently enabled multi-color LED lamp is switched, if so, the process returns to step S31, and if not, the currently enabled multi-color LED lamp is continuously switched until the switching is completed.
Referring to fig. 3, a schematic structural diagram of a driving circuit used for implementing the intelligent driving method of a multicolor LED lamp according to an embodiment of the present invention is shown. In this embodiment, the OTP singlechip is selected to drive 4 multicolor LED lamps (LEDs 1、LED2、LED3、LED4) to achieve a color running effect, and of course, for convenience of description, only 4 multicolor LED lamps are selected, in practice, three, five and more than five multicolor LED lamps can be set according to user needs, and the number is not required. Each multicolor LED lamp at least comprises a red LED lamp bead, a green LED lamp bead and a blue LED lamp bead. In fig. 3, I/O ports (not shown) of the singlechip are respectively connected with the r_led, the g_led, the b_led ends, the LED 1、LED2、LED3 and the LED 4 ends. When the I/O port of the singlechip connected with the R_LED end outputs low level and then conducts the PNP triode Q1 through the resistor R4, the VCC power supply conducts the anode of the red LED in the LED 1, and the I/O port of the singlechip connected with the LED 1 end outputs low level to conduct the cathode of the multicolor LED 1, the red LED of the LED 1 is lighted, and the multicolor LED 1 emits red light; when the output low level of the singlechip I/O port connected with the G_LED end is conducted through the resistor R6 and then the PNP triode Q3 is conducted, the VCC power supply is conducted with the anode of the green light LED in the LED 1, the singlechip I/O port connected with the LED 1 end is conducted with the cathode of the LED 1, the green light LED in the multicolor LED 1 is turned on, the multicolor LED 1 emits green light, the blue light LED of the multicolor LED 1 is sequentially controlled to emit blue light … …, and when the output low level of the singlechip I/O port connected with the R_LED end is conducted with the PNP triode Q1 through the resistor R4, When the VCC power supply is conducted with the anode of a red LED in the LED 2 and the I/O port of the singlechip connected with the end of the LED2 is conducted with the cathode of the LED 2 in a low level, the red LED of the LED 2 is lightened, the multicolor LED 2 emits red light … … to control the I/O port of the singlechip to output 7 paths of PWM pulse signals to the ends of the R_LED, the G_LED, the B_LED and the LED 1、LED2、LED3、LED4 according to a certain time sequence, and the LED 1、LED2、LED3、LED4 is driven to sequentially emit red light, green light and blue light. The PWM pulse signal inputted from the ports of r_led, g_led, b_led, and LED 1、LED2、LED3、LED4 is schematically shown in fig. 4, at the beginning, the blue LED bead of LED 1 is turned on, after a first preset time, the red LED bead of LED2 is turned on, the blue LED bead of LED1 is turned off after a second preset time after the red LED bead of LED2 is turned on, also the red LED bead of LED2 is turned on after the first preset time, the yellow LED bead of LED3 is turned on, the red LED bead of LED2 is turned off after the second preset time after the yellow LED bead of LED3 is turned on, and so on, forming a color running light effect, wherein the second preset time is smaller than the first preset time, and the first preset time and the second preset time are determined according to the driving period (or driving frequency) of the PWM.
The pulse width set in fig. 4 is 150.3us, period 226.04us, duty cycle about 66.53% and frequency up to 4.42KHz. Compared with the prior art, the frequency can be obviously improved by adopting the scheme of the invention, compared with the maximum frequency in the prior art which is not more than 2.2KHZ, the frequency is more than 1 time, and the stroboscopic problem of realizing the color running water effect of the multicolor LED lamp can be well reduced or even eliminated when the frequency of the PWM pulse signal reaches 4.42KHz.
In this embodiment, according to the timer overflow time, controlling the pulse signal to drive the N multi-color LED lamps with the frequency to alternately emit any one of the colors of the light source, which is red, green or blue, according to a preset sequence includes:
s31: waiting for the timer of the singlechip to overflow according to the set overflow time, wherein the overflow time of the timer is set to be 5us, and the timer overflows once every 5 us.
S32: if the singlechip timer overflows, clearing an overflow mark, and judging whether the overflow times reach 15 times (preset PWM (pulse-Width modulation) series) or not; if yes, go to step S33; if not, executing step S34;
And judging whether the overflow times reach 15 times, if so, switching the light source colors, namely switching the light source colors every 15×5 us.
S33: exchanging high and low values of a register of the microcontroller, and switching the light source color of the currently enabled multicolor LED lamp, wherein the register stores data of the overflow times of the timer;
Illustratively, if the register is 8 bits, the data stored therein is the number of timer overflows, the upper 4 bits of the register are swapped with the lower 4 bits of the register when swapping the upper and lower values of the register of the microcontroller is performed.
And S34, after the light source colors of the currently enabled multicolor LED lamp are switched, returning to the step S31 to continue waiting.
In a specific embodiment, the switching the currently enabled light source colors (for example, sequentially emitting light in R, G, B order) specifically includes:
s331: judging the color of the currently enabled light source;
s332: if the currently enabled light source color is red (R), switching to green (G);
S333: if the currently enabled light source color is green (G), switching to blue (B);
s334: if the currently enabled light source color is blue (B), then it switches to red (R).
For a specific handover procedure, refer to fig. 4. If the currently enabled light source color is switched from red to green, the PWM pulse signal input by the r_led terminal is switched from low to high, and the PWM pulse signal input by the corresponding g_led terminal is switched from high to low. If the currently enabled light source color is switched from green to blue, the PWM pulse signal input by the g_led terminal is switched from low to high, and the PWM pulse signal input by the corresponding b_led terminal is switched from high to low. If the currently enabled light source color is switched from blue to red, the PWM pulse signal input by the b_led terminal is switched from low to high, and the PWM pulse signal input by the corresponding r_led terminal is switched from high to low.
In another embodiment, after step S332, the method further includes: and (5) performing light source color switching cycle timing. The number of times that the RGB three-color light sources are lighted in turn is recorded, and when the number of times that the RGB three-color light sources are lighted in turn reaches the preset number of times, the multicolor LED lamp is turned off (the flowing water effect is turned off). The lighting time of the multicolor LED lamp is obtained by obtaining the lighting times of the RGB three color light sources in turn, and when the lighting time is larger than a preset threshold (such as 20 minutes), the multicolor LED lamp is turned off, so that the purpose of saving electricity is achieved.
Preferably, the switching multicolor LED lamp comprises:
S341: judging the currently enabled multicolor LED lamp;
s342: if the currently enabled LED lamp is an LED 1, switching to an LED 2;
s343: if the currently enabled LED lamp is an LED 2, switching to an LED 3;
s344: if the currently enabled LED lamp is an LED 3, switching to an LED 4;
S345: if the currently enabled LED lamp is LED 4, then it is switched to LED 1.
Referring to fig. 4 for a specific switching process, if the LED currently enabled is switched from the LED 1 to the LED 2, the PWM pulse signal input from the LED 1 terminal is switched from low to high, and the PWM pulse signal input from the corresponding LED 2 terminal is switched from high to low. If the currently enabled light source color is switched from LED 2 to LED 3, the PWM pulse signal input from LED 2 is switched from low to high, and the PWM pulse signal input from LED 3 is switched from high to low. And so on, the 4 multicolor LED lamps are circularly switched according to the lighting sequence of the LEDs 1-LED2-LED3-LED4-LED1…LED4. In this embodiment, the phase difference of the 4 PWM pulse signals for driving the LED 1、LED2、LED3、LED4 is a fixed value, so as to ensure that any two PWM pulse signals do not switch between high and low levels at the same time.
In the above embodiment, it is noted that the LED lamp is switched from low level to high level to overflow once every time, when the number of times of detecting that the LED 1 or the LED 2 or the LED 3 or the LED 4 overflows is 256, the process returns to step S31 after delaying for 10us, and waits for the single chip timer to overflow according to the set overflow time.
In one embodiment, after step S34, before returning to step S31, the method further comprises: and performing key detection, judging whether the key of the equipment is triggered, if so, executing a corresponding instruction after the key is triggered, and if not, waiting for the overflow of the singlechip timer according to the set overflow time. Key detection is added while controlling the PWM output so that the user's input can be responded to in real time.
In this embodiment, the overflow time of the singlechip timer is set to be 5us, that is, the singlechip timer 5us overflows once, and in addition, the PWM pulse signal period can be calculated according to the following formula:
tp=t×k×m; wherein TP represents PWM pulse signal period, T represents timer overflow time, K represents preset PWM progression, M represents LED color number. After the PWM pulse signal period is obtained, the PWM pulse signal frequency is known accordingly.
In this embodiment, the PWM pulse signal period tp=5us×15×3=225 us, where 15 is a preset PWM level (at least 15 levels are needed for the PWM level to make the flowing effect smoother, i.e. the color change cannot appear abrupt), and 3 is three colors of RGB. Because the instruction execution period of the singlechip is 0.125us, 40 instruction periods can be executed in 5us time, and 7 paths of scanning PWM pulse signals can be controlled in 40 instruction periods. The frequency of the PWM pulse signal is 4.4KHZ which is greater than the national industry standard 3.15KHZ according to the period time of the PWM pulse signal, the stroboscopic effect can be greatly reduced, and bright and dark stripes can not appear when the camera is adopted to shoot, and when the multicolor LED lamp generates a color running water effect as an ornamental and shooting target, the intermittent and jittery bright and dark stripes can not be shot by the user camera, so that the experience of shooting landscapes by the user is improved.
In one embodiment, the microcontroller is an OTP single-chip microcomputer, the OTP is a memory type of the single-chip microcomputer, meaning that the OTP is programmable at one time, and after the program is burned into the single-chip microcomputer, the program cannot be changed and cleared again, so that the cost can be saved, and on the other hand, the safety of the product is guaranteed, and the program is prevented from being tampered.
Application examples
The intelligent control method of the multicolor LED lamp is applied to a light-emitting device, the multicolor LED lamp is arranged on electronic equipment or an outdoor light source device, and a camera shoots a color light-emitting device which is formed by a plurality of groups of multicolor LED lamps and displays a color flowing water effect.
In this embodiment, taking the example that the color light emitting device emits light in a circular ring shape on the electronic device, the photographing result is shown in fig. 5, after the color light emitting device is started, the circular ring-shaped light emitting area 2 of the electronic device 1 in fig. 5 shows a color light effect similar to the change of flowing water, and when the image collecting device such as a camera is used, the color flowing water effect is stable and smooth, no stroboscopic effect occurs, and intermittent and jittery bright and dark stripes cannot be photographed.
The electronic device shown in fig. 5 includes 4 multicolor LED lamps and a single-chip microcomputer for driving the multicolor LED lamps, where the 4 multicolor LED lamps and the single-chip microcomputer are defined as a light emitting unit, and in another embodiment, the color light emitting device may further include a plurality of the light emitting units, and the color light emitting device includes 2 light emitting units, that is, 8 multicolor LED lamps and two single-chip microcomputers, where one single-chip microcomputer drives the 4 multicolor LED lamps. The multicolor LED lamps of the two luminous units are arranged at intervals when being placed, and the four multicolor LEDs of the first luminous unit are respectively recorded as follows: the LEDs 11、LED12、LED13、LED14, respectively record four multicolor LEDs of the second light emitting unit as: the LEDs 21、LED22、LED23、LED24 are switched cyclically in the lighting sequence of LED11-LED21-LED12-LED22-LED13-LED23-LED14-LED24-LED11…LED24. The multicolor LED lamps with more quantity can realize better color flowing effect, and even if one multicolor LED in the first luminous unit or the second luminous unit is damaged, the color flowing effect is not greatly influenced. The color light emitting device is described here only by way of example as including two light emitting units each including 4 multicolor LED lamps, and a plurality of each multicolor LED lamp may be provided as needed in practice, the number of each multicolor LED lamp being between 2 and 8.
Further, in order to achieve the color light effect of flowing water change, and when the image acquisition equipment such as a camera is used, the color flowing water effect is stable and smooth, no stroboscopic effect appears, intermittent and jittery bright and dark stripes cannot be shot, and a plurality of light emitting units (namely a plurality of groups of multicolor LED lamps) are generally selected to be simultaneously lightened at the beginning, but the simultaneous lightening of a plurality of groups of multicolor LED lamps tends to cause larger energy loss of a color light emitting device and even the whole electronic equipment, and the power consumption is larger. In order to reduce the power consumption of the whole electronic equipment, the power consumption of the color light emitting device is reduced by turning off a few multicolor LED lamps, but at the same time, in order to meet the visual effect, the number of the lighted multicolor LED lamps or the number of the multicolor LED lamps is required to be intelligently selected, in addition, in practice, some multicolor LED lamps possibly fail in the color light emitting device, and in general, the whole color light emitting device is scrapped or returned to a factory for maintenance, so that the user cost is greatly increased, and the user experience is seriously influenced. Therefore, the invention is further improved and perfected, the intelligent control is realized on the color luminous device, and a plurality of groups of multicolor LED lamps or a plurality of multicolor LED lamps in a plurality of groups of multicolor LED lamps are intelligently selected to be lightened according to a preset condition and a preset power consumption threshold. The preset conditions here may be: when the color light emitting device displays the color flowing effect and is acquired by using image acquisition equipment such as a camera, the acquired image of the color light emitting device is subjected to image analysis processing to obtain a bright and dark stripe which does not have interruption and jitter in the image, and the preset power consumption threshold can be set according to the actual application condition without limitation. The intelligent driving method of the multicolor LED lamp further comprises the following steps:
Collecting an image when the color light-emitting device emits light;
judging whether the image meets a preset condition or not;
if the preset condition is met, acquiring the total power consumption of the color light-emitting device;
When the total power consumption is larger than a preset power consumption threshold, extinguishing J groups of the multicolor LED lamps, wherein J is a natural number smaller than K;
judging whether the total power consumption is larger than the preset power consumption threshold value or not again;
if yes, continuing to extinguish L groups of the multicolor LED lamps until the total power consumption is smaller than or equal to the preset power consumption threshold, wherein L is a natural number smaller than or equal to J;
Collecting the real-time image when the color light-emitting device emits light again;
judging whether the real-time image meets a preset condition or not;
And if the preset condition is not met, any multicolor LED lamp in the extinguished groups of multicolor LED lamps is lightened until the image obtained when the color light-emitting device emits light meets the preset condition. In this embodiment, first, it is determined that the total power consumption of the color light emitting device satisfies the number of groups of the multicolor LED lamps not greater than the preset power consumption threshold, but the light emitting effect thereof does not necessarily satisfy the preset condition at this time, and therefore, any one of the plurality of groups of the multicolor LED lamps that are turned off is turned on until the light emitting effect when the color light emitting device is turned on satisfies the preset condition. At the moment, the lighted color light-emitting device is considered to reach the optimal light-emitting effect and the power consumption balance state, the smooth color flowing effect is displayed, the power consumption is low, and the visual effect and the user experience of the electronic equipment can be improved while the power consumption of the whole electronic equipment is reduced.
Further, when the number of the multicolor LED lamps of one light emitting unit is different from that of another light emitting unit (the LED lamps of one light emitting unit may be failed or damaged), for example, the number of the multicolor LED lamps in the first light emitting unit is 5, and the number of the multicolor LED lamps of the second light emitting unit is 6, at this time, according to the method of the present invention, the multicolor LED lamps have the problem of inconsistent frequency, which can solve the problem of effect contrast when the color flowing water display effect is formed as a whole, the color flowing water effect with high frequency of the first light emitting unit is better than the flowing water display effect with low frequency of the second light emitting unit, and bad experience is brought to the user.
It is therefore necessary to adjust the frequency of either or both of the light emitting units so that the frequencies of the two light emitting units coincide. Specifically, the color light emitting device comprises P light emitting units, wherein P is a natural number greater than or equal to 2, the number of the multicolor LED lamps in each group is inconsistent, the number of the multicolor LED lamps in each group is between 2 and 8, and the frequency of the P light emitting units is adjusted to ensure that the frequency of the P light emitting units is consistent and comprises
The method comprises the following steps:
Respectively acquiring PMW pulse frequencies of P light emitting units, and respectively marking the PMW pulse frequencies as a first frequency value, a second frequency value, … … and a P frequency value;
Acquiring a minimum value in the P frequency values, and taking the minimum value as a reference frequency value;
acquiring a reference overflow time value according to the reference frequency value;
and respectively adjusting the overflow time of the microcontrollers of the light emitting units according to the basic overflow time value, so that the first frequency value, the second frequency value, … … and the P frequency value are all equal to the reference frequency value.
For example, the PWM pulse frequency for driving 5 multi-color LED lamps in the first light emitting unit is 4.1KHZ, the PWM pulse frequency for driving 6 multi-color LED lamps in the second light emitting unit is 3.8KHZ, and 3.8KHZ is used as the reference frequency value, according to the above formula: tp=t×k×m (where TP represents a PWM pulse signal period, T represents a timer overflow time, K represents a preset PWM progression, and M represents the number of LED colors). In this example, m=3, k=15, then TP is the reciprocal of 3.2KHZ, and the final count yields a reference overflow time value of 5.8us, and the original overflow time of the first light emitting unit is 5.4us, and the overflow time of the first light emitting unit is adjusted to 5.8us, and the overflow time of the second light emitting unit is unchanged, so that the PWM pulse driving frequencies of the first light emitting unit and the second light emitting unit are consistent. Thereby avoid leading to each color flowing water effect inconsistent problem when a plurality of polychrome LED lamps have the inconsistent problem of frequency for each lighting element's flowing water effect is unanimous, guarantees holistic flowing water effect smoothness unanimity, promotes user experience.
Example two
In this embodiment, 8 three-color LED lamps are used to achieve the flowing effect, and specific implementation steps are similar to those of the above embodiment, and are not described herein. In the embodiment, the overflow time of the timer of the singlechip is set to 7us, 56 instruction periods can be executed within 7us, and 11 paths of scanning PWM pulse signals are controlled through the 56 instruction periods. The frequency of the PWM pulse signal is 3.15KHZ, namely the singlechip timer 7us overflows once, and the period TP=7us×15x3=315 us of the PWM pulse signal is obtained according to the period time of the PWM pulse signal, wherein 15 is a set PWM level number, and 3 is three colors of RGB. The frequency of the PWM pulse signal is about 3.15KHZ, which meets the national industry standard of 3.15KHZ, and can greatly reduce the light and dark stripes generated by stroboscopic shooting by adopting a video camera. That is, in the intelligent driving method of the multicolor LED lamp, the multicolor LED lamp is preferably RGB three colors and the number of the multicolor LED lamps is between 2 and 8. Of course, there may be multiple LED beads of each color in each multicolor LED lamp, and LED beads of the same color may be connected in series or in parallel, but need to be turned on or turned off simultaneously.
In summary, according to the intelligent driving method for the multi-color LED lamps provided by the embodiment of the invention, the overflow time of the single chip microcomputer is set according to the number of the multi-color LED lamps, the PWM pulse signals are controlled to drive the multi-color LED lamps to emit light in turn according to the preset sequence, and meanwhile, the PWM pulse signals are guaranteed to have high enough frequency to reduce the stroboscopic effect. According to the intelligent driving method of the multicolor LED lamp, interrupt timing is not needed, the time is judged by judging the overflow of the timer, one main cycle is completed within the set overflow time, unnecessary PWM pulse signals are reduced as much as possible to execute judging operation, meanwhile, PWM pulse signal periods with less judging operation times and more residual time are selected to execute intelligent control such as key scanning, timing closing of a running light and the like, and the functions of key scanning, timing of the running light and the like are realized when the multicolor LED lamp is intelligently driven by the low-cost singlechip to generate the running water effect.
Example III
Referring to fig. 6, an embodiment of the present invention provides an intelligent driving device 200 for a multi-color LED lamp, where the device 200 includes:
the acquisition module 201 is configured to acquire the number of multicolor LED lamps, and record the number as N, where N is a natural number;
A determining module 202, configured to determine, according to the number of the multicolor LED lamps, a timer overflow time of the microcontroller and a frequency of the pulse signal;
The driving module 203 is configured to control the pulse signal to drive the N multi-color LED lamps to alternately emit any one of the red, green or blue light sources according to a preset sequence according to the timer overflow time.
Preferably, the driving module 203 further includes:
An overflow waiting unit for waiting for the timer to overflow according to the overflow time;
The first circulation unit is used for clearing the overflow mark and clearing the watchdog of the timer if the timer overflows, and judging whether the overflow times of the timer reach the preset times or not; ; if yes, executing the step of the exchange unit; if not, executing the step of the second circulation unit;
the switching unit is used for switching high and low values of a register of the microcontroller and switching the light source color of the currently enabled multicolor LED lamp, wherein the register stores data of the overflow times of the timer;
And the second circulation unit is used for returning to the overflow waiting unit after the light source colors of the currently enabled multicolor LED lamp are switched.
Preferably, the first circulation unit further comprises:
the exchange module is used for exchanging high and low values of a register of the microcontroller;
A first judging unit for judging the currently enabled light source color;
The first light source color switching unit is used for switching to green if the currently enabled light source color is red;
the second light source color switching unit is used for switching to blue if the currently enabled light source color is green;
And the second light source color switching unit is used for switching to red if the currently enabled light source color is blue.
Preferably, the second circulation unit further comprises:
the second judging unit is used for judging the LED lamp which is enabled currently;
the first LED switching unit is configured to switch to an LED 2 if the LED lamp currently enabled is an LED 1;
The second LED switching unit is configured to switch to an LED 3 if the LED lamp currently enabled is an LED 2;
by analogy in turn,
The N-1LED switching unit is used for switching to the LED N if the currently enabled LED lamp is the LED N-1.
The nth LED switching unit is configured to switch to the LED 1 if the LED lamp currently enabled is the LED N.
In summary, according to the multicolor LED lamp intelligent driving device provided by the embodiment of the invention, the overflow time of the singlechip is set according to the number of the multicolor LED lamps, and the PWM pulse signals are controlled to intelligently drive the plurality of multicolor LED lamps to alternately emit light according to the preset sequence, and meanwhile, the PWM pulse signals are ensured to have high enough frequency to reduce stroboscopic. According to the multicolor LED lamp driving method, the interrupt timing is not needed, the time is judged by judging the overflow of the timer, the primary circulation is completed within the set overflow time, the unnecessary PWM pulse signal execution judging operation is reduced as much as possible, meanwhile, the PWM pulse signal period with less judging operation times and more residual time is selected to execute intelligent control such as key scanning, timing closing of a running lamp and the like, and the functions of key scanning, timing of the running lamp and the like are realized when the multicolor LED lamp is driven by the low-cost singlechip to generate the running effect.
Example IV
In addition, the method for driving the multicolor LED lamp according to the embodiment of the invention can be realized by the electronic equipment shown in fig. 7. Fig. 7 shows a schematic hardware structure of an electronic device according to an embodiment of the present invention.
The electronic device may comprise a processor 301 and a memory 302 storing computer program instructions.
In particular, the processor 301 may include a Central Processing Unit (CPU), or an Application SPECIFIC INTEGRATED Circuit (ASIC), or may be configured as one or more integrated circuits that implement embodiments of the present invention.
Memory 302 may include mass storage for data or instructions. By way of example, and not limitation, memory 302 may comprise a hard disk drive (HARD DISK DRIVE, HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or universal serial bus (Universal Serial Bus, USB) drive, or a combination of two or more of the foregoing. Memory 302 may include removable or non-removable (or fixed) media, where appropriate. Memory 302 may be internal or external to the data processing apparatus, where appropriate. In a particular embodiment, the memory 302 is a non-volatile solid-state memory. In particular embodiments, memory 302 includes Read Only Memory (ROM). The ROM may be mask programmed ROM, programmable ROM (PROM), erasable PROM (EPROM), electrically Erasable PROM (EEPROM), electrically rewritable ROM (EAROM), or flash memory, or a combination of two or more of these, where appropriate.
The processor 301 reads and executes the computer program instructions stored in the memory 302 to implement any one of the multi-color LED lamp intelligent driving methods in the above embodiments.
In one example, the electronic device may also include a communication interface 303 and a bus 310. As shown in fig. 6, the processor 301, the memory 302, and the communication interface 303 are connected to each other by a bus 310 and perform communication with each other.
The communication interface 303 is mainly used to implement communication between each module, device, unit and/or apparatus in the embodiment of the present invention.
Bus 310 includes hardware, software, or both, that couple the components of the image packet printing device to one another. By way of example, and not limitation, bus 310 may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an infiniband interconnect, a Low Pin Count (LPC) bus, a memory bus, a micro channel architecture (MCa) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a video electronics standards association local (VLB) bus, or other suitable bus, or a combination of two or more of the above. Bus 310 may include one or more buses, where appropriate. Although embodiments of the invention have been described and illustrated with respect to a particular bus, the invention contemplates any suitable bus or interconnect.
Example five
In addition, in combination with the method for intelligently driving the multicolor LED lamp in the embodiment, the embodiment of the invention can be realized by providing a computer readable storage medium. The computer readable storage medium has stored thereon computer program instructions; the computer program instructions, when executed by the processor 301, implement any of the multi-color LED lamp intelligent driving methods of the above embodiments.
In summary, according to the method, the device, the equipment and the storage medium for intelligently driving the multicolor LED lamps provided by the embodiment of the invention, the overflow time of the singlechip is set according to the number of the multicolor LED lamps, the PWM pulse signals are controlled to intelligently drive the plurality of multicolor LED lamps to alternately emit light according to the preset sequence, and meanwhile, the frequency of the PWM pulse signals is ensured to be high enough to reduce stroboscopic. The multicolor LED lamp driving method does not need to enter interrupt timing, judges time by judging the overflow of the timer, completes one main cycle in the set overflow time, reduces unnecessary PWM execution judgment as much as possible, selects a period with less judgment times and more residual time to execute key scanning, and performs intelligent control such as timing closing of the multicolor LED lamp, thereby realizing the functions of key scanning, timing of the multicolor LED lamp and the like while intelligently driving the multicolor LED lamp to generate the color flowing water effect by adopting the low-cost singlechip.
It should be understood that the invention is not limited to the particular arrangements and instrumentality described above and shown in the drawings. For the sake of brevity, a detailed description of known methods is omitted here. In the above embodiments, several specific steps are described and shown as examples. The method processes of the present invention are not limited to the specific steps described and shown, but various changes, modifications and additions, or the order between steps may be made by those skilled in the art after appreciating the spirit of the present invention.
The functional blocks shown in the above-described structural block diagrams may be implemented in hardware, software, firmware, or a combination thereof. When implemented in hardware, it may be, for example, an electronic circuit, an Application Specific Integrated Circuit (ASIC), suitable firmware, a plug-in, a function card, or the like. When implemented in software, the elements of the invention are the programs or code segments used to perform the required tasks. The program or code segments may be stored in a machine readable medium or transmitted over transmission media or communication links by a data signal carried in a carrier wave. A "machine-readable medium" may include any medium that can store or transfer information. Examples of machine-readable media include electronic circuitry, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio Frequency (RF) links, and the like. The code segments may be downloaded via computer networks such as the internet, intranets, etc.
It should also be noted that the exemplary embodiments mentioned in this disclosure describe some methods or systems based on a series of steps or devices. The present invention is not limited to the order of the above-described steps, that is, the steps may be performed in the order mentioned in the embodiments, or may be performed in a different order from the order in the embodiments, or several steps may be performed simultaneously.
In the foregoing, only the specific embodiments of the present invention are described, and it will be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the systems, modules and units described above may refer to the corresponding processes in the foregoing method embodiments, which are not repeated herein. It should be understood that the scope of the present invention is not limited thereto, and any equivalent modifications or substitutions can be easily made by those skilled in the art within the technical scope of the present invention, and they should be included in the scope of the present invention.
Claims (9)
1. The intelligent driving method of the multicolor LED lamp is characterized in that a plurality of multicolor LED lamps are driven by a microcontroller, and each multicolor LED lamp at least comprises the following light source colors: red, green, and blue, the method comprising:
Acquiring the number of the multicolor LED lamps, and marking the number as N, wherein N is a natural number larger than 1;
determining the timer overflow time of the microcontroller and the frequency of the pulse signals output by the microcontroller according to the number of the multicolor LED lamps, wherein the method comprises the following steps: determining the pulse signal period according to the overflow time of the timer, and acquiring the frequency according to the pulse signal period; wherein the pulse signal period is determined according to a formula tp=t×k×m, TP represents the pulse signal period, T represents the timer overflow time, K represents a preset PWM progression, and M represents the number of light source colors;
According to the timer overflow time, controlling the pulse signal to drive the N multi-color LED lamps with the frequency to alternately emit any one of red, green or blue light source colors according to a preset sequence, including: s31: waiting for the timer to overflow according to the overflow time; s32: if the timer overflows, clearing an overflow mark and a watchdog for clearing the timer, and judging whether the overflow times of the timer reach preset times or not; if yes, executing S33; if not, executing S34; s33: exchanging high and low values of a register of the microcontroller, and switching the light source color of the currently enabled multicolor LED lamp, wherein the register stores data of the overflow times of the timer; s34, after the light source colors of the currently enabled multicolor LED lamp are switched, returning to S31; wherein the preset times are equal to the preset PWM progression.
2. The intelligent driving method of a multicolor LED lamp according to claim 1, further comprising:
After executing S34, before returning to S31, it is detected whether the key is triggered, and if it is detected that the key is triggered, the corresponding operation of the key triggered is executed and then the process returns to S31.
3. The method of claim 1, wherein said exchanging the register high and low values of the microcontroller and switching the light source color of the currently enabled multi-color LED lamp comprises:
The register value in the upper position and the register value in the lower position in the register of the microcontroller are exchanged;
judging the light source color of the currently enabled multicolor LED lamp;
if the color of the light source of the currently enabled multicolor LED lamp is red, switching to green;
if the color of the light source of the currently enabled multicolor LED lamp is green, switching to blue;
if the light source color of the currently enabled multicolor LED lamp is blue, the color is switched to red.
4. The intelligent driving method of multi-color LED lamp according to claim 1, wherein N multi-color LED lamps are respectively denoted as LEDs 1,LED2,LED3……LEDN-1,LEDN, and the switching-enabled multi-color LED lamp comprises:
Judging the currently enabled multicolor LED lamp;
If the currently enabled multi-color LED lamp is an LED 1, switching to an LED 2;
if the currently enabled multi-color LED lamp is an LED 2, switching to an LED 3;
And so on;
If the currently enabled multi-color LED lamp is an LED N-1, switching to an LED N;
If the currently enabled multi-color LED lamp is LED N, then it is switched to LED 1.
5. The intelligent driving method of the multicolor LED lamp according to claim 1, wherein the microcontroller is an OTP single chip microcomputer, and the phase difference between PWM pulse signals for driving N multicolor LED lamps is a fixed value.
6. The intelligent driving method of multi-color LED lamps according to any one of claims 1 to 5, wherein before the multi-color LED lamps are driven by the micro controller, the multi-color LED lamps are divided into K groups, each group of multi-color LED lamps comprises 2 to 8 multi-color LED lamps, wherein K is a natural number equal to or greater than 2, and at least one micro controller is used to drive a group of multi-color LED lamps, and the multi-color LED lamps in each group are connected in parallel.
7. The intelligent driving method of multi-color LED lamp according to claim 6, wherein K sets of multi-color LED lamps and K microcontrollers constitute a color lighting device, and a color lighting unit of the color lighting device comprises a set of multi-color LED lamps and a microcontroller, the method further comprising:
Collecting an image when the color light-emitting device emits light;
judging whether the image meets a preset condition or not;
if the preset condition is met, acquiring the total power consumption of the color light-emitting device;
When the total power consumption is larger than a preset power consumption threshold, extinguishing J groups of the multicolor LED lamps, wherein J is a natural number smaller than K;
judging whether the total power consumption is larger than the preset power consumption threshold value or not again;
if yes, continuing to extinguish L groups of the multicolor LED lamps until the total power consumption is smaller than or equal to the preset power consumption threshold, wherein L is a natural number smaller than or equal to J;
Collecting the real-time image when the color light-emitting device emits light again;
judging whether the real-time image meets a preset condition or not;
and if the preset condition is not met, any multicolor LED lamp in the extinguished groups of multicolor LED lamps is lightened until the image obtained when the color light-emitting device emits light meets the preset condition.
8. The intelligent driving device for the multicolor LED lamps is characterized in that the driving device is used for driving a plurality of multicolor LED lamps, and each multicolor LED lamp at least comprises the following light source colors: red, green and blue, the drive arrangement adopts microcontroller control, includes:
the acquisition module is used for acquiring the number of the multicolor LED lamps and recording the number as N, wherein N is a natural number larger than 1;
The determining module is used for determining the timer overflow time of the microcontroller and the frequency of the pulse signals output by the microcontroller according to the number of the multicolor LED lamps, and comprises the following steps: determining the pulse signal period according to the overflow time of the timer, and acquiring the frequency according to the pulse signal period; wherein the pulse signal period is determined according to a formula tp=t×k×m, TP represents the pulse signal period, T represents the timer overflow time, K represents a preset PWM progression, and M represents the number of light source colors;
The driving module is used for controlling the pulse signals to drive the N multicolor LED lamps at the frequency according to the overflow time of the timer, and the driving module alternately emits any one of red, green or blue light source colors according to a preset sequence, and comprises the following steps: s31: waiting for the timer to overflow according to the overflow time; s32: if the timer overflows, clearing an overflow mark and a watchdog for clearing the timer, and judging whether the overflow times of the timer reach preset times or not; if yes, executing S33; if not, executing S34; s33: exchanging high and low values of a register of the microcontroller, and switching the light source color of the currently enabled multicolor LED lamp, wherein the register stores data of the overflow times of the timer; s34, after the light source colors of the currently enabled multicolor LED lamp are switched, returning to S31; wherein the preset times are equal to the preset PWM progression.
9. An electronic device, comprising: at least one microcontroller, at least one memory and computer program instructions stored in the memory, which when executed by the microcontroller, implement the method of any one of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110877197.7A CN113543410B (en) | 2021-07-31 | 2021-07-31 | Intelligent driving method and device for multicolor LED lamp and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110877197.7A CN113543410B (en) | 2021-07-31 | 2021-07-31 | Intelligent driving method and device for multicolor LED lamp and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113543410A CN113543410A (en) | 2021-10-22 |
CN113543410B true CN113543410B (en) | 2024-05-28 |
Family
ID=78121847
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110877197.7A Active CN113543410B (en) | 2021-07-31 | 2021-07-31 | Intelligent driving method and device for multicolor LED lamp and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113543410B (en) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN203632904U (en) * | 2013-05-07 | 2014-06-04 | 张秀红 | Led decorative lamp |
CN105841056A (en) * | 2016-05-24 | 2016-08-10 | 江苏大学 | Street lamp illumination control system and method based on single-chip |
CN105973818A (en) * | 2016-06-29 | 2016-09-28 | 南京华信藤仓光通信有限公司 | Method for detecting mark quality in production process of optical fiber ribbons and stroboscopic system |
CN109379804A (en) * | 2018-10-15 | 2019-02-22 | 广东宝莱特医用科技股份有限公司 | A kind of LED light light adjusting system and light-dimming method |
CN209949472U (en) * | 2018-10-15 | 2020-01-14 | 广东宝莱特医用科技股份有限公司 | LED lamp dimming system |
CN110972352A (en) * | 2018-09-27 | 2020-04-07 | 上海海拉电子有限公司 | Vehicle lamp controller and monitoring method for vehicle lamp controller |
CN112601011A (en) * | 2020-12-07 | 2021-04-02 | 广东省电信规划设计院有限公司 | Automatic shooting control method and control device thereof |
-
2021
- 2021-07-31 CN CN202110877197.7A patent/CN113543410B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN203632904U (en) * | 2013-05-07 | 2014-06-04 | 张秀红 | Led decorative lamp |
CN105841056A (en) * | 2016-05-24 | 2016-08-10 | 江苏大学 | Street lamp illumination control system and method based on single-chip |
CN105973818A (en) * | 2016-06-29 | 2016-09-28 | 南京华信藤仓光通信有限公司 | Method for detecting mark quality in production process of optical fiber ribbons and stroboscopic system |
CN110972352A (en) * | 2018-09-27 | 2020-04-07 | 上海海拉电子有限公司 | Vehicle lamp controller and monitoring method for vehicle lamp controller |
CN109379804A (en) * | 2018-10-15 | 2019-02-22 | 广东宝莱特医用科技股份有限公司 | A kind of LED light light adjusting system and light-dimming method |
CN209949472U (en) * | 2018-10-15 | 2020-01-14 | 广东宝莱特医用科技股份有限公司 | LED lamp dimming system |
CN112601011A (en) * | 2020-12-07 | 2021-04-02 | 广东省电信规划设计院有限公司 | Automatic shooting control method and control device thereof |
Non-Patent Citations (1)
Title |
---|
一种多光谱亮度可调的LED光照系统;吴金华;;照明工程学报(第03期);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN113543410A (en) | 2021-10-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP1694099B1 (en) | LED driver device | |
CN107657238A (en) | A kind of fingerprint collecting method and electronic equipment | |
US9041308B2 (en) | Systems and methods of controlling the output of a light fixture | |
RU2010140894A (en) | LIGHTING DEVICE AND CONTAINING ITS DISPLAY DEVICE | |
CN103259994B (en) | Projection image display apparatus | |
CN108513396B (en) | Control method for constant-power constant-current time-sharing multiplexing of LED lamp | |
CN112004284B (en) | Address positioning system and method for LED lamp string | |
CN210629912U (en) | Color temperature adjustable light emitting diode circuit and lamp | |
JP2006041043A (en) | Led drive circuit | |
JP2006172820A (en) | Led lighting control device | |
CN113543410B (en) | Intelligent driving method and device for multicolor LED lamp and electronic equipment | |
CN116234104B (en) | LED lamp bead circuit and LED lamp | |
CN105120565A (en) | Linear constant current driving device capable of automatically balancing lamp string brightness and driving method of linear constant current driving device | |
US8963435B2 (en) | Light emitting system and light emitting instruction apparatus | |
CN108049116A (en) | Washing machine multicolor down lamp control device and control method | |
CN209949472U (en) | LED lamp dimming system | |
CN103077678A (en) | Method for controlling LED (light emitting diode) display brightness by high-frequency distributed pulses | |
CN106658832A (en) | LED power supply dimming control method | |
CN101684913B (en) | Device of luminescent lamp group controlled by music | |
CN106793249A (en) | A kind of efficient LED driving power source system | |
US20050134529A1 (en) | Color changing segmented display | |
CN1703130B (en) | Device for controlling light cluster by music | |
CN100508680C (en) | A music-controlled luminous lamp bank apparatus | |
CN204906821U (en) | Automatic linear constant current drive device and LED lamps and lanterns of balanced lamp cross luma degree | |
US20110109665A1 (en) | Display driving circuit and display driving system |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |