Design and implementation of NXP’s LED driver based on I2C interface

LED is undoubtedly one of the hottest applications 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 the face of the current numerous LED controllers, how to choose a feature-rich and cost-effective product to meet their own design is undoubtedly a problem for every designer.

The simplest LED driver, we can use ordinary I/O to achieve. However, the I/O control can only realize the ON and OFF of the LED, and cannot be used for functions such as light mixing and flickering, and 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 expensive cost will become a problem first, and the design is complicated, and the degree will increase accordingly with the appearance of various disturbances. Based on these, NXP has launched a series of LED drivers using the I2C interface, which can control the ON/OFF, blinking and RGB mixing of LEDs ranging from 4 to 24 at the same time through the two lines of the I2C interface. . In the mixed light scheme, each LED is driven by an independent 8bit/256-step PWM. Currently, the current per LED that can be driven by the chip itself ranges from 25mA to 100mA. Of course, for some high-current applications, we only need to use an external FET 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 appear simple and exciting to us. Below, we will take the NXP LED driver PCA9633 as an example, and comprehensively illustrate the advantages of this LED driver through several simple applications.

PCA9633 is a four-way LED driver, and each channel can drive a maximum current of 25mA, and provides optional fixed I2C address and 4-bit or 7-bit hardware programmable hardware address according to different packages (Figure 1).

Design and implementation of NXP’s LED driver based on I2C interface

From Figure 1, we can see that each LED is controlled by a separate 8bit/256-stage PWM, and because the PWM is fast enough, it can theoretically mix any color through the four LEDs it drives. Light. In addition to each individual PWM, PCA9633 also provides a Group PWM, through which we can use it to control the brightness and frequency of the mixed color light, which makes up for some functions that cannot be achieved by only adjusting a single PWM. So how does PCA9633 realize dimming? The secret is still on the PWM. If PWM is not used, it can only complete the action of turning on and off; low-speed PWM can only achieve LED flashing, which is not enough to achieve the purpose of color mixing; high-speed PWM can realize RGB color mixing; if the PWM speed is controllable, then It can achieve dual functions of flickering and color mixing. And through the controllable 8bit/256-level PWM, the color level is increased to improve the layering of the color (see Figure 2).

Design and implementation of NXP’s LED driver based on I2C interface

Knowing the principle of color mixing, how does a specific color come about? 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 the PCA9633. According to the principle of three primary colors, if we drive RGB (or RGBA) LEDs, the desired color can be obtained by adjusting the different brightness of these three LEDs. Figure 3 is an example of PCA9633 controlling RGB three LEDs to adjust pink light.

Design and implementation of NXP’s LED driver based on I2C interface

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

For the first application, we will use the PCA9633 to control the brightness bar. We know that applications such as brightness bars often require a large number of LEDs to be connected in series. If a single interface is used to control each LED, the cost and software complexity will greatly increase. With I2C, only two control lines are required in hardware, and only one byte command is required in software, which can be easily controlled. In addition, due to the uniqueness of the I2C device address, several PCA9633s can be used to control the number of LEDs driven. If the driving current of PCA9633 itself is not enough in practical application, it can be easily solved by adding a FET on the periphery. In addition, PCA9633’s unique Group PWM 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. There will be some differences according to different colors and manufacturing processes. We can calculate the value of this current limiting resistor from the required LED current: R=(Vsupply-Vfsum)/If. If the required LED current is greater than 25mA, the added FET in the picture can easily solve this problem. When we add a FET, we only need to set the OUTDRV of the corresponding register of the PCA9633 to high to be different from its default value. Now we can see that the PCA9633 is used to control so many LEDs. The schematic diagram is quite simple, and it is also convenient to set the registers in software. PCA9633 provides simple and complete internal registers, such as LED output structure settings, power saving mode settings, chip enable mode settings, LED output state settings, and control register settings for each PWM and Group PWM. In addition, PCA9633 also provides a register setting increment bit, that is to say, if we set this bit, then we can complete the sequential configuration of all internal registers through an instruction sequence, which in some specific applications is Very useful, can maximize software and system resources. 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 the PCA9633 does not have a breathing light module, we can implement this function through some simple register settings, which undoubtedly has a great cost advantage compared to the dedicated breathing light chip. For the convenience of explanation, we only use PCA9633 to control the breathing action of an LED. The schematic diagram is very simple, which 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-stage PWM, which means that each light has 256 adjustable brightness and dark levels, which can perfectly realize the breathing function. Specifically, we do it by controlling the duty cycle of the 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 PCA9633 register through 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 fades from 0 to 255)

Delay 10 ms (Continue with 10 ms delay after completion of fade-in)

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

STOP

At this point, a complete breathing process is complete, and with a few simple register settings, what seems like only a complex system or a dedicated chip can be done. From the above two examples, we can see that using NXP’s I2C LED driver is very simple and easy to operate in both hardware and software, and the functions that can be achieved with such devices are no better than some systems and Proprietary chips are inferior.

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

The Links:   EL640200-U5 LM190E08-TLGE PM100RSE120

Author: Yoyokuo