Design and implementation of LED driver based on I2C interface

Publisher:落寞梦惊Latest update time:2011-01-26 Keywords:I2C Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
LED is undoubtedly the hottest application at present. Whether it is handheld devices, game consoles, neon lights , billboards, etc., the dazzling colors and high-quality light can always attract people's attention at the first time. In front of the current numerous LED controllers, how to choose a product with rich functions and high cost performance to cater to your own design is undoubtedly a problem facing every designer.

We can use ordinary I/O to realize the simplest LED driver . However, I/O control can only realize the ON and OFF of LED, and cannot be used for light mixing, flashing and other functions. Moreover, each LED needs to occupy a separate I/O resource, which is undoubtedly very cost-effective. We can also use a dedicated high-current LED controller to design, but the high cost will first become a problem, and the design is complicated, and the degree will increase accordingly with the emergence of various interferences. Based on this, NXP has launched a series of LED drivers using the I2C interface . It can control the ON/OFF, flashing and RGB mixing of 4 to 24 LEDs at the same time through the two lines of the I2C interface. In the light mixing solution, each LED is driven by an independent 8bit/256-step PWM. At present, the current range of each LED that can be driven by the chip itself is between 25mA and 100mA. Of course, for some high-current applications, we only need to use an external field effect tube to achieve it.

This I2C-based LED control method increases the convenience and flexibility of design, and also reduces the investment in software and hardware, making the mysterious LED suddenly simple and wonderful to us. Below, we will take the NXP LED driver PCA9633 as an example to fully explain the advantages of this LED driver through several simple applications.

The PCA9633 is a quad-channel LED driver capable of driving a maximum current of 25mA per channel and provides a selectable fixed I2C address and a 4-bit or 7-bit hardware programmable hardware address, depending on the package (Figure 1).


From Figure 1, we can see that each LED is controlled by a separate 8-bit/256-step PWM, and because PWM is fast enough, it can theoretically mix any color of light through the four LEDs it drives. In addition to each separate PWM, PCA9633 also provides a Group PWM, through which we can control the brightness and frequency of the mixed color light, making up for some functions that cannot be achieved by adjusting a single PWM. So how does PCA9633 achieve dimming? The secret lies in PWM. If PWM is not used, it can only complete the on and off actions; low-speed PWM can only achieve LED flashing, which is not enough to achieve the purpose of color mixing; high-speed PWM can achieve RGB color mixing; if the PWM speed is controllable, then the dual functions of flashing and color mixing can be achieved. Moreover, through the controllable 8-bit/256-step PWM, the color level is increased and the sense of color hierarchy is improved (see Figure 2).


Now that we know the principle of color mixing, how is a specific color produced? We know that the human eye's perception of color is the superposition of the average brightness of various colors. We can control the brightness of the driven LED by controlling the duty cycle of each PWM of PCA9633. According to the principle of three primary colors, if we drive RGB (or RGBA) LEDs, we can get the desired color by adjusting the different brightness of these three LEDs. Figure 3 is an example of PCA9633 controlling three RGB LEDs to adjust pink light.


[page]

Through the above description, we basically know the internal structure and driving principle of PCA9633. Next, we will use several applications of PCA9633 fixed I2C address to further understand the advantages of this LED controller.

In the first application, we will use PCA9633 to control the brightness bar. As we know, applications like brightness bar usually require a large number of LEDs connected in series. If a single interface is used to control each LED, the cost and software complexity will be greatly increased. However, through I2C, only two control lines are needed in hardware, and only one byte command is needed in software to easily control it. In addition, due to the uniqueness of the I2C device address, several PCA9633s can be used for control according to the number of driven LEDs. If the actual application does not have enough driving current of PCA9633 itself, it can be easily solved by adding a FET on the periphery. In addition, the unique Group PWM of PCA9633 makes it easy to control the light intensity and flicker of the entire brightness bar. The following is its schematic diagram (see Figure 4), in which the I2C master is provided by the system, which can be an MCU or a logic circuit .


The left half of Figure 4 is the I2C master, which will not be described in detail. The top right is the LED current limiting resistor . Usually the forward voltage of the LED is about 3V, which may vary depending on the color and manufacturing process. We can calculate the value of this current limiting resistor by the required LED current: R=(Vsupply-Vfsum)/If. If the required LED current is greater than 25mA, the FET added in the figure can easily solve this problem. After we add the FET, we only need to set the OUTDRV of the corresponding register of PCA9633 to high to distinguish it from its default value. Now we can see that the schematic diagram is quite simple to control so many LEDs with PCA9633, and it is also convenient to set the registers in the software. PCA9633 provides simple and complete internal registers, such as LED output structure setting, power saving mode setting, chip enable mode setting, LED output state setting, and control register setting for each PWM and Group PWM. In addition, PCA9633 also provides a register setting increment bit, that is, if we set this bit, we can complete the sequential configuration of all internal registers through a command sequence, which is very useful in some specific applications and can save software and system resources to the greatest extent. Below, we will use another example to illustrate the setting of internal registers.

