National Electrical Contest

More contents will be added soon~


National Electrical Contest is the largest electrical contest around Chinese undergraduate students. It is held by Ministry of Education and Ministry of Industry and Information Technology and sponsered by Texas Instruments at province level and by Renesas Electronics at national level. In 2015, there are 36378 students around the country took part in the contest. It is the biggest electrical engineer party in China.

My project is related to power. We built the digital control dc power supply, switching power supply modules parallel power supply system, single phase AC-DC converter circuit and active power factor correction in our summer training. And for the contest, we built bidirectional DC-DC converter for lithium battery in only 3 days and won the national first prize.


Demonstration Video(This video is our final contest project. We built a bidirectional DC-DC converter for lithium battery.)


Introduction

The design is by the boost module, constant current modules, digital modules and other components of high-efficiency two-way DC-DC circuit. Charging using high-efficiency buck chip TPS54340, added to the current loop, the current can be set, the current control accuracy of 0.13%, the current rate of change of 0.05%, the efficiency of 95.4%. Discharge TPS55340 form boost boost circuit, the output voltage is stable, the efficiency of 95.0%. The digital processing module of the system adopts STM32 one-chip computer with high processing speed and low power consumption to realize high-precision constant current charging and constant voltage discharge. It has the functions of overcharge protection, full charge, anti-reflux and battery residual judgment. System components, cost-effective, small size, light weight (250g), a better completion of the basic part and to play part of the requirements there is a certain degree of innovation. In addition, the design uses high-precision thermal transfer PCB board production, the basic all-chip process is conducive to the stable operation of high-frequency switching circuit.


Design


This the STM32F103 control board I designed for our team.



infinity image

Figure 1: schematic of the control board

I used AltiumDesigner to design the board and make it to a PCB design.


infinity image

Figure 2: PCB design


I soldered this board and debugged all the modules on the board like the oled screen, keyboard, ADC and DAC etc.


infinity image

Figure 3: Finished Control Board


digital control dc power supply



infinity image

Figure 4: digital control dc power supply


switching power supply modules parallel power supply system



infinity image

Figure 5: switching power supply modules parallel power supply system


single phase AC-DC converter circuit and active power factor correction



infinity image

Figure 6: single phase AC-DC converter circuit and active power factor correction


bidirectional DC-DC converter for lithium battery



infinity image

Figure 7: bidirectional DC-DC converter for lithium battery



infinity image

Figure 8: back of bidirectional DC-DC converter for lithium battery


infinity image

infinity image

Figure 9: all the boards we used during this contest


Team Member



infinity image

infinity image

Figure 10: Zhengning Zhao, Wenzhao Liu, Beitong Tian(From left to right)


Code Appendix

#include "sys.h"
#include "led.h"
#include "delay.h"
#include "key.h"
#include "oled.h"
#include "usart.h"        
//#include "usmart.h"
#include "timer.h"
#include "beep.h"
#include "dac.h"
#include "adc.h"
//#include "remote.h"
//#include "spi.h"
#include "math.h"

u8 count=0;
u16 adci=0, adcus=0, adcu2=0,adcovp=0;
float tempi=0, tempus=0, tempu2=0,temp30=0,adcival=0,tempovp=0;
 unsigned int temp=0,tempvar=0;
unsigned int dacvals=0,dacvaltemp=0;
float dacvalss=0;
unsigned int addend =0;
unsigned char backup[4][4] = { //按键值备份,保存前一次的值
    {1, 1, 1, 1},
    {1, 1, 1, 1},
    {1, 1, 1, 1},
    {1, 1, 1, 1}
    }
  unsigned char KeySta[4][4] = { //全部矩阵按键的当前状态
{1, 1, 1, 1},
{1, 1, 1, 1},
{1, 1, 1, 1},
{1, 1, 1, 1}
};
const unsigned char KeyCodeMap[4][4] = 
    { 
        
{ '1', '2', '3', 0x26 }, //数字键 1、数字键 2、数字键 3、向上键
{ '4', '5', '6', 0x25 }, //数字键 4、数字键 5、数字键 6、向左键
{ '7', '8', '9', 0x28 }, //数字键 7、数字键 8、数字键 9、向下键
{ 0x1B, '0', 0x0D, 0x27 } //数字键 0、 ESC 键、 回车键、 向右键
};
#define adcstand 3.3

