1. Introduction
As people need colored lights for house decoration, colored neon lights can be seen in many cities. LED colored lights have been widely used due to their rich light colors, low cost and simple control. It has become a fashion to use colored lights to decorate streets and urban buildings. However, most of the various LED colored light controllers on the market are implemented with full hardware circuits, which have the disadvantages of complex circuit structure, complex circuit, large power loss, etc. In addition, from the perspective of functional effects, there are few lighting modes and the style is monotonous, which lacks user operability.
The global warming crisis and energy shortage are further promoting the popularization of LED lighting. LED lighting is environmentally friendly, has high light efficiency and long life, but in completely replacing incandescent lamps with wall-mounted dimmers, LED lighting still has the inherent disadvantage of poor compatibility. The main reasons are:
1) Existing dimmers are designed for incandescent lamps, which are purely resistive. As a solid-state semiconductor lighting device, LED requires a constant DC current drive, so LED lighting generally requires a driver to convert from AC 110V/220V to the required DC current.
2) There are many types of dimmers, and their working principles are different, including front-cut type, rear-cut type and intelligent type;
3) There are many types of LED lighting. As a result, different types of dimmers are matched to different LED lighting; LED drivers face huge challenges; among them, reliability and safety are particularly important. Lighting is a consumer electronic product that directly contacts consumers in thousands of households. Not only should the price be appropriate, but more importantly, it should be safe and reliable; even if any component fails or the dimmer does not match the LED, it cannot cause any safety failures such as leakage, overheating, overcurrent, etc.
2. Hardware Design
The single-chip microcomputer controls three groups of small lights to light up in sequence according to the single color. It can also control the output voltage by changing the duty cycle of the output pulse to control the lighting of the color LED, realizing the multi-color LED gradient lighting function, so that the three-color lights can emit multiple colors. The single-chip microcomputer controls a certain pin of the P1 port to output high and low levels according to regulations. When the high level is output, the ULN2003 outputs a low level, which is reversed to a high level by the ULN2003, so that the driving transistor is cut off and the LED cannot be lit. The three small lights of each color are controlled by a pin of the P1 port of the single-chip microcomputer chip to realize their sequential lighting and color gradient and color mutation functions.
Figure 1 LED dimming principle block diagram
Figure 2 LED light emitting element circuit diagram
3. Software Design
Figure 3 MCU control LED dimming circuit flow chart
4. Programming
#include
sbit LED1=P1^0;
sbit LED=P1^1;
sbit LED2=P1^2;
unsigned char CYCLE;
unsigned char PWM_ON;
void delay (unsigned int cnt)
{
while(--cnt);
}
main()
{ bit flag;
TMOD=0x01;
TH0 = (65536-100)/256;
TL0 = (65536-100)%256;
IE=0x82;
TR0=1;
CYCLE=50;
while(!flag)
{ delay(20000);
PWM_ON++;
if (PWM_ON == CYCLE)
{ flag=1;
}
}
while(flag)
{ delay(20000);
PWM_ON--;
if (PWM_ON == 0)
{ flag=0;
}
}
}
void time (void) interrupt 1
{ STatic unsigned char count;
TH0 = (65536-100)/256;
TL0 = (65536-100)%256;
if (count == PWM_ON)
{ LED1=1;
LED=1;
LED2=1;
}
count++;
if (count == CYCLE)
{ count=0;
if (PWM_ON!=0)
LED1=0;
LED = 0;
LED2=0;
}}
*
Previous article:Dedicated LED lighting driver using digital power control technology
Next article:Single-stage flyback power supply design for LED lighting applications
- MathWorks and NXP Collaborate to Launch Model-Based Design Toolbox for Battery Management Systems
- STMicroelectronics' advanced galvanically isolated gate driver STGAP3S provides flexible protection for IGBTs and SiC MOSFETs
- New diaphragm-free solid-state lithium battery technology is launched: the distance between the positive and negative electrodes is less than 0.000001 meters
- [“Source” Observe the Autumn Series] Application and testing of the next generation of semiconductor gallium oxide device photodetectors
- 采用自主设计封装,绝缘电阻显著提高!ROHM开发出更高电压xEV系统的SiC肖特基势垒二极管
- Will GaN replace SiC? PI's disruptive 1700V InnoMux2 is here to demonstrate
- From Isolation to the Third and a Half Generation: Understanding Naxinwei's Gate Driver IC in One Article
- The appeal of 48 V technology: importance, benefits and key factors in system-level applications
- Important breakthrough in recycling of used lithium-ion batteries
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Share a book about Cortex M3 core
- msp430 MCU AD conversion
- Fudan Micro FM33LC046N Evaluation + ADC Collection Alarm
- MSP430FR235x-based pulse oximeter system solution
- CCS compilation error: Solution for missing header file
- LWIP uses UDP to send data continuously
- It was very popular in the past, and now it is back, how should this button position be designed?
- Implementing USB source code with Verilog (FPGA)
- How good is Hangshun's chip? Let's see if Huawei 5G uses its chip
- ESP-USB-Bridge turns the ESP32-S2/S3 development board into a JTAG debugger, and cooperates with OpenOCD to debug STM32 and other chips