The second example is that we use PCA9633 to complete the function of breathing light. Although PCA9633 does not have a breathing light module inside, we can achieve this function through some simple register settings, which undoubtedly has a great advantage in cost compared to dedicated breathing light chips. For the sake of convenience, we only use PCA9633 to control the breathing action of an LED. The schematic diagram is very simple and is omitted here. The purpose of breathing is achieved by controlling the gradual brightening and dimming process of this LED. To achieve this function, the independent PWM of PCA9633 will be the most important factor. As we have mentioned before, each LED is controlled by an 8bit/256-step PWM, which means that each light has 256 adjustable brightness levels, which can perfectly realize the breathing function. Specifically, we complete it by controlling the duty cycle of PWM. If our LED is controlled by PWM0 of PCA9633, then the duty cycle of PWM0 will determine the brightness of this LED: Bright (duty cycle) = PWM0[7:0]/256. With this principle in mind, we can write something to the register of PCA9633 via I2C:

START

0xC4 (write operation to PCA9633 I2C device address C4)

00h=0x00; 01h=0x00 (set the LED output structure to open drain)

08h=0x02 (Set LED to be controlled by PWM0)

Delay 1 second (Delay 1 second for breathing)

02h= bright ; For bright=0; bright<255; bright++ (LED gradually brightens from 0 to 255)

Delay 10 ms (delay 10 ms to continue after fading in)

02h=bright; For bright=255; bright>0; bright- - (LED dims from 255 to 0)

STOP

At this point, a complete breathing process is completed. With a few simple register settings, it seems that only complex systems or dedicated chips can do this. From the above two examples, we can see that using NXP's I2C LED driver is very simple and easy to operate in terms of hardware and software, and the functions that can be achieved with such devices are in no way inferior to some systems and proprietary chips.

In summary, NXP I2C LED drivers provide a cost-effective LED design solution. Compared with GPIO or dedicated LED drivers, it not only saves system resources, but also greatly reduces the cost and complexity of the design, and can effectively improve the reliability of the design and the uniformity of the driving light. In addition, the use of such LED drivers can effectively help us reduce the design cycle and improve design flexibility. NXP can currently provide customers with I2C LED drivers ranging from 4 to 24 channels, and have been applied to various fields such as automobiles, home appliances, and communications.

Keywords:I2C Reference address:Design and implementation of LED driver based on I2C interface

Previous article:OLED display technology and features: Does the power supply affect the display quality?
Next article:Analysis and implementation of TV video hardware decoding based on BT.656

Recommended ReadingLatest update time:2024-11-16 17:58

Industry technical tips: Teach you how to correctly choose LED driver power supply
Although the stability of LED lights has reached a relatively good level recently , some products have problems with light decay and color drift, mainly due to unreasonable heat dissipation design. Relatively speaking, the problem of LED light drive power supply is much more serious, which is the main reason for dead
[Power Management]
LED drive technology strategy
Last year, the "10 Cities, 10,000 Lights" demonstration project did not bring fruitful results as expected. Instead, the shortcomings of this high-power LED lighting were fully exposed: the reliability of LED driver power supply was extremely poor, the heat was high, and many LED driver power supplies were burned ou
[Power Management]
LED drive technology strategy
CANape/vMeasure exp method to control OUTMM output PWM wave
1. Contents CSM OUT MiniModule is a signal output module that can output analog variables and digital signals. You can set the OUTMM function through CSMconfig, and use CAN messages to control the value of OUTMM output. OUTMM is generally used in test benches and HIL tests. OUTMM can output the follo
[Embedded]
CANape/vMeasure exp method to control OUTMM output PWM wave
In-depth analysis of CFL ballast IC driving LED application circuit
   Driving CFL ballast circuit   Designers use the ballast IC in the CFL to heat the filament, light the bulb, and provide current for the lamp. Manufacturers produce these ICs in large quantities and they cost about $2. This Design Idea shows how to use a CFL ballast IC to drive an LED instead of a CFL. The ballast
[Power Management]
In-depth analysis of CFL ballast IC driving LED application circuit
Use STM32F103 to experiment and summarize PWM related knowledge
The principle diagram of pulse width modulation PWM (Pulse Width Modulation) is as follows: In the figure, it is assumed that the timer works in the up-counting PWM2 mode. The timer starts counting from 0 to ARR. At time t, the count value CNT is compared with CCRx. When CNT Obviously: changing CCRx can change th
[Microcontroller]
Use STM32F103 to experiment and summarize PWM related knowledge
C language implementation of simulating I2C under STM32
Recently, I have been mainly writing some development programs on STM32. Since the I2C module in the STM32 firmware library is really difficult to use, I adopted the software simulation method to implement it. The specific code is as follows (debugged under Keil): #include "stm32f10x_lib.h"      //Conditional compilat
[Microcontroller]
51 MCU outputs 3-way PWM to drive RGB LED source program
Use the microcontroller interrupt to process PWM, control the ordinary three-color LED, output seven different colors, and change with breathing. It does not take up the program running time.    The microcontroller source program is as follows:                          }                                         else
[Microcontroller]
51 MCU outputs 3-way PWM to drive RGB LED source program
Characteristics and Application of DMPPT and PFM/PWM Hybrid Modulation Circuit
1 Introduction The research and development of power management integrated circuits for portable products has the design technology of pulse frequency modulation (PFM), pulse width modulation (PWM) and digital power management chips, and has a series of advanced boost chip designs and products. In parti
[Power Management]
Latest Home Electronics Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号