2015年全国大学生电子设计竞赛双向DC-DC变换器(A题)2015年8月15日I摘要本系统以STM32单片机为主控制器,以非隔离式Buck-Boost型电路为核心,设计并制作用于电池储能装置的双向DC-DC变换器,实现可按键设定亦可自动转换电池充放电模式的功能。系统由STM32内部寄存器及扩展口功能,加上按键模块、集成运放模块、LCD液晶显示模块、双向DC-DC变换电路组成。提高了电源效率,有效的保护了电路,经测试,系统能够实现基础部分所有要求。关键词:DC-DC变换器;高效率;STM32;电流控制精度BbstractThissystemisgivenprioritytowithSTM32MCUcontroller,withtheisolationtypeBuck-Boostcircuitasthecore,thedesignandconstructionofdoubleDC-DCconverterforbatteryenergystoragedevice,implementkeysettingcanbeautomaticallyswitchedtothebatterycharginganddischargingmodefunction.SystemofSTM32internalregistersandextensionmouthfunction,andkeymodule,integratedoperationalamplifiermodule,LCDliquidcrystaldisplaymodule,two-wayDC-DCconversioncircuit.Improvetheefficiencyofthepower,theeffectiveprotectioncircuit,afterthetest,thesystemcanrealizeallbasicrequirements.Keywords:DC-DCconverter;Highefficiency;STM32;CurrentcontrolaccuracyII目录一、系统设计···································································································11.1设计思路·····························································································11.2方案论证与选择················································································11.2.1DC/DC的论证与选择·······································································11.2.2电路过流保护方式的论证与选择························································11.2.3控制系统的论证与选择····································································1二、系统理论分析与计算···················································································22.1双向DC/DC输入输出计算·······································································22.2电流精度及变化率计算···········································································2三、电路设计·································································································33.1电路的设计···························································································3四、程序设计···································································································34.1程序功能描述························································································34.2程序流程图···························································································3五、系统测试···································································································45.1测试条件与仪器····················································································45.2测试结果及分析····················································································45.2.1电流误差及变化率测试····································································45.2.2充电电流变化率测试·····································································45.2.3变换器的效率测试··········································································45.3测试分析与结论·····················································································5六、参考文献···································································································5附录一电路原理图···························································································6附录二主要程序······························································································61一、系统设计1.1设计思路以STM32单片机为控制器,通过键盘设置电池充放电功能模式,该模式采用STM32内部3个12bit、18通道AD快速采集DC/DC模块双向输入、输出值,并通过STM32内部D/A输出及集成运放模块控制DC/DC模块实现恒流恒压,从而能够实现对电池组的充放电,电流步进值精准可调,变换效率大大提高。1.2方案论证与选择1.2.1DC/DC的论证与选择方案一:采用传统升降压拓扑结构LM2596输出电压1.2V~37V可调,输出最高电流可达3A,输出线性好,负载可调,系统效率高,可以用仅80μA的待机电流,实现外部断电,具有过流保护功能;XL6009是一款4A开关电流的高性能升压(BOOST)模块,输入电压3V~32V输出电压5V~35V,经初步调试后完全可实现题目的基本要求。方案二:采用LM317稳压可调电路LM17是可调节3端正电压稳压器,在输出电压范围1.2伏到37伏时能够提供超过1.5安的电流,此稳压器非常易于使用稳压电源输出的有载电压和空载电压差别较大;LM2577是一款具有过流保护、低电压锁定和过热保护功能的升压模块,输入电压范围为3.5V~40V,输出最高电流达3A。综合以上两种方案,选择方案一。1.2.2电路过流保护方式的论证与选择方案一:软件控制方法。通过采样电阻两端的电压计算出Io值,经A/D转换模块将电流反馈给单片机,当检测电流值超过预先设置值时,通过D/A及LM358集成运放使输出电流减少。方案二:光耦驱动法。通过采样电阻两端的电压计算出Io值,经A/D转换模块将电流反馈给单片机,当检测电流值超过预先设置值时,通过光耦驱动继电器电路,从而迅速使输出电流断开,有效保护电路。综合以上三种方案,选择方案一。1.2.3控制系统的论证与选择方案一:以STM32F130VCT6单片机作为主控制系统电压、电流的采集是整个系统的核心部分,关系到整个系统的测量精度,系统否到达额定的指标。本电源电压输出能力为0到30V,电流输出能力为0-3A,电压最小步进值为10mV,电流最小步进值为1mA。满足此测量要求时,需要AD精度大于30000/10=3000,故AD的采样位数应大于12bit。为降低成本,系统在单片机选型时采用内置3个12bit、18通道AD的STM32F130VCT6单片机。方案二:以STC12C5A60S2单片机作为主控制系统STC12C5A60S2是STC生产的单时钟/机器周期(1T)的单片机,是高速、低功耗、超强抗干扰的新一代8051单片机,指令代码完全兼容传统8051,但速度快8-12倍。内部集成MAX810专用复位电路,2路PWM,8路高速10位A/D转换,针对电机控制,强干扰场合。但相对STM32单片机来说,仍需加D/A转换电路,且采集相对较慢。2综合考虑采用方案一。二、系统理论分析与计算2.1双向DC/DC输入输出计算(1)LM2596输出电压值计算:)1(V12outRRVref条件:VOUT为可调节的输出电压,VIN(max)为最大直流输入电压,ILOAD(max)为最大负载电流,F=开关频率(为固定值150KHz)图1(2)1XL6009输出电压值计算:)1(*25.1V12outRR条件:VOUT为可调节的输出电压,VIN(max)为最大直流输入电压,ILOAD(max)为最大负载电流,F=开关频率(为固定值150KHz图22.2电流精度及变化率计算电流控制精度定义为%100e10101icIII其中1I为实际电流,10I为设定值。3STM32单片机内置12位ADC和12位DAC,基准电压源为内部3.3V,电压精度可以达到0.81mv,远远小于0.4V,同时,AD采集偏差0.81mv最大会导致2.48mA电流误差,而题目基本要求电流相对误差绝对值不大于2%,即允许电流误差最小为0.5A*2%=4mA,满足题目对电流精度及变化率的要求。三、电路设计综合上述方案的论证与选择本系统以STM32单片机为主控制器,以非隔离式Buck-Boost型电路为核心,设计并制作用于电池储能装置的双向DC-DC变换器,实现可按键设定亦可自动转换电池充放电模式的功能。系统由STM32内部寄存器及扩展口功能,加上按键模块、集成运放模块、LCD液晶显示模块、双向DC-DC变换电路组成。3.1电路的设计(1)系统总体框图图3系统总体框图(2)双向DC-DC变换电路原理图