【電(dian)(dian)熱水(shui)器(qi)控(kong)制(zhi)(zhi)器(qi)】分(fen)時(shi)控(kong)制(zhi)(zhi)電(dian)(dian)熱水(shui)器(qi)的嵌入(ru)式控(kong)制(zhi)(zhi)器(qi)設(she)計 電(dian)熱水器(qi)控制器(qi)原理
1 概述
隨(sui)著國家(jia)對家(jia)用(yong)(yong)(yong)電器(qi)(qi)節能(neng)(neng)和安全(quan)認(ren)證工作的(de)開展,城市用(yong)(yong)(yong)電分時計費方式開始被(bei)推廣(guang)實施,即用(yong)(yong)(yong)電高峰(feng)在時收費高,用(yong)(yong)(yong)電低谷時收費低。目(mu)前采用(yong)(yong)(yong)機(ji)械(xie)溫包控(kong)制方式熱水(shui)器(qi)(qi)已少見(jian),早(zao)期(qi)的(de)電熱水(shui)器(qi)(qi)因控(kong)制簡單、智(zhi)(zhi)能(neng)(neng)化程(cheng)度(du)低、保護功能(neng)(neng)少,已不適應現代生活的(de)需(xu)求。本文(wen)所談到的(de)控(kong)制器(qi)(qi)采用(yong)(yong)(yong)高性價比單片(pian)機(ji),運用(yong)(yong)(yong)軟件控(kong)制技術,融合智(zhi)(zhi)能(neng)(neng)化控(kong)制思想,增加了漏電檢(jian)測(ce)、干燒報警等多重(zhong)保護功能(neng)(neng),大(da)(da)大(da)(da)提(ti)高了電熱水(shui)器(qi)(qi)的(de)智(zhi)(zhi)能(neng)(neng)化、安全(quan)性,并采用(yong)(yong)(yong)LCD顯示(shi)溫度(du),使(shi)(shi)熱水(shui)器(qi)(qi)具(ju)有(you)良好的(de)人(ren)機(ji)界面,方便用(yong)(yong)(yong)戶操(cao)作,使(shi)(shi)該款電熱水(shui)器(qi)(qi)顯得更加經濟實用(yong)(yong)(yong)。
2 系統功能設計
本款電熱水器(qi)智能(neng)(neng)控制(zhi)器(qi),主要具有(you)(you)以(yi)下(xia)獨特功能(neng)(neng):①帶柔和背光的液(ye)晶(jing)實時(shi)顯示(shi)溫度和實時(shi)時(shi)鐘(zhong)(zhong);②具有(you)(you)漏電、干燒、過熱、傳感器(qi)失(shi)效等多重(zhong)保(bao)護;③方便的按鍵(jian)(jian)操作:系統開(kai)啟鍵(jian)(jian);功率選擇鍵(jian)(jian);定時(shi)狀(zhuang)態鍵(jian)(jian);分(fen)段定時(shi)設(she)定或時(shi)鐘(zhong)(zhong)校準狀(zhuang)態切(qie)換鍵(jian)(jian);調(diao)整溫度、時(shi)鐘(zhong)(zhong)、定時(shi)開(kai)關機時(shi)間的數值設(she)定鍵(jian)(jian);④運行狀(zhuang)態指示(shi);⑤故障(zhang)聲光報警與指示(shi)。
3 系統硬件設計
該系統(tong)電路(lu)(lu)主要(yao)由電加熱(re)管(guan)控(kong)制電路(lu)(lu)、漏電檢測電路(lu)(lu)、蜂鳴(ming)器驅(qu)動(dong)電路(lu)(lu)、溫度(du)采樣電路(lu)(lu)、液晶和發光管(guan)顯示(shi)電路(lu)(lu)、按鍵電路(lu)(lu)、背光等組成(cheng)。
MCU選用(yong)高性價比的(de)TMP87P809N,該單片機豐富的(de)資源(yuan)(內含512字(zi)節的(de)RAM、8K字(zi)節的(de)ROM,10個(ge)中斷(duan)源(yuan),22個(ge)I/O口,兩個(ge)16位(wei)(wei)多(duo)功能定時器,一個(ge)基本定時器,一個(ge)Watchdog定時器,一個(ge)SCI口,6路8位(wei)(wei)A/D轉換器)及(ji)低價格,特(te)別(bie)適合智能家電的(de)嵌入式(shi)控制。
3.1 溫度采樣電路
本(ben)系統采(cai)(cai)用(yong)一(yi)路溫(wen)度(du)傳(chuan)感(gan)器實時采(cai)(cai)集(ji)熱水(shui)器的水(shui)溫(wen)用(yong)于(yu)MCU控制;由于(yu)單片機(ji)自帶A/D電(dian)(dian)路,由熱敏電(dian)(dian)阻(zu)(zu)(zu)式(shi)溫(wen)度(du)傳(chuan)感(gan)器和一(yi)高(gao)精(jing)度(du)電(dian)(dian)阻(zu)(zu)(zu)分(fen)壓構成即可(ke);為(wei)提高(gao)抗干擾能力,可(ke)在單片機(ji)口(kou)線上串接一(yi)個電(dian)(dian)阻(zu)(zu)(zu),并接一(yi)個按地的濾波電(dian)(dian)容。
3.2 漏電檢測
電熱水器的使用,安全性能是其考慮(lv)的首要因(yin)素。本系統(tong)設計了獨特的漏電檢測和保護電路。
電(dian)加熱管(guan)的電(dian)源穿(chuan)過互感器L,繼(ji)電(dian)器J將電(dian)加熱管(guan)的強電(dian)同外界隔(ge)離。
加(jia)電(dian)(dian)(dian)(dian)(dian)(dian)時,單片機的(de)(de)(P1).1口,輸出(chu)一(yi)高(gao)電(dian)(dian)(dian)(dian)(dian)(dian)平,使(shi)J吸合,電(dian)(dian)(dian)(dian)(dian)(dian)加(jia)熱(re)上(shang)(shang)得到(dao)電(dian)(dian)(dian)(dian)(dian)(dian)源。沒有漏電(dian)(dian)(dian)(dian)(dian)(dian)發生時,流(liu)進電(dian)(dian)(dian)(dian)(dian)(dian)加(jia)熱(re)器和流(liu)出(chu)電(dian)(dian)(dian)(dian)(dian)(dian)加(jia)熱(re)器的(de)(de)電(dian)(dian)(dian)(dian)(dian)(dian)流(liu)的(de)(de)平衡,L上(shang)(shang)無感應(ying)(ying)電(dian)(dian)(dian)(dian)(dian)(dian)動熱(re),而一(yi)旦有漏電(dian)(dian)(dian)(dian)(dian)(dian)發生,進出(chu)電(dian)(dian)(dian)(dian)(dian)(dian)加(jia)熱(re)器上(shang)(shang)的(de)(de)導線中的(de)(de)電(dian)(dian)(dian)(dian)(dian)(dian)流(liu)不平衡,L上(shang)(shang)就有感應(ying)(ying)電(dian)(dian)(dian)(dian)(dian)(dian)動熱(re),經(jing)D1、D2、C1電(dian)(dian)(dian)(dian)(dian)(dian)路的(de)(de)濾波整(zheng)流(liu)得到(dao)直(zhi)流(liu)電(dian)(dian)(dian)(dian)(dian)(dian)壓(ya)V1送(song)比較(jiao)器,當(dang)V1大(da)于警戒電(dian)(dian)(dian)(dian)(dian)(dian)壓(ya)V2時,比較(jiao)器IC的(de)(de)輸出(chu)就會翻轉(zhuan),產生一(yi)下(xia)降沿(yan),送(song)到(dao)單片機的(de)(de)中斷口INT,單片機立(li)刻響應(ying)(ying)中斷,使(shi)(P1).1口輸出(chu)一(yi)低(di)電(dian)(dian)(dian)(dian)(dian)(dian)平,繼(ji)電(dian)(dian)(dian)(dian)(dian)(dian)器J斷開(kai),迅(xun)速切斷電(dian)(dian)(dian)(dian)(dian)(dian)加(jia)熱(re)器的(de)(de)供電(dian)(dian)(dian)(dian)(dian)(dian)電(dian)(dian)(dian)(dian)(dian)(dian)源。
R5、R6、T2和單(dan)片機的(de)(P1).0口構成了漏電(dian)(dian)保(bao)護電(dian)(dian)路(lu)的(de)時(shi)時(shi)監(jian)控系統。(P1).0口每隔一定(ding)時(shi)間(如5分(fen)鐘)輸出(chu)一高(gao)電(dian)(dian)平(ping),使T2飽和導通(tong),L上(shang)立刻感應出(chu)電(dian)(dian)壓V1,此時(shi)V1>V2,比(bi)較器(qi)(qi)輸出(chu)翻轉(zhuan),單(dan)片機應產生(sheng)中(zhong)斷(duan)。如單(dan)片機沒有及(ji)時(shi)產生(sheng)中(zhong)斷(duan),說明漏電(dian)(dian)保(bao)護電(dian)(dian)路(lu)有故障,(P1).1口輸出(chu)低(di)電(dian)(dian)平(ping),使繼電(dian)(dian)器(qi)(qi)J釋(shi)放,切斷(duan)熱(re)水器(qi)(qi)電(dian)(dian)源;液晶顯示故障,蜂鳴器(qi)(qi)報警。這就確保(bao)了漏電(dian)(dian)保(bao)護電(dian)(dian)路(lu)的(de)實時(shi)可靠性。
3.3 液晶驅動電路
液晶顯示(shi)選用(yong)HT1621B,該芯片是一種智能型的(de)液晶顯示(shi)驅動專用(yong)模塊,具有集成化程度(du)高,體積(ji)小,功能強,功耗低,所需(xu)外圍器件少等特點,以串行方(fang)式和單片機進行數據通(tong)信(xin),能驅動32×4位LCD液晶屏。
CS是HT1621B的片(pian)選腳,當它(ta)為低電平時,單片(pian)機和(he)HT1621B之間(jian)的數據(ju)通(tong)信被接通(tong),否則被禁止(zhi)。
WR是寫數(shu)據(ju)的(de)時(shi)鐘(zhong)腳,在WR時(shi)鐘(zhong)信號(hao)的(de)上升沿(yan),HT1621B才接收來自DATE線(xian)的(de)命令或數(shu)據(ju)。
DATE是(shi)串行(xing)數據的輸(shu)入(ru)/輸(shu)出腳。
電阻R7的(de)作用(yong)是調(diao)節液晶顯示屏的(de)亮度,取值范圍一般為(wei)15KΩ±20%。
4 軟件設計
軟(ruan)(ruan)件(jian)設計采用功能獨立化、結構模塊化為軟(ruan)(ruan)件(jian)設計模式。
程(cheng)(cheng)序(xu)(xu)(xu)由主程(cheng)(cheng)序(xu)(xu)(xu)、INT中斷程(cheng)(cheng)序(xu)(xu)(xu)和(he)定(ding)時(shi)中斷程(cheng)(cheng)序(xu)(xu)(xu)構成(cheng)。INT中斷程(cheng)(cheng)序(xu)(xu)(xu)用(yong)于漏電(dian)檢測和(he)漏電(dian)保護(hu)電(dian)路的(de)監控;定(ding)時(shi)中斷程(cheng)(cheng)序(xu)(xu)(xu)用(yong)于產(chan)生時(shi)鐘(zhong)和(he)各種(zhong)時(shi)間的(de)計數;主程(cheng)(cheng)序(xu)(xu)(xu)由初始化程(cheng)(cheng)序(xu)(xu)(xu)和(he)各個功能模(mo)塊(kuai)程(cheng)(cheng)序(xu)(xu)(xu)組成(cheng)。
A/D采樣程序完成對溫度的(de)數據(ju)采集,并根據(ju)溫度設定值,用以控制(zhi)電加熱管的(de)開關。如(ru)采集到的(de)數據(ju)過(guo)高(gao)或過(guo)低,則認為包括傳(chuan)感器在內(nei)的(de)采樣電路有故障(zhang),關斷電加熱管,系(xi)統(tong)報警。
4.1 防干燒保護
由于熱水(shui)器的長時間使用造(zao)成(cheng)密封圈(quan)老化,或其它(ta)因(yin)素造(zao)成(cheng)熱水(shui)器漏水(shui),使熱水(shui)器缺水(shui)。這時,如(ru)加上電源,會(hui)使加熱管處(chu)在干燒(shao)狀態,如(ru)不及時關斷(duan)電源,電加熱管會(hui)燒(shao)斷(duan),甚至爆(bao)裂。
防干燒(shao)保護子程序就是實時監控加(jia)熱器(qi)的溫(wen)升(sheng),如(ru)發現溫(wen)度(du)升(sheng)得過快(kuai),則認為是干燒(shao),立刻(ke)關(guan)斷加(jia)熱管,并(bing)報(bao)警(jing)。
單(dan)位時間(jian)取1分鐘,因干燒造(zao)成的后果(guo)嚴重,因此,判(pan)(pan)斷干燒的溫升應(ying)在1分鐘內判(pan)(pan)斷,而不要等到1分鐘計時結(jie)束才判(pan)(pan)斷。
4.2 分段定時
系統根據(ju)一(yi)(yi)天(tian)24小(xiao)時的實(shi)時時鐘(zhong),將定時間分(fen)為0~6,6~12,12~18,18~24四(si)個時間段(duan)(duan),共12種方式(shi),用戶可(ke)選擇一(yi)(yi)段(duan)(duan)或多段(duan)(duan)來定時加熱,亦可(ke)利用“∧”、“∨”鍵來修改四(si)個時間段(duan)(duan)和上、下限(xian),如需取消(xiao)某一(yi)(yi)定時段(duan)(duan),將該時間上、下限(xian)設(she)置為相同即可(ke)。
分段(duan)定(ding)時(shi)(shi)設定(ding)好以后,按定(ding)時(shi)(shi)鍵進入定(ding)時(shi)(shi)狀態,再(zai)次按下(xia)定(ding)時(shi)(shi)鍵,則取消定(ding)時(shi)(shi)。
4.3 LCD顯示程序
HT1621B是多(duo)功能液(ye)晶驅(qu)動(dong)芯片。使(shi)用(yong)前,必須(xu)先(xian)初始化(hua),然(ran)后才能向(xiang)其輸送數據(ju),驅(qu)動(dong)所需的液(ye)晶顯示。
5 抗干擾設計
電熱(re)水器(qi)使用環境潮濕,電源污染(ran)對其產生(sheng)的干(gan)擾尤(you)其嚴重(zhong),為(wei)保證控制系統的可靠運行,采(cai)取(qu)了以下抗干(gan)擾措施。
硬件設(she)計(ji)上(shang),注(zhu)意(yi)元(yuan)件的(de)布局(ju),即要把(ba)模(mo)擬信號、數字(zi)電(dian)路(lu)、噪聲源(強電(dian)部分(fen))三部分(fen)合理地(di)分(fen)開,設(she)計(ji)印制板時,各(ge)元(yuan)件之間(jian)的(de)引線(xian)要盡量地(di)短,地(di)線(xian)和(he)(he)電(dian)源線(xian)應(ying)適當加(jia)粗,集成電(dian)路(lu)的(de)電(dian)源和(he)(he)地(di)之間(jian)要加(jia)一個去耦電(dian)容(rong)。
軟件(jian)設計(ji)上,采用了指(zhi)令冗余(yu)、軟件(jian)陷阱和利用單片機內(nei)部(bu)的WATCHDOC監視器(qi)實(shi)現(xian)軟件(jian)工作自恢復等方法;為了消除A/D傳感器(qi)通道的干擾信號,利用CPU運(yun)算與控制功能實(shi)現(xian)數字濾波;并采用重復檢測(ce)法,實(shi)現(xian)對漏電的準確(que)判斷。
6 結束語
本文(wen)介紹(shao)了新型分段(duan)計時控(kong)(kong)制(zhi)的(de)(de)智能(neng)電熱水器控(kong)(kong)制(zhi)器中的(de)(de)應用設計,該產品(pin)已批量(liang)生產,取得(de)了良好的(de)(de)經濟(ji)和社會效益。隨著技術的(de)(de)發展,具有自(zi)學習能(neng)力(li)、網絡遠程(cheng)控(kong)(kong)制(zhi)能(neng)力(li)的(de)(de)智能(neng)電熱水器也正在研制(zhi)過程(cheng)中。