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