【正文】
發(fā)送模塊組成。發(fā)射部分的主要元件為紅外發(fā)光二極管。本設(shè)計采用 40Khz 占空比位 1:3 的方波。 該碼型的一幀數(shù)據(jù)中 由啟動碼,八位的系統(tǒng)碼 1,系統(tǒng)碼 2,數(shù)據(jù)碼,數(shù)據(jù)反碼組成 。 學(xué)習(xí) 型紅外線控制器畢業(yè)論文 5 遙控器在按鍵按下后,周期性地發(fā)出同一種 32 位二進制碼,周期約為 108ms。 當電池電壓下降時,流過 LED 的電流會降低,發(fā)射波形強度降低,遙控距離就會變小。 IRM38A為比較常用的紅外線接收器。 硬件方案設(shè)計 本課題主要針對學(xué)習(xí)型紅外遙控器的設(shè)計,基于功能,將系統(tǒng)分為三個單元進行操作,包括 : 紅外學(xué)習(xí)接收模塊 、 單片機軟件處理模塊、紅外遙控發(fā)射模塊。 學(xué)習(xí) 型紅外線控制器畢業(yè)論文 9 4 紅外線遙控硬件設(shè)計 硬件的選擇 紅外線遙控器硬件主要的器件有 AT89C51 單片機 、 紅外接收裝置和紅外發(fā)射裝置,涉及到能否準確的傳輸和接收信號,以及信號的儲存和調(diào)制。它接收紅外信號頻率為 40 kHz,周期約 26 μs,同時能對信號進行放大、檢波、整形,得到 TTL 電平的編碼信號。 當檢測到有紅外中斷時,進入 中斷服務(wù) ,在該程序中調(diào)用識別程序,并注意關(guān)閉外部中斷,同時在另一定時中斷中判別連續(xù)發(fā)碼的間隔時間,并打開外部中斷。下 面 簡單介紹一下發(fā)光二極管的原理。為 了增加紅外線的控制距離,紅外發(fā)光二極管工作于脈沖狀態(tài),因為脈沖 (調(diào)制光)的有效傳送距離與脈沖的峰值電流成正比,只需盡量提高 脈沖 峰值 電流 Ip,就能增加紅外光的發(fā)射距離。直射式指發(fā)光管和接收管相對安放在發(fā)射與受控物的兩端,中間相距一定距離;反射式指發(fā)光管和接收管并列一起,平時接收管始終無光照,只在發(fā)光 管發(fā)出的學(xué)習(xí) 型紅外線控制器畢業(yè)論文 12 紅外光遇到反射物時,接收管收到反射回來的紅外線才工作。來判斷紅外 LED 加上適當正向電流后是否發(fā)射紅外光。當加入之電壓超過切入電壓之后,電流便急速上升, 而周圍溫度對二極管的切入電壓影響亦很大,當溫度較高 時,學(xué)習(xí) 型紅外線控制器畢業(yè)論文 13 將使其切入電壓數(shù)值降低,反之, 切 入電壓降低。 GND:地。該位禁位后,只有一條 MOVX 和MOVC 指令 ALE 才會被激活。 P2 口: P2 是一個帶有內(nèi)部上拉電阻的 8 位雙向 I/O 口, P2 的輸出緩沖級可驅(qū)動 4個 TTL 邏輯門電路。學(xué)習(xí) 型紅外線控制器畢業(yè)論文 15 P3 口除了作為一般的 I/O 口線外,更重要的用途是它的第二功 能。 XTAL1:振蕩器反相放大器及內(nèi)部時鐘發(fā)生器的輸入端。所以電平觸發(fā)方式適合于外部中斷輸人為低電平,且在中斷服務(wù)程序中能清除該中斷源申請信號的情況。因此設(shè)計方法有所不同,接收機采用一次性結(jié)構(gòu)化設(shè)計法,發(fā)射機部分則分解為兩個層次進行設(shè)計。三端 IC 是指這種穩(wěn)壓用的集成電路 , 只有三條引腳輸出,分別是輸入端、接地端和輸出端 。 在 7805 系列三端穩(wěn)壓器中最常應(yīng)用的是 TO220 和 TO202 兩種封裝。 主程序設(shè)計 上電復(fù)位后, 主 程序掃描按鍵,當確認有按鍵按下時,若是學(xué)習(xí)鍵,則進入學(xué)習(xí)狀態(tài) ; 若是發(fā)射鍵,則將己學(xué)習(xí)的遙控編碼脈沖發(fā)射出去。 紅外線接 發(fā)射 序設(shè)計 由軟件實現(xiàn)遙控信號的載波合成,用定時中斷 1 產(chǎn)生 40kHz 的載波信號,用定時中斷 0 控制定時中斷 1 的開關(guān),定時器 0 定時長短由相應(yīng)的遙控信號電平寬度計數(shù)值確定。由于在 Proteus 當中沒有一體化紅外接收頭的模型,所以在這里就采用另一種方法進行仿真,由于 HS0038 在接收紅外編碼過后, OUT 腳輸出的是一段高電平與低電平想交替的方波,所以我們用波形發(fā)生器模擬 HS0038 所輸出的信號,其時鐘信號輸出設(shè)置如圖 所示: 圖 模擬時鐘信號設(shè)置 學(xué)習(xí) 型紅外線控制器畢業(yè)論文 26 圖 Proteus 發(fā)送端的波形圖 : 硬件電路調(diào)試 本課題設(shè)計的硬件電路調(diào)試時分步進行的,首先調(diào)試的是接收電路,先對 HS0038一體化紅外接收頭進行檢測,正式起 OUT 腳能正常愉出接收到的信號,如圖 6 .7 所示 : 圖 HS0038 的 OUT 腳輸出的波形 學(xué)習(xí) 型紅外線控制器畢業(yè)論文 27 在驗證了 HS0038 輸出正常后,現(xiàn)在對示波器所接受到的信號進行解釋,本次調(diào)試用的是常見的家電遙控器,測試過遙控各個按鍵的波形,由于遙控器發(fā)射的信號長度比較長,而示波器不能完整的顯示整段波形,所以出現(xiàn)了同一按鍵不同時刻在示波器顯示的波形不同。在接收模塊的調(diào)試過程中,首先對遙控編碼信號的形式進行取樣,然后在對單片機接收到的信號與該信號進行對比,由于示波器不能完整的顯示接收到的紅外遙控波形,所以只能對波形的頻率和類型進行比較,在發(fā)射部分的調(diào)試中,也是通過示波器對輸出信號進行檢測,確定其接收到的信號為 高低電平交替的方波信號,與遙控編碼的信號相同。 導(dǎo)師 在學(xué)業(yè)上給了我很大的幫助,使我在實驗過程中避免了許多無謂的工作。 學(xué)習(xí) 型紅外線控制器畢業(yè)論文 34 參考文獻 [1] 姜艷波 . Altium Designer 6 電路圖設(shè)計 . 北京:化學(xué)工業(yè)出版社, 20xx. [2] 于正林 , 蘇志成 .AVR 單片機原理及應(yīng)用 . 北京:國防工業(yè)出版社, 20xx. [3] 吳雙力等 . AVRGCC 與 AVR 單片機 C 語言開發(fā) . 北京 : 北京航空航 天 大學(xué) 出版社, 20xx. [4] 葉啟明 . 單片機制作的新型安全密碼鎖 [J]. 家庭電子 , 20xx. [5] 康華光 . 電子技術(shù)基礎(chǔ)(第四版) [M]. 北京 :高等教育出版社 , 20xx. [6] 彭為 . 單片機典型系統(tǒng)設(shè)計實例精講 [M]. 北京:電子工業(yè)出版社, 20xx. [7] 李瀚蓀 . 電路分析基礎(chǔ) [M]. 北京:高等教育出版社 , 20xx. [8] 董繼成 . 一種新型安全的單片機密碼鎖 [J]. 電子技術(shù) , 20xx. [9] 閻石主 . 數(shù)字電子技術(shù)基礎(chǔ) [M]. 北京:高等教育出版社, 1998. 學(xué)習(xí) 型紅外線控制器畢業(yè)論文 35 附錄 A 英文原文 A Pyroelectric Infrared Sensorbased Indoor LocationAware System for the Smart Home Abstract — Smart home is expected to offer various intelligent services by recognizing residents along with their life style and feelings. One of the key issues for realizing the smart home is how to detect the locations of residents. Currently, the research effort is focused on two approaches: terminalbased and nonterminalbased methods. The terminal based method employs a type of device that should be carried by the resident while the nonterminalbased method requires no such device. This paper presents a novel nonterminalbased approach using an array of pyroelectric infrared sensors (PIR sensors) that can detect residents. The feasibility of the system is evaluated experimentally on a test bed. INTRODUCTION There is a growing interest in smart home as a way to offer a convenient, fortable, and safe residential environment [1], [2]. In general, the smart home aims to offer appropriate intelligent services to actively assist in the resident?s life such as housework, amusement, rest, and sleep. Hence, in order to enhance the resident?s convenience and safety, devices such as home appliances, multimedia appliances, and inter appliances should be connected via a home work system, as shown in FigA1, and they should be controlled or monitored remotely using a television (TV) or personal digital assistant (PDA) [3], [4]. 學(xué)習(xí) 型紅外線控制器畢業(yè)論文 36 Fig Architecture of the home work system for smart home Especially, attention has been focused on locationbased services as a way to offer highquality intelligent services, while considering human factors such as pattern of living, health, and feelings of a resident [5][7]. That is, if the smart home can recognize the resident?s pattern of living or health, then home appliances should be able to anticipate the resident?s needs and offer appropriate intelligent service more actively. For example, in a passive service environment, the resident controls the operation of the HVAC (heating, ventilating, and air conditioning) system, while the smart home would control the temperature and humidity of a room according to the resident?s condition. Various indoor locationaware systems have been developed to recognize the resident?s location in the smart home or smart office. In general, indoor locationaware systems have been classified into three types according to the measurement technology: triangulation, scene analysis, and proximity methods [8]. The triangulation method uses multiple distances from multiple known points. Examples include Active Badges [9], Active Bats [10], and Easy Living [11], which use infrared sensors, ultrasonic sensors, and vision sensors, respectively. The scene analysis method examines a view from a particular vantage point. Representative examples of the scene analysis method are MotionStar [12], which uses