LED is undoubtedly the hottest application at present. Whether it is handheld devices, game consoles, neon lights, billboards, etc., dazzling colors and high-quality light can always attract people’s attention at the first time. In front of many current LED controllers, how to choose a product with rich functions and high cost performance to meet their own design is undoubtedly a problem in front of every designer.
The simplest LED driver can be realized by ordinary I / O. However, I / O control can only realize led on and off, and can not 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 special high current LED controller to design, but the expensive cost will become a problem first, and the design is complex, and the degree will increase accordingly with the emergence of various disturbances. Based on these, NXP has launched a series of LED drivers using I2C interface, which can simultaneously control on / off, flashing and RGB mixing of 4 to 24 LEDs through two wires of I2C interface. In the light mixing scheme, each LED is driven by an independent 8bit / 256 order 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 add a field effect transistor.
This led control mode based on I2C not only increases the convenience and flexibility of design, but also reduces the investment in software and hardware, making the mysterious led look simple and wonderful to us. Next, we will take NXP LED driver PCA9633 as an example to comprehensively illustrate the advantages of this led driver through several simple applications.
PCA9633 is a four channel LED driver, and each channel can drive a maximum current of 25mA. It provides optional fixed I2C address and programmable hardware address with 4-bit or 7-bit hardware according to different packages (Fig. 1).
We can see from Figure 1 that each LED is controlled by a separate 8bit / 256 order PWM, and because the PWM is fast enough, it can theoretically mix light of any color through the four LEDs it drives. In addition to each individual 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 can not be realized by adjusting only a single PWM. So how does PCA9633 realize dimming? The secret is still on PWM. If PWM is not used, it can only complete on and off actions; Low speed PWM can only realize LED flashing, and is not enough to achieve the purpose of color mixing; High speed PWM can realize RGB color mixing; If the PWM speed is controllable, the dual functions of flicker and color mixing can be realized. Moreover, the controllable 8bit / 256 order PWM increases the color scale and improves the sense of color hierarchy (see Figure 2).
Knowing the principle of color mixing, how does a specific color come into being? 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 the three LEDs. Fig. 3 is an example of PCA9633 controlling three RGB LEDs to adjust pink light.
Through the above description, we basically know the internal structure and driving principle of PCA9633. Next, we will take 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. We know that applications such as brightness bars often need a large number of LEDs in series. If a single interface is used to control each LED, the cost and software complexity will be greatly increased. Through I2C, you only need two control lines in hardware and one byte command in software. In addition, due to the uniqueness of I2C device address, several PCA9633 can be used for control according to the number of driven LEDs. If the driving current of PCA9633 itself is not enough in practical application, it can be easily solved by adding a FET to the periphery. In addition, PCA9633’s unique group PWM makes it easy to control the light intensity and flicker of the whole brightness bar. The following is its schematic diagram (see Figure 4). I2C master is provided by the system, which can be MCU or logic circuit.
The left half of Figure 4 is the I2C master, which will not be described in detail. At the top of the right is the LED current limiting resistor. Generally, 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 the current limiting resistance through 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. When we add FET, just set the outdrv of the corresponding register of PCA9633 to high to distinguish it from its default value. Now we can see that using PCA9633 to control so many LEDs, the schematic diagram is quite simple, and it is also convenient in the software setting register. 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 of 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 an instruction sequence, which is very useful in some specific applications and can save software and system resources to the greatest extent. Next, we will illustrate the setting of internal registers through another example.
The second example is that we use PCA9633 to complete the function of breathing lamp. Although PCA9633 does not have a breathing lamp module, we can realize this function through some simple register settings, which undoubtedly has a great advantage in cost compared with the special breathing lamp chip. For ease of explanation, we only use PCA9633 to control the breathing action of an LED. The schematic diagram is very simple. It is omitted here. The purpose of breathing is achieved by controlling the lighting and darkening process of this led. To achieve this function, the independent PWM of PCA9633 will be the most important factor. As mentioned earlier, each LED is controlled by an 8bit / 256 order PWM, that is to say, each lamp has 256 light and dark color levels adjustable, 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, the duty cycle of pwm0 will determine the brightness of this led: bright (duty cycle) = pwm0 [7:0] / 256. With this principle, we can write something to the register of PCA9633 through I2C:
0xc4 (write to PCA9633 I2C device address C4)
00h=0x00; 01h = 0x00 (set the output structure of led to open drain)
08h = 0x02 (setting LED is controlled by pwm0)
Delay 1 second
02h=bright; For bright=0; Bright; bright + + (LED dimming from 0 to 255)
Delay 10 ms
02h=bright; For bright=255; bright》0; Bright — (LED dims from 255 to 0)
At this point, a complete breathing process is completed. With a few simple register settings, it seems that it can only be done with a complex system or a special chip. From the above two examples, we can see that the I2C LED driver of NXP is very simple and easy to operate in both hardware and software, and the functions that can be realized by such devices are no worse than some systems and proprietary chips.
To sum up, NXP I2C LED driver provides a cost-effective led design scheme. Compared with GPIO or special LED driver, it not only saves system resources, but also greatly reduces the cost and complexity of design, and can effectively improve the reliability of design and the uniformity of driving light. In addition, the use of such LED drivers can effectively help us reduce the design cycle and improve the design flexibility. At present, NXP can provide customers with I2C LED drivers ranging from 4-way to 24-way, and has been applied in various fields such as automobile, household appliances, communication and so on.