void buckon()
{
    ENboost=0;
    delay_ms(100);
    
    ENbuck=1;
}
void buckoff()
{
    ENbuck=0;
    delay_ms(100);
        ENboost=1    
}
int main(void)
{ 
  u8 stand=0,stand1=0,chuangxin=0,standcc=0,standcccv=0;
    unsigned int p=0,count=0,count2=0;
    NVIC_Configuration();
  delay_init();
    uart_init(9600);
    LED_Init();
    BEEP_Init();    
    KEY_Init();  
  OLED_Init();
    TIM3_Int_Init(30-1,2400-1);     
  Dac1_Init();
  Adc_Init();
    Dac1_Set_Vol(20);
    OLED_ShowString(0,16,"  CC / CC CV ");
    OLED_ShowString(0,32,"  1  /   2   ");
    OLED_Refresh_Gram();
    while((standcc|standcccv)==0)
    {
        if(addend==1) {standcc=1;addend=0;}
        else if(addend==2) {
        standcccv=1; addend=0;}
    }

    OLED_ShowString(0,0,"SET:         ");
    OLED_ShowString(0,16,"I :         ");    
    OLED_ShowString(0,32,"Us:         ");    
    OLED_ShowString(0,48,"U2:         ");
    OLED_Refresh_Gram();
    
    while(1)
  {    adci=Get_Adc_Average(1,100);
        tempi=(adci*adcstand/4096/1.0625-0.0078)/1.0029*1.0075-0.003;
        
        adcus=Get_Adc_Average(2,30);
        tempus=(float)(adcus*adcstand/4096*14-0.0791)/0.9762*0.9954+0.1209;
        adcu2=Get_Adc_Average(3,30);
        tempu2=(float)(adcu2*adcstand/4096*14-0.1059)/0.98*0.995+0.1462;
        adcovp=Get_Adc_Average(5,250);
        tempovp=(float)((adcovp*adcstand/4096*10.1)+1.5);
       dacvalss=0.2;
        if(stand==0)
        {
        oled_show(tempi,32,16);
       oled_show(tempus,32,32);
        oled_show(tempovp,32,48);
        OLED_Refresh_Gram();
        }
        if(tempu2<1.0&&stand==0)
        {
            buckon();
            
            if(standcccv==1)
            {
                if(tempovp>21)
                    
                {
                    dacvaltemp-=10;
        {Dac1_Set_Vol(dacvaltemp);}
                if(tempi<dacvalss)  
                    {   
                        OLED_ShowString(0,0,"             ");
                        OLED_ShowString(0,16,"  FULLCHARGE ");   
                        OLED_ShowString(0,32,"             ");   
                        OLED_ShowString(0,48,"             ");
                ENbuck=0;stand=1;
                }}
                if(tempovp<21)
                {dacvaltemp+=10;
                    Dac1_Set_Vol(dacvaltemp);}
            }
            if(tempovp>24) 
            { 
                stand=1;
                ENbuck=0;
          OLED_ShowString(0,0,"                ");
          OLED_ShowString(0,16,"   OVERVOLTAGE ");   
          OLED_ShowString(0,32,"               ");   
                OLED_ShowString(0,48,"               ");
                OLED_Refresh_Gram();
            }
                
            if(standcccv==0)
            {if(dacvals>15)
   {
     if(tempi*1000>(float)(dacvals)+1) Dac1_Set_Vol(dacvaltemp--);
   else if  (tempi*1000<(float)(dacvals)-1)  Dac1_Set_Vol(dacvaltemp++);
     }} 
    }
             else if(fabs(tempu2-tempus)<0.5&&stand==0)
        {
            buckoff();
        }
                else if(tempus>35.0)
        { 
            
      buckon();
            temp=((tempus-30)*200)-1000+10;
            tempvar=temp*1.35;
            Dac1_Set_Vol(tempvar);

        }
            else {buckoff(); Dac1_Set_Vol(20);}
 (Get_Adc_Average(1,200)*adcstand/4096/1.0626*1000<(float)(dacvals)-2)  Dac1_Set_Vol(+
+dacvaltemp);}
}   
    }