Infineon Wireless Charging Kit Power Display - Fancy Lighting
[Copy link]
Infineon Wireless Charging Kit Power Display Light Board Fancy Lighting
Simulate charging effect
Hello friends in the wireless charging group, as we all know, the wireless charging group requires the production of LED light boards to display the power of the supercapacitor group in real time. The driver chip of the LED light must use Infineon's LED driver chip. I believe that the participating students are very clear about this rule. Therefore, when Infineon provided chip support for the competition this year, it not only provided free application and special purchase of microcontrollers, but also provided free samples of LED driver chips. The free LED driver chip application includes four models: TLD2132-1EP, TLD2331-3EP, TLD2131-3EP, TLD1114-1EP, and commissioned Zhufei Technology as the issuer of Infineon's LED driver chips.
Zhufei Changzheng light board
At the same time, as the official partner of Infineon's smart car competition, Infineon commissioned Zhufei Technology to provide everyone with an open source application solution for LED driver chips. Therefore, after the Infineon-Zhufei joint live broadcast on January 14 this year, an open source version of " Zhufei Wireless Charging Group Demonstration Car Model Analysis and LED Power Display Solution Open Source " was released. However, the light board at that time was rather dull, and it could only be said to have a simple function. As lighting engineers, we are definitely not convinced, and we always want to come up with some tricks before we are willing to stop. Of course, more importantly, we want to convey the intention of the organizing committee. In fact, the light board requirement added this year was originally intended to promote aesthetic design in the competition. The reason was that a team in the wireless charging beacon group last year was discovered by Mr. Zhuo that not only did they have good grades, but their cars were also very beautiful and exquisite, and both the structure and the circuit board design were very aesthetically pleasing. Therefore, there were light board design requirements for this year's wireless charging group, and we hope to see more beautiful designs. So today, I will share an advanced version of lighting: "Fancy Lighting of Infineon Wireless Charging Group Power Display Light Board".
The back of the Zhufei Changzheng light board
1. TLD2331-3EP chip introduction
1.1. Chip Description
First, let's briefly introduce the Infineon LED driver chip used in today's light board solution. The TLD2331-3EP is an integrated three-channel LED control chip. The maximum current of each channel can reach 80mA, and the output current can be set. In short, it can be used as a constant current source to drive LED lights. Its pin distribution diagram is as follows:
By consulting the chip manual, you can find the functions corresponding to each pin of the chip:
1. Pins 2, 3, and 4 are three-way input control ports connected to the microcontroller ports.
2. Pins 13, 12, and 11 are three-way output ports connected to LED lights.
3. Pins 8 and 10 are power interfaces, with pin 10 connected to the power supply and pin 8 connected to the ground.
4. Pin 9 is the enable pin and needs to be connected to a high level to be valid.
5. Pins 1, 5, 6, and 7 are special function pins and are not used in this lighting scheme. Just connect them to ground. Pin 14 is an error signal and is not used in this scheme.
1.2 Chip Characteristics
Some of the main features of the TLD2331-3EP chip are as follows:
1. Constant current output, can be used as a low-cost current source to ensure the brightness of the LED lamp
2. Support 3 channels at the same time, the maximum current of each channel is 80mA
3.Support sleep mode, the power consumption in sleep mode is extremely low
4. With fault protection and overload protection
5. The operating temperature range is extremely wide, and it can work stably at -40℃ to 150℃
2. Hardware Circuit Analysis
The hardware circuit of the light board has been mentioned in the previous article on the analysis of the wireless charging group solution. I wonder if you have noticed it? Let's briefly analyze the main structure of the circuit.
The main driver chip is TLD2331-3EP. We connected the input, output and power signals respectively, and other functions that are not used temporarily are grounded or left floating according to the manual. There are 15 LED lights in the output part, and it is intended to use one LED light to indicate that there is a 1V voltage to be applied to the power display solution of our wireless charging group. The TLD2331-3EP chip has three-channel output. If you want one chip to control 15 lights, you need to add additional switch control to switch the control range from one dimension to two dimensions.
At this point, we have a circuit similar to a matrix, and I believe everyone is familiar with such a circuit. Suppose we want to light up the lamp L1A, we need to set the A pin to a high level, turn on the MOS tube Q1 so that the negative pole of the lamp L1A is connected to the ground, B, C, D, and E should be set to a low level, and then we set L1 to a low level, and L2 and L3 to a high level, so that only L1A is lit. I will not list the other lights one by one. I believe everyone has understood how to light up the LED lamp. Let's start with the program and start to master the lighting skills.
3. Fancy lighting
3.1. Light up an LED
To light up any LED lamp, we only need to change the status of two ports, so the program part is also very simple. During initialization, we can directly let the corresponding port output high and low levels to light up the lamp, or we can change it in the program.
The following is a sample program for turning on a single light based on the TC264 control light board. You can refer to it for learning.
//Initialize LED port
void led_init(void)
{
gpio_init(L1, GPO,0, PUSHPULL); //Initialize L1 port
gpio_init(L2, GPO,1, PUSHPULL); //Initialize L2 port
gpio_init(L3, GPO,1, PUSHPULL); //Initialize L3 port
gpio_init(LA, GPO,1, PUSHPULL); //Initialize LA port
gpio_init(LB, GPO,0, PUSHPULL); //Initialize LB port
gpio_init(LC, GPO,0, PUSHPULL); //Initialize LC port
gpio_init(LD, GPO,0, PUSHPULL); //Initialize LD port
gpio_init(LE, GPO,0, PUSHPULL); //Initialize LE port
}
//Set LED port status
void led1_lighten(void)
{
gpio_set(L1,0);
gpio_set(L2,1);
gpio_set(L3,1);
gpio_set(LA,1);
gpio_set(LB,0);
gpio_set(LC,0);
gpio_set(LD,0);
gpio_set(LE,0);
}
Back and forth trailing water light effect
3.2 Scanning and lighting
It is indeed very simple to light up a single LED as mentioned above. If we want to light up any number of LED lights, we need to scan and light them up. The routine and ideas of scanning and lighting were mentioned in the previous article "A Brief Analysis of the Demonstration Car Model of the Zhufei Wireless Charging Group and the Open Source of the LED Power Display Solution" . Let's review it again.
The scanning method is to light up each light for a while. Due to the persistence of vision, it looks like multiple lights are lit at the same time. There are two points that need special attention here. First, all lights must be turned off before lighting other lights, otherwise some lights that should not be lit will be lit. Second, when scanning, make sure that the length of time each light is lit is the same, otherwise there will be a problem of inconsistent brightness.
The following is a sample program for scanning and lighting based on the TC264 control light board, which you can refer to and learn from.
#define L1 P21_5
#define L2 P21_4
#define L3 P21_3
#define LA P21_2
#define LB P33_6
#define LC P33_7
#define LD P00_9
#define LE P02_8
// **************************** Macro definition ******************************
// **************************** Variable definitions****************************
uint8 temp=0,temp1=0; //Calculation variables
uint8 num=0; //refresh count
float supply_voltage=0; //Analog supply voltage
// **************************** Variable definitions****************************
int core0_main(void)
{
get_clk(); //Get the clock frequency. Be sure to keep it.
//Users call various initialization functions here, etc.
//Initialize LED control pins
gpio_init(L1, GPO,1, PUSHPULL);
gpio_init(L2, GPO,1, PUSHPULL);
gpio_init(L3, GPO,1, PUSHPULL);
gpio_init(LA, GPO,0, PUSHPULL);
gpio_init(LB, GPO,0, PUSHPULL);
gpio_init(LC, GPO,0, PUSHPULL);
gpio_init(LD, GPO,0, PUSHPULL);
gpio_init(LE, GPO,0, PUSHPULL);
//Wait for all cores to be initialized
IfxCpu_emitEvent(&g_cpuSyncEvent);
IfxCpu_waitEvent(&g_cpuSyncEvent,0xFFFF);
enableInterrupts();
while(TRUE)
{
temp=(uint8)supply_voltage; //Get the supply voltage
num++; //Refresh count
if(num>14) num=0;
// Turn off all LED displays
gpio_set(L1,1);
gpio_set(L2,1);
gpio_set(L3,1);
systick_delay_us(STM0,1);
gpio_set(LA,0);
gpio_set(LB,0);
gpio_set(LC,0);
gpio_set(LD,0);
gpio_set(LE,0);
if(num < temp) //Light up the LED lights that need to be lit
{
temp1 = num/3;
switch(temp1){ //Open the line
case0: gpio_set(LA,1);break;
case1: gpio_set(LB,1);break;
case2: gpio_set(LC,1);break;
case3: gpio_set(LD,1);break;
case4: gpio_set(LE,1);break;
default:break;
}
temp1 = num%3;
switch(temp1){ //Open column
case0: gpio_set(L1,0);break;
case1: gpio_set(L2,0);break;
case2: gpio_set(L3,0);break;
default:break;
}
}
systick_delay_ms(STM0,1); //delay 1ms You can also put the above statement into a 1ms periodic interrupt
supply_voltage+=0.002; //Simulate charging
if(supply_voltage>15) supply_voltage=1;
}
}
Trailing water light effect
3.3, Fancy lighting
Careful students may have discovered that the previous lighting is to change the port status to make the light on or off, so can we use PWM signals to make the light produce different brightness? The answer is yes. Therefore, we can use PWM to perform fancy lighting, so when initializing, we also need to initialize the control port on one side to PWM output mode. The specific code is as follows:
void led_init(void)
{
gtm_pwm_init(L1,150000,0); //Initialize L1 port
gtm_pwm_init(L2,150000,0); //Initialize L2 port
gtm_pwm_init(L3,150000,0); //Initialize L3 port
gpio_init(LA, GPO,0, PUSHPULL); //Initialize LA port
gpio_init(LB, GPO,0, PUSHPULL); //Initialize LB port
gpio_init(LC, GPO,0, PUSHPULL); //Initialize LC port
gpio_init(LD, GPO,0, PUSHPULL); //Initialize LD port
gpio_init(LE, GPO,0, PUSHPULL); //Initialize LE port
}
Tidal water light effect
And when we light up the lights in a fancy way, we also need to control 15 lights, so the display logic still uses the scanning lighting method. At the same time, in order to make the display more stable, we also need to use the timer interrupt method to execute the display part. At the same time, we only need to replace the column display part with the duty cycle setting. The following is the display part code:
uint8 num=0; //refresh count
IFX_INTERRUPT(cc60_pit_ch1_isr,0, CCU6_0_CH1_ISR_PRIORITY)
{
enableInterrupts(); // Enable interrupt nesting
PIT_CLEAR_FLAG(CCU6_0, PIT_CH1);
uint8 temp;
num++; //Refresh count
if(num>15)
{
num=0;
}
// Turn off all LED displays
pwm_duty(L1,10000);
pwm_duty(L2,10000);
pwm_duty(L3,10000);
systick_delay_us(STM0,1);
gpio_set(LA,0);
gpio_set(LB,0);
gpio_set(LC,0);
gpio_set(LD,0);
gpio_set(LE,0);
if(num <16) //Light up the LED lights that need to be lit
{
temp = num/3;
switch(temp){ //Open line
case0: gpio_set(LA,1);break;
case1: gpio_set(LB,1);break;
case2: gpio_set(LC,1);break;
case3: gpio_set(LD,1);break;
case4: gpio_set(LE,1);break;
default:break;
}
temp = num%3;
switch(temp){ //Open column
case0: pwm_duty(L1, animation[show_num][num]);break;
case1: pwm_duty(L2, animation[show_num][num]);break;
case2: pwm_duty(L3, animation[show_num][num]);break;
default:break;
}
}
}
Breathing light effect
At this point, the specific value of the duty cycle setting is related to the brightness of the light. Because we use an array to control the value of the duty cycle, when we shift the contents of the array, it is equivalent to making the light move. Here is a simple example. We first set the following initial values for the array contents:
{0000,3000,5000,7000,10000,7000,5000,3000,0000,3000,5000,7000,10000,7000,5000,3000}
According to the control principle of TLD2331-3EP, the light will be on when the input control terminal is pulled low. Therefore, the lower the duty cycle we set, the brighter the light will be. So if it is displayed according to the above initial value of the duty cycle, it should be a wave effect, as shown in the following figure:
Static Effects
On this basis, if we add a loop algorithm to shift the array, we can make this "wave" move!
temp = animation[show_num][0];
for(int i=1;i<16;i++)
{
animation[show_num][i-1]=animation[show_num];
}
animation[show_num][15]= temp;
Dynamic wave effect
After completing the dynamic effect display, you should be able to draw inferences from one example and write your favorite lighting effect. Here is a video showing several effects written by Zhufei lighting engineers:
The specific fancy lighting code will be placed in our Gitee open source repository.
Link: https://gitee.com/seekfree/Infineon_TLD2331_3EP
Students who are interested can download and check it out, and we look forward to more eye-catching designs from you all!
Wireless charging kit dual power supply wiring diagram
|