CN113543410A - 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 PDF

Info

Publication number
CN113543410A
CN113543410A CN202110877197.7A CN202110877197A CN113543410A CN 113543410 A CN113543410 A CN 113543410A CN 202110877197 A CN202110877197 A CN 202110877197A CN 113543410 A CN113543410 A CN 113543410A
Authority
CN
China
Prior art keywords
color
led
led lamps
led lamp
multicolor
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.)
Granted
Application number
CN202110877197.7A
Other languages
Chinese (zh)
Other versions
CN113543410B (en
Inventor
唐丰饶
廖锡略
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Yufan Microelectronics Co ltd
Original Assignee
Shenzhen Yufan Microelectronics Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Yufan Microelectronics Co ltd filed Critical Shenzhen Yufan Microelectronics Co ltd
Priority to CN202110877197.7A priority Critical patent/CN113543410B/en
Publication of CN113543410A publication Critical patent/CN113543410A/en
Application granted granted Critical
Publication of CN113543410B publication Critical patent/CN113543410B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H05ELECTRIC TECHNIQUES NOT OTHERWISE PROVIDED FOR
    • H05BELECTRIC HEATING; ELECTRIC LIGHT SOURCES NOT OTHERWISE PROVIDED FOR; CIRCUIT ARRANGEMENTS FOR ELECTRIC LIGHT SOURCES, IN GENERAL
    • H05B45/00Circuit arrangements for operating light-emitting diodes [LED]
    • H05B45/30Driver circuits
    • H05B45/32Pulse-control circuits
    • H05B45/325Pulse-width modulation [PWM]
    • HELECTRICITY
    • H05ELECTRIC TECHNIQUES NOT OTHERWISE PROVIDED FOR
    • H05BELECTRIC HEATING; ELECTRIC LIGHT SOURCES NOT OTHERWISE PROVIDED FOR; CIRCUIT ARRANGEMENTS FOR ELECTRIC LIGHT SOURCES, IN GENERAL
    • H05B45/00Circuit arrangements for operating light-emitting diodes [LED]
    • H05B45/20Controlling the colour of the light
    • HELECTRICITY
    • H05ELECTRIC TECHNIQUES NOT OTHERWISE PROVIDED FOR
    • H05BELECTRIC HEATING; ELECTRIC LIGHT SOURCES NOT OTHERWISE PROVIDED FOR; CIRCUIT ARRANGEMENTS FOR ELECTRIC LIGHT SOURCES, IN GENERAL
    • H05B47/00Circuit arrangements for operating light sources in general, i.e. where the type of light source is not relevant
    • H05B47/10Controlling the light source
    • H05B47/16Controlling the light source by timing means
    • YGENERAL 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
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02BCLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO BUILDINGS, e.g. HOUSING, HOUSE APPLIANCES OR RELATED END-USER APPLICATIONS
    • Y02B20/00Energy efficient lighting technologies, e.g. halogen lamps or gas discharge lamps
    • Y02B20/40Control techniques providing energy savings, e.g. smart controller or presence detection

Landscapes

  • Led Devices (AREA)
  • Circuit Arrangement For Electric Light Sources In General (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 multi-color LED lamps, and the PWM pulse signals are controlled to drive the multi-color LED lamps to emit light in turn according to a preset sequence. The driving method of the multicolor LED lamp does not need to enter the interruption timing, but judges the time by judging the overflow of the timer, reduces unnecessary PWM pulse signals to the greatest extent to execute the judgment operation, realizes the effect that the low-cost singlechip can output higher-frequency PWM pulse signals to drive the multicolor LED lamp to generate the color running water effect, and ensures that the frequency of the PWM pulse signals is high enough to reduce the stroboflash.

Description

Intelligent driving method and device for multicolor LED lamp and electronic equipment
Technical Field
The invention relates to the technical field of embedded driving, in particular to an intelligent driving method and device for a multi-color LED lamp and electronic equipment.
Background
The LED lamp timing device is characterized in that a plurality of multicolor LED lamps (such as RGB (red, green, blue) three-color LED lamps) are often used in small household electrical appliances to be turned on in a time-sharing mode to form a colorful flowing water effect, the LED lamps are not turned on normally but are turned on or off according to a certain frequency in the time-sharing lighting process of the multicolor LED lamps, and when the LED on-off frequency (stroboscopic frequency) exceeds 80HZ, the LED off-lamp process cannot be seen by human eyes. And the on and off of the LED lamp is generally driven by a PWM pulse signal. If the frequency of the pulse signal is not high enough, certain ripples can be generated when a high-definition camera of a mobile phone is used for shooting, and the problems of headache, eyestrain, photosensitive epilepsy, vision degradation, distraction and the like can be caused when eyes are exposed in the environment for a long time.
In order to save cost, small household appliances generally use microcontrollers such as a singlechip with lower price and the like to generate PWM pulse signals to drive a multicolor LED lamp, and when the multicolor LED lamp is driven by time-division multiplexing of an I/O port of the singlechip, the driving frequency is usually only hundreds of hertz and can not reach the 3125HZ authentication level measurement standard required by the China LED industry standard. This often leads to stroboscopic problems with multi-color LED lamps.
Disclosure of Invention
In view of this, embodiments of the present invention provide an intelligent driving method and apparatus for a multi-color LED lamp, and an electronic device, so as to solve the problem in the prior art that when a microcontroller is used to drive the multi-color LED lamp, the driving frequency is low, and therefore stroboscopic phenomenon occurs.
In a first aspect, an embodiment of the present invention provides an intelligent driving method for a multi-color LED lamp, in which a microcontroller is used to drive a plurality of multi-color LED lamps, each of the multi-color LED lamps at least includes red, green, and blue light emitting sources, and the method includes:
acquiring the number of the multicolor LED lamps, and recording the number as N, wherein N is a natural number greater than 1;
according to the number of the multi-color LED lamps, determining the overflow time of a timer of the microcontroller and the frequency of a pulse signal output by the microcontroller;
and controlling the pulse signals to drive the N multicolor LED lamps to alternately emit the light source color of any one of red, green or blue according to the overflow time of the timer and the preset sequence.
Preferably, the controlling, according to the timer overflow time, the pulse signal to drive the N multicolor LED lamps at the frequency to alternately emit any one of red, green, and blue light source colors according to a preset sequence includes:
s31: waiting for the timer to overflow by the overflow time;
s32: if the timer overflows, clearing an overflow mark and clearing a watchdog of the timer, and judging whether the overflow frequency of the timer reaches a preset frequency or not; if yes, go to S33; if not, go to S34;
s33: exchanging the high-low value of a register of the microcontroller and switching the light source color of the currently enabled multicolor LED lamp, wherein the register stores the data of the overflow times of the timer;
and S34, returning to S31 after the light source color of the currently enabled multi-color LED lamp is switched.
Preferably, the method further comprises:
after executing S34, before returning to S31, it is detected whether the key is activated, and if the key is detected to be activated, the corresponding operation that the key is activated is executed, and then the process returns to S31.
Preferably, the exchanging the high and low values of the register of the microcontroller and the switching the light source color of the currently enabled multicolor LED lamp comprises:
exchanging the register value at the high position and the register value at the low position in a register of the microcontroller;
judging the light source color of the currently enabled multicolor LED lamp;
if the light source color of the currently enabled multicolor LED lamp is red, switching to green;
if the light source color of the multi-color LED lamp which is enabled at present is green, switching to blue;
if the light source color of the multi-color LED lamp which is enabled currently is blue, the color is switched to red.
Preferably, N said multicolor LED lamps are respectively marked as LEDs1,LED2,LED3……LEDN-1,LEDNThe switch-enabled multi-color LED lamp comprises:
judging a currently enabled multi-color LED lamp;
if the multi-color LED lamp which is currently enabled is an LED1Then switch to LED2
If the multi-color LED lamp which is currently enabled is an LED2Then cutting intoTo LEDs3
And so on;
if the multi-color LED lamp which is currently enabled is an LEDN-1Then switch to LEDN
If the multi-color LED lamp which is currently enabled is an LEDNThen switch to LED1
Preferably, the microcontroller is an OTP single chip, and the phase difference between the PWM pulse signals driving the N multicolor LED lamps is a fixed value.
Preferably, before the microcontroller is used for driving the plurality of multicolor LED lamps, the plurality of multicolor LED lamps are divided into K groups, each group of multicolor LED lamps includes 2 to 8 multicolor LED lamps, where K is a natural number greater than or equal to 2, at least one microcontroller is used for driving a group of multicolor LED lamps, and the multicolor LED lamps in each group are connected in parallel.
Preferably, K sets of said multicolored LED lamps and K said microcontrollers form a multicolored light emitting device, a multicolored light emitting unit being said multicolored light emitting device comprising a set of multicolored LED lamps and a microcontroller, said method further comprising:
collecting images 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 value, J groups of the multicolor LED lamps are turned off, wherein J is a natural number smaller than K;
judging whether the total power consumption is larger than the preset power consumption threshold value again;
if yes, continuing to extinguish the L groups of the multicolor LED lamps until the total power consumption is less than or equal to the preset power consumption threshold, wherein L is a natural number less than or equal to J;
collecting the real-time image of the color light-emitting device when emitting light again;
judging whether the real-time image meets a preset condition or not;
and if the preset condition is not met, any one of the extinguished multi-color LED lamps in the groups of multi-color LED lamps is lightened until the collected image 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 of the multi-color LED lamps at least includes the following light source colors: red, green and blue, the device being controlled by a microcontroller, comprising:
the acquisition module is used for acquiring the number of the multi-color LED lamps and recording the number as N, wherein N is a natural number greater than 1;
the determining module is used for determining the timer overflow time of the microcontroller and the frequency of the pulse signal output by the microcontroller according to the number of the multi-color LED lamps;
and the driving module is used for controlling the pulse signals to drive the N multicolor LED lamps to alternately emit the light source color of any one of red, green or blue according to the frequency and the preset sequence according to the overflow time of the timer.
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 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 the method of the first aspect in the above embodiments.
In conclusion, the beneficial effects of the invention are as follows:
according to the intelligent driving method and device for the multi-color LED lamps and the electronic equipment, the overflow time of the single chip microcomputer is set according to the number of the multi-color LED lamps, and the PWM pulse signals are controlled to drive the multi-color LED lamps to emit light in turn according to the preset sequence. According to the driving method of the multi-color LED lamp, time is judged by judging the overflow of the timer instead of entering the interruption timing, unnecessary PWM pulse signals are reduced as much as possible to execute the judgment operation, the effect that the multi-color LED lamp is driven to generate the color running water effect by adopting the low-cost single chip microcomputer and outputting higher PWM pulse signals is achieved, and the frequency of the PWM pulse signals is ensured to be high enough to reduce stroboflash.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required to be used in the embodiments of the present invention will be briefly described below, and for those skilled in the art, without any creative effort, other drawings may be obtained according to the drawings, and these drawings are all within the protection scope of the present invention.
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 flowchart of step S3 in fig. 1.
Fig. 3 is a schematic diagram of an intelligent driving circuit such as a multi-color 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 illustrating a light emitting effect of a light emitting region of an electronic device according to a first embodiment of the 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 a multicolor LED lamp intelligent driving device 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 objects, technical solutions and advantages of the present invention more apparent, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not to be construed as limiting 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 present invention by illustrating examples of the present invention.
It is noted that, herein, relational terms such as first and second, and the like may be 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. Also, 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 identical elements in a process, method, article, or apparatus that comprises the element.
Example one
In order to ensure that the flowing water effect of the multicolor LED lamp can reduce or inhibit stroboflash and protect eyes as much as possible when a camera shoots, the driving frequency of the multicolor LED lamp needs to be improved as much as possible. In the embodiment, the multi-path PWM pulse signal output is realized by the timed interruption of the single chip microcomputer, namely, the duty ratio value of the PWM pulse signal is changed at a proper time judged by the timing of the interruption function in the program, when the PWM pulse signal is simulated by adopting the interruption function, because the single chip microcomputer needs time for interruption, needs time for calling the interruption function, needs time for entering the interruption function to store the current main cycle execution state value, exits the interruption and reduction main cycle execution state and needs time for returning to the main cycle, if the multi-path PWM calculation and the timed calculation are executed in the interruption function, more time is needed, the frequency of the PWM pulse signal is not too high, the stroboscopic problem is easy to occur, and the problem is easy to occur due to the excessive operation processing amount of the single chip microcomputer caused by a large amount of function calling and calculation, and the service life is influenced.
Taking an OTP single chip as an example, the maximum speed instruction execution speed of a conventional OTP single chip is about 8MHZ, the normal execution time of one instruction is 0.125us (instruction period), one instruction period is needed if one instruction is executed, and two instruction periods (0.25 us is needed) are needed if more than one instruction is executed, and considering the interrupt time of the single chip, the time for saving the current main loop execution state value before interrupt, the time for exiting the interrupt and recovery main loop execution state, and the time for returning to the main loop, the interrupt function is added with the execution of multi-path PWM calculation and timing calculation, etc., and the interrupt can be performed for at least one time after 10us time. When colored light is to be realized and a multicolor LED lamp is needed, at least 10us multiplied by the PWM stage number multiplied by 3(RGB three-color LED lamps are lighted in a time-sharing mode) is the period of the PWM pulse signal (LED driving period), and in order to enable the color flow effect to be smooth, namely, the color does not suddenly change instantly, the PWM stage number of the LED lamp needs at least 15 stages, so that the period of the PWM pulse signal (namely the LED driving period) is at least 450us, and the maximum frequency is not more than 2.2 KHZ. In addition, the single chip microcomputer drives the multicolor LED lamps to sequentially light up the color flow effect, and simultaneously performs other functions such as key scanning (judging whether a key on the device is triggered), timing shutdown and the like (generally, hundreds of microseconds (us) of time is 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 driven LED lamps, the more the number of the instructions in the main program, the longer the interrupt period, the longer the LED driving period, and the lower the driving frequency, even as low as tens of hertz, which cannot achieve the color flow effect at all.
In view of this, the embodiment of the present invention adopts a timing scheme that does not enter into an interrupt, but judges the time by judging the timer overflow flag bit, completes a main cycle within the set overflow time, reduces unnecessary PWM execution judgment as much as possible, selects a period with a small judgment frequency and a large remaining time to execute key scanning, and implements intelligent control methods such as timing shutdown of a multi-color LED lamp for realizing a color flow effect.
Referring to fig. 1, an embodiment of the present invention provides an intelligent driving method for a multi-color LED lamp, including the following steps:
s1: acquiring the number of the multicolor LED lamps, and recording the number as N, wherein N is a natural number; the number of the multicolor LED lamps is not limited, the number of the multicolor LED lamps can be multiple strings of LED lamps, and the number of each string of LED lamps is different from several to hundreds.
S2: determining the timer overflow time of the microcontroller and the frequency of the pulse signal according to the number of the multi-color LED lamps; the method mainly comprises the steps that the number of the multi-color LED lamps is set according to the requirements of a user, the microcontroller automatically determines the overflow time of the timer and the frequency of the pulse signals after obtaining the number of the multi-color LED lamps, the overflow time and the frequency of the pulse signals are dynamically determined based on the change of the number of the multi-color LED lamps, intelligent control is achieved, and a specific determination mode is given later.
S3: and controlling the pulse signals to drive the N multicolor LED lamps to alternately emit the light source color of any one of red, green or blue according to the overflow time of the timer and the 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 signal to drive the multicolor LED lamps to emit light in turn according to a preset sequence. According to the driving method of the multi-color LED lamp, time is judged by judging the overflow of the timer instead of entering the interruption timing, unnecessary PWM pulse signals are reduced as much as possible to execute the judgment operation, the effect that the multi-color LED lamp is driven to generate the color running water effect by adopting the low-cost single chip microcomputer and outputting higher PWM pulse signals is achieved, and the frequency of the PWM pulse signals is ensured to be high enough to reduce stroboflash.
Referring to fig. 2, in step S3, the controlling the pulse signal to drive the N multicolor LED lamps at the frequency according to the timer overflow time to alternately emit any one of red, green, and blue light sources according to a preset sequence further includes:
s31: waiting for the timer to overflow by the overflow time;
s32: if the timer overflows, clearing an overflow mark and emptying a watchdog, and judging whether the overflow frequency of the timer reaches a preset frequency or not; if yes, go to step S33; if not, go to step S34;
s33: exchanging the high-low value of a register of the microcontroller and switching the light source color of the currently enabled multicolor LED lamp, wherein the register stores the data of the overflow times of the timer;
and S34, after the light source color of the multi-color LED lamp which is enabled currently is switched, returning to the step S31 to continue waiting.
Specifically, it is determined whether the currently enabled multi-color LED lamp is switched, and if the switching is completed, the process returns to step S31, and if the switching is not completed, the currently enabled multi-color LED lamp is continuously switched until the switching is completed.
Fig. 3 is a schematic structural diagram of a driving circuit used for implementing the intelligent driving method of the multi-color LED lamp according to an embodiment of the present invention. In the embodiment, 4 multicolor LED Lamps (LEDs) are driven by the OTP singlechip1、LED2、LED3、LED4) The color flow effect is realized, and of course, for convenience of explanation, only 4 multicolor LED lamps are selected, and in practice, three, five, or more than five multicolor LED lamps can be set according to the needs of users, and the number is not required. Wherein, every polychrome LED lamp contains a red light LED lamp pearl, a green glow LED lamp pearl and a blue light LED lamp pearl at least. In FIG. 3, the I/O port (not shown) of the single chip is connected to the ends of R _ LED, G _ LED, B _ LED and LED respectively1、LED2、LED3And an LED4And (4) an end. When the output low level of the I/O port of the singlechip connected with the R _ LED end passes through the resistor R4, the PNP triode Q1 is conducted, and the LED is conducted by the VCC power supply1Middle red light LED anode and connecting LED1Singlechip I/O port of end outputs low level to switch on multicolor LED1At the negative electrode, LED1The red light LED is lighted, and the LED is a multi-color lamp1Emitting red light; when the output low level of the I/O port of the singlechip connected with the G _ LED end passes through the resistor R6, the PNP triode Q3 is conducted, and the VCC power supply conducts the LED1Middle green light LED anode and connection LED1Singlechip I/O port output low level of end switches on LED1Multi-color LED with negative electrode1Green light LED lighting quantity in middle, multi-color lamp LED1Green light emission, sequentially controlling multi-color LED1The blue LED emits blue light … …, when the I/O port of the singlechip connected with the R _ LED end outputs low level, the PNP triode Q1 is conducted through the resistor R4, and the VCC power supply conducts the LED2The anode of the middle red LED and the output low level of the I/O port of the singlechip connected with the LED2 end are connected to turn on the LED2At the negative electrode, LED2The red light LED is lighted, and the LED is colorful2Light emitting deviceRed light … … controls single-chip I/O port to output 7 channels of PWM pulse signals to R _ LED, G _ LED, B _ LED and LED according to a certain time sequence1、LED2、LED3、LED4End, drive LED1、LED2、LED3、LED4Sequentially emitting red light, green light and blue light. R _ LED, G _ LED, B _ LED, and LED1、LED2、LED3、LED4The PWM pulse signal inputted from the port is schematically shown in FIG. 4, and at the beginning of the period, the LED1The blue light LED lamp beads of the LED2 are turned on after the first preset time, the blue light LED lamp beads of the LED1 are turned off after the red light LED lamp beads of the LED2 are turned on for a second preset time, similarly, the red light LED lamp beads of the LED2 are turned on after the first preset time, the yellow light LED lamp beads of the LED3 are turned on, the red light LED lamp beads of the LED2 are turned off after the yellow light LED lamp beads of the LED3 are turned on for a second preset time, and the like, so that a colorful water lamp effect is formed, 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 a PWM (pulse width modulation) driving period (or driving frequency).
The set pulse width is shown in fig. 4 as 150.3us, period 226.04us, duty cycle approximately 66.53%, and frequency up to 4.42 KHz. Compared with the prior art, the frequency can be obviously improved by adopting the scheme of the invention, and is higher than 1 time compared with the maximum frequency of not more than 2.2KHZ in the prior art, 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.42 KHz.
In this embodiment, according to the timer overflow time, controlling the pulse signal to drive the N multicolor LED lamps at the frequency to alternately emit any one of red, green, and blue light source colors according to a preset sequence includes:
s31: and waiting for the single chip timer to overflow according to the set overflow time, wherein the overflow time of the set timer is 5us, and the timer overflows once every 5 us.
S32: if the single chip timer overflows, clearing an overflow mark, and meanwhile judging whether the overflow frequency reaches 15 times (preset PWM (pulse width modulation) stages); if yes, go to step S33; if not, go to step S34;
that is, it is determined whether the overflow frequency reaches 15 times, and if so, the light source color is switched, that is, the light source color is switched every 15 × 5 us.
S33: exchanging the high-low value of a register of the microcontroller and switching the light source color of the currently enabled multicolor LED lamp, wherein the register stores the data of the overflow times of the timer;
illustratively, if the register has 8 bits, and the stored data is the number of timer overflows, when the high-low value of the register of the microcontroller is exchanged, the value stored in the high 4 bits of the register is exchanged with the value stored in the low 4 bits of the register.
And S34, after the light source color of the multi-color LED lamp which is enabled currently is switched, returning to the step S31 to continue waiting.
In a specific embodiment, the switching the currently enabled light source color (for example, R, G, B sequential light emitting) specifically includes:
s331: judging the color of the currently enabled light source;
s332: if the color of the light source which is enabled currently is red (R), switching to green (G);
s333: if the color of the light source which is enabled currently is green (G), switching to blue (B);
s334: if the currently enabled light source color is blue (B), the switch is to red (R).
Please refer to fig. 4 for a specific handover procedure. If the color of the currently enabled light source is switched from red to green, the PWM pulse signal input from the R _ LED terminal is switched from low level to high level, and the PWM pulse signal input from the corresponding G _ LED terminal is switched from high level to low level. If the color of the currently enabled light source is switched from green to blue, the PWM pulse signal input from the G _ LED terminal is switched from low level to high level, and the PWM pulse signal input from the corresponding B _ LED terminal is switched from high level to low level. If the color of the currently enabled light source is switched from blue to red, the PWM pulse signal input from the B _ LED terminal is switched from low level to high level, and the PWM pulse signal input from the corresponding R _ LED terminal is switched from high level to low level.
In another embodiment, after step S332, the method further includes: and timing the light source color switching period. That is, the turn-on times of the RGB three-color light sources are recorded, and when the turn-on times of the RGB three-color light sources reach the preset times, the multicolor LED lamp is turned off (the water flowing effect is turned off). The lighting time of the multicolor LED lamp is obtained by acquiring the number of times that the RGB three-color light sources are lighted in turn, and when the lighting time is greater than a preset threshold (such as 20 minutes), the multicolor LED lamp is turned off, so that the aim of saving electricity is fulfilled.
Preferably, the switching multicolor LED lamp includes:
s341: judging a currently enabled multi-color LED lamp;
s342: if the LED lamp which is currently enabled is an LED1Then switch to LED2
S343: if the LED lamp which is currently enabled is an LED2Then switch to LED3
S344: if the LED lamp which is currently enabled is an LED3Then switch to LED4
S345: if the LED lamp which is currently enabled is an LED4Then switch to LED1
Referring to FIG. 4, in a specific switching process, if the currently enabled LED is an LED1Switch to LED2Then LED1The PWM pulse signal of the end input is converted from low level to high level, and the corresponding LED2The PWM pulse signal input from the terminal is converted from high level to low level. If the currently enabled light source color is by LED2Switch to LED3Then LED2The PWM pulse signal of the end input is converted from low level to high level, and the corresponding LED3The PWM pulse signal input from the terminal is converted from high level to low level. Analogizing in turn to realize that 4 multicolor LED lamps are arranged according to the LED1-LED2-LED3-LED4-LED1…LED4The lighting sequence of (1) is cyclically switched. In the present embodiment, for driving LEDs1、LED2、LED3、LED4The phase difference of the 4 paths of PWM pulse signals is a fixed value, thereby ensuring that the PWM pulse signals are stableThe two PWM pulse signals cannot switch high and low levels at the same time.
In the above embodiment, the LED lamp is switched from low level to high level every time to overflow, and every time the LED is detected1Or LED2Or LED3Or LED4When the overflow time is 256 times, the process is delayed by 10us and then returns to step S31 to wait for the overflow of the one-chip timer 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 a 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 it can respond to user input in real time.
In this embodiment, the overflow time of the one-chip timer is set to 5us, that is, the one-chip timer 5us overflows once, and in addition, the period of the PWM pulse signal can be calculated according to the following formula:
TP ═ T × K × M; wherein TP represents the PWM pulse signal period, T represents the timer overflow time, K represents the preset PWM stage number, and M represents the LED color number. After the period of the PWM pulse signal is obtained, the frequency of the PWM pulse signal is correspondingly known.
In the present embodiment, the PWM pulse signal period TP is 5us × 15 × 3us 225us, where 15 is a preset PWM number (in order to make the water flowing effect smoother, i.e., the color change cannot appear abrupt change, the PWM number needs at least 15), and 3 is three colors of RGB. Because the instruction execution cycle of the singlechip is 0.125us, 40 instruction cycles can be executed within 5us, and the control of 7-channel scanning PWM pulse signals can be realized by 40 instruction cycles. The PWM pulse signal frequency obtained according to the PWM pulse signal cycle time is 4.4KHZ and is larger than the national industry standard of 3.15KHZ, meanwhile, stroboflash can be greatly reduced, a camera is adopted for shooting, light and dark stripes cannot appear, when the multicolor LED lamp generates a colorful running water effect and serves as an ornamental and shooting target, the user camera cannot shoot the interrupted and jittered light and dark stripes, and the user shooting landscape experience is improved.
In one embodiment, the microcontroller is an OTP single chip, and the OTP is a memory type of the single chip, which means that the OTP single chip is one-time programmable, and after the program is burned into the single chip, the OTP single chip cannot be changed and cleared again, which can save the cost.
Application examples
The intelligent control method of the multicolor LED lamp is applied to the light-emitting device, the multicolor LED lamp is installed on electronic equipment or an outdoor light source device, and the camera shoots the colorful light-emitting device which is composed of a plurality of groups of multicolor LED lamps and displays the colorful running 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 shooting result is shown in fig. 5, after the color light emitting device is started, a color lighting effect similar to the flowing water change appears in the circular ring-shaped light emitting region 2 of the electronic device 1 in fig. 5, and when an image collecting device such as a camera is used, the color flowing water effect is stable and smooth, stroboflash cannot occur, and discontinuous and jittered light and dark stripes cannot be shot.
The electronic device shown in fig. 5 includes 4 multicolor LED lamps and a single chip microcomputer for driving the multicolor LED lamps, and the 4 multicolor LED lamps plus the single chip microcomputer define a light-emitting unit, and in another embodiment, the color light-emitting device may also be composed of a plurality of the above light-emitting units, and exemplarily, the color light-emitting device is composed of 2 light-emitting units, i.e., 8 multicolor LED lamps, and two single chip microcomputers, wherein one single chip microcomputer drives the 4 multicolor LED lamps. The multicolor LED lamps of the two light-emitting units are arranged at intervals when being placed, and the four multicolor LEDs of the first light-emitting unit are respectively recorded as follows: LED (light emitting diode)11、LED12、LED13、LED14The four multi-color LEDs of the second light-emitting unit are respectively written as: LED (light emitting diode)21、LED22、LED23、LED24Push-button LED11-LED21-LED12-LED22-LED13-LED23-LED14-LED24-LED11…LED24The lighting sequence of (1) is cyclically switched. A greater number of multi-color LED lamps may be providedThe better color flow effect of effect is realized, and even a certain multicolor LED in first luminescence unit or second luminescence unit is damaged, its color flow effect also can not receive too big influence, in addition, uses low price's singlechip as a plurality of multicolor LED lamps of microcontroller drive, can effectively save electronic equipment's cost and improve the visual effect of product, is favorable to improving electronic equipment's user experience. It is only exemplarily stated here that the color light-emitting device includes two light-emitting units each including 4 multi-color LED lamps, and in practice, a plurality of the multi-color LED lamps may be provided as needed, and the number of each multi-color LED lamp is between 2 and 8.
Further, in order to achieve the color light effect of the flowing water change and use image acquisition devices such as cameras, the color flowing water effect is stable and smooth, stroboflash cannot occur, intermittent and jittering light and dark stripes cannot be shot, a plurality of light emitting units (namely, a plurality of groups of multicolor LED lamps) can be selected to be simultaneously lightened at first, but the simultaneous lightening of the plurality of groups of multicolor LED lamps can certainly cause larger energy loss of the color light emitting devices and even the whole electronic device, and the power consumption is larger. In order to reduce the power consumption of the whole electronic device, the power consumption of the color light-emitting device needs to be reduced by turning off a few of multicolor LED lamps, but simultaneously, in order to meet the visual effect, the number of groups of the lightened multicolor LED lamps or the number of the multicolor LED lamps needs to be intelligently selected. Therefore, the invention is further improved and perfected, the intelligent control is realized on the color light-emitting device, and a plurality of groups of multicolor LED lamps or a plurality of multicolor LED lamps in the plurality of groups of multicolor LED lamps are intelligently selected to be lighted according to a preset condition and a preset power consumption threshold value. The preset conditions here may be: when the color light-emitting device displays the color flow effect and is collected by using image collecting equipment such as a camera, the collected image of the color light-emitting device is subjected to image analysis processing to obtain light and shade stripes which are not discontinuous and jittered in the image, and the preset power consumption threshold value can be set according to the practical application condition without limitation. The specific intelligent driving method of the multicolor LED lamp further comprises the following steps:
collecting images 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 value, J groups of the multicolor LED lamps are turned off, wherein J is a natural number smaller than K;
judging whether the total power consumption is larger than the preset power consumption threshold value again;
if yes, continuing to extinguish the L groups of the multicolor LED lamps until the total power consumption is less than or equal to the preset power consumption threshold, wherein L is a natural number less than or equal to J;
collecting the real-time image of the color light-emitting device when emitting light again;
judging whether the real-time image meets a preset condition or not;
and if the preset condition is not met, any one of the extinguished multi-color LED lamps in the groups of multi-color LED lamps is lightened until the collected image when the color light-emitting device emits light meets the preset condition. In the present embodiment, the number of groups of multi-color LED lamps satisfying that the total power consumption of the color light-emitting device satisfies not more than the preset power consumption threshold is first determined, but the light-emitting effect does not necessarily satisfy the preset condition at this time, and therefore, any one of the groups of multi-color 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 lightened color light-emitting device is considered to reach the optimal light-emitting effect and the power consumption balance state, the smooth color water flow effect is displayed, meanwhile, the power consumption is low, the power consumption of the whole electronic equipment is reduced, and meanwhile, the visual effect and the user experience of the electronic equipment can be improved.
Further, when the number of the multi-color LED lamps of one light emitting unit is different from that of another light emitting unit (it may be that the LED lamps of one light emitting unit are failed or damaged), for example, the number of the multi-color LED lamps in the first light emitting unit is 5, and the number of the multi-color LED lamps in the second light emitting unit is 6, at this time, the multi-color LED lamps according to the method of the present invention have a problem of inconsistent frequency, which may cause a problem of contrast of the effect when the color flow display effect is integrally formed, and the color flow effect of the first light emitting unit with high frequency is better than the flow display effect of the second light emitting unit with low frequency, thus bringing a bad experience to the user.
It is therefore necessary to adjust the frequency of either or both of the two 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 different, 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
The method specifically comprises the following steps:
respectively acquiring PMW pulse frequencies of the P light-emitting units, and respectively recording the PMW pulse frequencies as a first frequency value, a second frequency value, … … and a P frequency value;
acquiring the minimum value of 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 microcontroller of each light-emitting unit according to the basic overflow time value, so that the first frequency value, the second frequency value, … … and the Pth frequency value are equal to the reference frequency value.
Exemplarily, the PWM pulse frequency for driving 5 multicolor LED lamps in the first light emitting unit is obtained as 4.1KHZ, the PWM pulse frequency for driving 6 multicolor LED lamps in the second light emitting unit is obtained as 3.8KHZ, and 3.8KHZ is used as a reference frequency value, according to the above formula: after the period of the PWM pulse signal is obtained, the frequency of the PWM pulse signal is accordingly known, and the corresponding overflow time can be obtained. In this example, if M is 3 and K is 15, TP is the reciprocal of 3.2KHZ, the final count results in a reference overflow time value of 5.8us, the original overflow time of the first light-emitting unit is 5.4us, 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 not changed, so that the PWM pulse driving frequency of the first light-emitting unit and the PWM pulse driving frequency of the second light-emitting unit are finally obtained to be consistent. Thereby avoid when a plurality of polychrome LED lamps have the inconsistent problem of frequency and lead to the inconsistent problem of each colored flowing water effect for each luminescence unit's flowing water effect is unanimous, guarantees that holistic flowing water effect is smooth unanimous, promotes user experience.
Example two
In this embodiment, 8 three-color LED lamps are used to realize the flow effect, and the specific implementation steps are similar to those in the above embodiments and are not described herein again. In this embodiment, the overflow time of the timer of the single chip microcomputer is set to 7us, 56 instruction cycles can be executed within 7us, and the control of the 11-path scanning PWM pulse signal is realized through 56 instruction cycles. The frequency of the PWM pulse signal is 3.15KHZ according to the period time of the PWM pulse signal, namely the singlechip timer 7us overflows once, the period TP of the PWM pulse signal is 7us multiplied by 15 multiplied by 3 is 315us, wherein 15 is the set PWM stage number, and 3 is three colors of RGB. The PWM pulse signal frequency is about 3.15KHZ, meets the regulation of national industry standard 3.15KHZ, and can greatly reduce the light and dark stripes generated by stroboflash shot by a camera. That is, in the intelligent driving method of the multicolor LED lamp of the present invention, preferably, the multicolor LED lamp has three colors of RGB, and the number of the multicolor LED lamps is between 2 and 8. Of course, each color of LED lamp beads in each multi-color LED lamp can be multiple, and the LED lamp beads in the same color can be connected in series or in parallel, but need to be turned on or off simultaneously.
In summary, according to the intelligent driving method for the multi-color LED lamps provided by the embodiments of the present invention, the overflow time of the single chip microcomputer is set according to the number of the multi-color LED lamps, the PWM pulse signal is controlled to drive the plurality of multi-color LED lamps to emit light in turn according to the preset sequence with a frequency, and meanwhile, the frequency of the PWM pulse signal is ensured to be high enough to reduce stroboflash. According to the intelligent driving method for the multicolor LED lamp, interruption timing is not needed, time is judged by judging the overflow of the timer, a main cycle is completed within the set overflow time, unnecessary PWM pulse signals are reduced as much as possible to execute judgment operation, and meanwhile, the PWM pulse signal period with less judgment operation times and more residual time is selected to execute intelligent control such as key scanning and timing closing of the water flowing lamp, so that the functions of key scanning, timing of the water flowing lamp and the like are realized while the multicolor LED lamp is intelligently driven by adopting a low-cost single chip microcomputer to generate a water flowing effect.
EXAMPLE III
Referring to fig. 6, an embodiment of the present invention provides an intelligent driving apparatus 200 for a multi-color LED lamp, where the apparatus 200 includes:
the acquiring module 201 is configured to acquire the number of the multicolor LED lamps, which is denoted as N, where N is a natural number;
a determining module 202, configured to determine, according to the number of the multi-color LED lamps, a timer overflow time of the microcontroller and a frequency of the pulse signal;
and the driving module 203 is configured to control the pulse signal to drive the N multicolor LED lamps to alternately emit any one of red, green, or blue light sources according to a preset sequence according to the timer overflow time.
Preferably, the driving module 203 further comprises:
an overflow waiting unit for waiting for the timer to overflow according to the overflow time;
the first circulating unit is used for clearing an overflow mark and clearing a watchdog of the timer if the timer overflows, and judging whether the overflow frequency of the timer reaches a preset frequency or not; (ii) a 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 the high-low value of a register of the microcontroller and switching the light source color of the currently enabled multicolor LED lamp, wherein the register stores the data of the overflow times of the timer;
and the second circulating unit is used for returning to the step of the overflow waiting unit after the light source color of the currently enabled multi-color LED lamp is switched.
Preferably, the first circulation unit further comprises:
the switching module is used for switching the high-low value of the register of the microcontroller;
a first judgment unit for judging the currently enabled light source color;
the first light source color switching unit is used for switching to green if the color of the currently enabled light source is red;
the second light source color switching unit is used for switching the current enabled light source color to blue if the current enabled light source color is green;
and the second light source color switching unit is used for switching to red if the color of the currently enabled light source is blue.
Preferably, the second circulation unit further comprises:
the second judgment unit is used for judging the currently enabled LED lamp;
a first LED switching unit for switching the LED lamp if the current LED lamp is LED1Then switch to LED2
A second LED switching unit for switching the LED lamp if the LED lamp is currently enabled2Then switch to LED3
By analogy in the following way,
an N-1LED switching unit for enabling the LED lamp to be LEDN-1Then switch to LEDN
An Nth LED switching unit for enabling the LED lamp to be LED if the LED lamp is currently enabledNThen switch to LED1
In summary, the intelligent driving device for multi-color LED lamps provided in the embodiments of the present invention sets the overflow time of the single chip according to the number of multi-color LED lamps, controls the PWM pulse signal to intelligently drive the plurality of multi-color LED lamps to emit light in turn according to the preset sequence, and simultaneously ensures that the frequency of the PWM pulse signal is high enough to reduce the stroboflash. The driving method of the multicolor LED lamp does not need to enter interrupt timing, but judges the time by judging the overflow of the timer, finishes a main cycle within the set overflow time, reduces unnecessary PWM pulse signals to the greatest extent to execute judgment operation, selects the PWM pulse signal period with less judgment operation times and more residual time to execute intelligent control such as key scanning, timing closing of a water flowing lamp and the like, and realizes the functions of key scanning, timing of the water flowing lamp and the like while adopting a low-cost singlechip to drive the multicolor LED lamp to generate a water flowing effect.
Example four
In addition, the multi-color LED lamp driving method according to the embodiment of the present invention may be implemented by the electronic device shown in fig. 7. Fig. 7 is a schematic diagram illustrating a 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 in which computer program instructions are stored.
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 implementing 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 include a Hard Disk Drive (HDD), floppy Disk Drive, flash memory, optical Disk, magneto-optical Disk, tape, or Universal Serial Bus (USB) Drive or a combination of two or more of these. Memory 302 may include removable or non-removable (or fixed) media, where appropriate. The 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 a particular embodiment, the memory 302 includes Read Only Memory (ROM). Where appropriate, 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.
The processor 301 reads and executes the computer program instructions stored in the memory 302 to implement any one of the above-described intelligent driving methods for the multicolor LED lamp.
In one example, the electronic device can 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 via a bus 310 to complete communication therebetween.
The communication interface 303 is mainly used for implementing communication between modules, apparatuses, units and/or devices in the embodiment of the present invention.
Bus 310 includes hardware, software, or both to couple the components of the image packet printing device to each other. 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 Hyper Transport (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 these. Bus 310 may include one or more buses, where appropriate. Although specific buses have been described and shown in the embodiments of the invention, any suitable buses or interconnects are contemplated by the invention.
EXAMPLE five
In addition, in combination with the intelligent driving method for the multi-color LED lamp in the foregoing embodiments, the embodiments of the present invention may be implemented by providing a computer-readable storage medium. The computer readable storage medium having stored thereon computer program instructions; the computer program instructions, when executed by the processor 301, implement any one of the intelligent multi-color LED lamp driving methods in the above embodiments.
In summary, the intelligent driving method, apparatus, device and storage medium for multi-color LED lamps provided in the embodiments of the present invention set the overflow time of the single chip according to the number of multi-color LED lamps, control the PWM pulse signal to intelligently drive a plurality of multi-color LED lamps to emit light in turn according to the preset sequence, and simultaneously ensure that the frequency of the PWM pulse signal is high enough to reduce the stroboflash. The driving method of the multicolor LED lamp does not need to enter interrupt timing, but judges the time by judging the overflow of the timer, finishes a main cycle within the set overflow time, reduces unnecessary PWM to execute judgment as much as possible, selects a period with less judgment times and more residual time to execute key scanning, and intelligently controls the timing closing of the multicolor LED lamp, and the like, thereby realizing the functions of key scanning, timing of the multicolor water flowing lamp and the like while intelligently driving the multicolor LED lamp to generate the color water flowing effect by adopting a low-cost singlechip.
It is to be understood that the invention is not limited to the specific arrangements and instrumentality described above and shown in the drawings. A detailed description of known methods is omitted herein for the sake of brevity. In the above embodiments, several specific steps are described and shown as examples. However, the method processes of the present invention are not limited to the specific steps described and illustrated, and those skilled in the art can make various changes, modifications and additions or change the order between the steps after comprehending the spirit of the present invention.
The functional blocks shown in the above-described structural block diagrams may be implemented as 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, plug-in, 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 by a data signal carried in a carrier wave over a transmission medium or a communication link. A "machine-readable medium" may include any medium that can store or transfer information. Examples of a machine-readable medium include electronic circuits, 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 so forth. The code segments may be downloaded via computer networks such as the internet, intranet, etc.
It should also be noted that the exemplary embodiments mentioned in this patent describe some methods or systems based on a series of steps or devices. However, 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, may be performed in an order different from the order in the embodiments, or may be performed simultaneously.
As described above, only the specific embodiments of the present invention are provided, and it can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the system, the module and the unit described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again. It should be understood that the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive various equivalent modifications or substitutions within the technical scope of the present invention, and these modifications or substitutions should be covered within the scope of the present invention.

Claims (10)

1. The intelligent driving method of the multicolor LED lamp is characterized in that a microcontroller is adopted to drive a plurality of multicolor LED lamps, 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 recording the number as N, wherein N is a natural number greater than 1;
according to the number of the multi-color LED lamps, determining the overflow time of a timer of the microcontroller and the frequency of a pulse signal output by the microcontroller;
and controlling the pulse signals to drive the N multicolor LED lamps to alternately emit the light source color of any one of red, green or blue according to the overflow time of the timer and the preset sequence.
2. The intelligent driving method for multi-color LED lamps according to claim 1, wherein the controlling the pulse signals to drive N multi-color LED lamps at the frequency to alternately emit any one of red, green or blue light source colors according to the timer overflow time comprises:
s31: waiting for the timer to overflow by the overflow time;
s32: if the timer overflows, clearing an overflow mark and clearing a watchdog of the timer, and judging whether the overflow frequency of the timer reaches a preset frequency or not; if yes, go to S33; if not, go to S34;
s33: exchanging the high-low value of a register of the microcontroller and switching the light source color of the currently enabled multicolor LED lamp, wherein the register stores the data of the overflow times of the timer;
and S34, returning to S31 after the light source color of the currently enabled multi-color LED lamp is switched.
3. The intelligent driving method of a multicolor LED lamp according to claim 2, further comprising:
after executing S34, before returning to S31, it is detected whether the key is activated, and if the key is detected to be activated, the corresponding operation that the key is activated is executed, and then the process returns to S31.
4. The intelligent driving method for multi-color LED lamps according to claim 2, wherein the exchanging the high and low values of the registers of the microcontroller and switching the light source color of the currently enabled multi-color LED lamp comprises:
exchanging the register value at the high position and the register value at the low position in a register of the microcontroller;
judging the light source color of the currently enabled multicolor LED lamp;
if the light source color of the currently enabled multicolor LED lamp is red, switching to green;
if the light source color of the multi-color LED lamp which is enabled at present is green, switching to blue;
if the light source color of the multi-color LED lamp which is enabled currently is blue, the color is switched to red.
5. The intelligent driving method for multi-color LED lamps according to claim 2, wherein N multi-color LED lamps are respectively marked as LEDs1,LED2,LED3……LEDN-1,LEDNThe switch-enabled multi-color LED lamp comprises:
judging a currently enabled multi-color LED lamp;
if the multi-color LED lamp which is currently enabled is an LED1Then switch to LED2
If the multi-color LED lamp which is currently enabled is an LED2Then switch to LED3
And so on;
if the multi-color LED lamp which is currently enabled is an LEDN-1Then switch to LEDN
If the multi-color LED lamp which is currently enabled is an LEDNThen switch to LED1
6. The intelligent driving method for the multi-color LED lamp according to claim 1, wherein the microcontroller is an OTP (one time programmable) single chip microcomputer, and the phase difference between PWM (pulse width modulation) pulse signals for driving the N multi-color LED lamps is a fixed value.
7. The intelligent driving method for multi-color LED lamps according to any one of claims 1 to 6, wherein before the driving of the multi-color LED lamps by the microcontroller, 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 greater than or equal to 2, at least one microcontroller is used for driving a group of multi-color LED lamps, and the multi-color LED lamps in each group are connected in parallel.
8. The intelligent driving method for multi-color LED lamps according to claim 7, wherein K groups of said multi-color LED lamps and K said microcontrollers constitute a color light emitting device, and a color light emitting unit being said color light emitting device comprises a group of multi-color LED lamps and a microcontroller, the method further comprising:
collecting images 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 value, J groups of the multicolor LED lamps are turned off, wherein J is a natural number smaller than K;
judging whether the total power consumption is larger than the preset power consumption threshold value again;
if yes, continuing to extinguish the L groups of the multicolor LED lamps until the total power consumption is less than or equal to the preset power consumption threshold, wherein L is a natural number less than or equal to J;
collecting the real-time image of the color light-emitting device when emitting light again;
judging whether the real-time image meets a preset condition or not;
and if the preset condition is not met, any one of the extinguished multi-color LED lamps in the groups of multi-color LED lamps is lightened until the image acquired when the color light-emitting device emits light meets the preset condition.
9. 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 driving device is controlled by a microcontroller, and comprises:
the acquisition module is used for acquiring the number of the multi-color LED lamps and recording the number as N, wherein N is a natural number greater than 1;
the determining module is used for determining the timer overflow time of the microcontroller and the frequency of the pulse signal output by the microcontroller according to the number of the multi-color LED lamps;
and the driving module is used for controlling the pulse signals to drive the N multicolor LED lamps to alternately emit the light source color of any one of red, green or blue according to the frequency and the preset sequence according to the overflow time of the timer.
10. 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-8.
CN202110877197.7A 2021-07-31 2021-07-31 Intelligent driving method and device for multicolor LED lamp and electronic equipment Active CN113543410B (en)

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 true CN113543410A (en) 2021-10-22
CN113543410B 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)

* Cited by examiner, † Cited by third party
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

Patent Citations (7)

* Cited by examiner, † Cited by third party
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)

* Cited by examiner, † Cited by third party
Title
吴金华;: "一种多光谱亮度可调的LED光照系统", 照明工程学报, no. 03 *

Also Published As

Publication number Publication date
CN113543410B (en) 2024-05-28

Similar Documents

Publication Publication Date Title
US6285140B1 (en) Variable-effect lighting system
EP2036406B1 (en) Method and device for driving an array of light sources
EP2140733B1 (en) Lighting device with a led used for sensing
EP2814022A1 (en) Address code writing method and system for led display device
CN113141690A (en) Single-point controllable light-emitting device and system
JP4416636B2 (en) LED lighting control device
CN106455233A (en) Breathing light control circuit
CN113543410A (en) Intelligent driving method and device for multicolor LED lamp and electronic equipment
CN105120565A (en) Linear constant current driving device capable of automatically balancing lamp string brightness and driving method of linear constant current driving device
WO2014127554A1 (en) Led lamp controller, led lamp and drive method for led lamp
US8963435B2 (en) Light emitting system and light emitting instruction apparatus
CN209949472U (en) LED lamp dimming system
CN106793249B (en) A kind of efficient LED driving power source system
JP2008210887A (en) Led control system
CN106817805A (en) Indicate lamp control method and device
CN103634986A (en) Multipath dimming device and dimming method thereof
CN109275220B (en) LED lamp control method, device, control device and computer readable storage medium
CN204906821U (en) Automatic linear constant current drive device and LED lamps and lanterns of balanced lamp cross luma degree
CN206542592U (en) Breath light control circuit
CN106793248B (en) A kind of LED energy conservation driving method
CN116234104B (en) LED lamp bead circuit and LED lamp
KR101616014B1 (en) Visible light communication apparatus and communication method of the same
CN208158949U (en) A kind of lamp group circuit, light bar and luminescence component
CN209824087U (en) Single IO port control circuit of two LED lamps with different colors
KR100825480B1 (en) Control device and method of led module for advertised sign board

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