基于单片机的红外遥控电子密码锁的外文及翻译 - 图文

更新时间:2023-10-10 04:38:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

毕业设计(论文)

外文资料翻译

学生姓名: 朱德涛 学 号: 1402100129 所在学院: 电子与信息工程学院 专 业: 电子信息工程 指导教师: 毛钱萍

2014年 03 月 15 日

Proceedings of 2009 4th International Conference on Computer Science & Education

The Design of Electronic Locks Based on

Infrared Remote-Control with MCU

ZhangCheng Xue ShunXiang Wu

Department of Automation Department of Automation Xiamen University Xiamen University Xiamen, China Xiamen, China xuezhangcheng@126.com wsx1009@163.com

Abstract-At present, key-pad electronic lock with alarming funtion is to gradually replace the traditional mechanical locks,overcoming the shortcomings of the traditional mechanical locks which contain few password and lack of reliabiIty, but keypad electronic lock makes a great progress in terms of technology and performance.This paper represents a type of remote-controlled electronic lock developed with the chip of AT89S51. This type of lock have two input devices,one of them is a 4*3 matrix keyboard mounted on the lock,the other one is a remote controller which also have 4*3 matix keyboard.we can use either of them to open the lock or change the password we have set. In the design,we adopt the infrared ray as the medium,because of the strong anti-interference ability, reliable transmission of information.

Index Terms-MCU Electronic locks Infrared Remote-control LCD1602

I. INTRODUCTION

The design is based on single chip,makes use of 4 * 3

keyboard and infrared remote controller as input,LCD1602 could display the information of the steps when you are operating.This designment could also realize modifying the password and alarming. When a requirement to reset the password,it is necessary to make sure the password is correct,otherwise it will make noise to warn you the password is wrong.In this designment,1 limit the length of the password

at six,Just like the ATM of bank.you must enter right password if you want to get through.

II. THE FRAMEWORK OF THE DESIGNMENT

The

designment consists of six modules: the main

controller module, LCD1602 module, 4*3 keyboard module, infrared remote control module, the alarm module, the unlocking simulation module.

Main Controller Module: a low-power, high-performance CMOS 8-bit single chip, the device used ATMEL's highdensity, non-volatile memory technology, compatible with standard command system of MCS-51.An 8-bit common central processing unit and ISP Flash memory cell are integrated in this chip.

LCD modules: LCD1602 is a character liquid crystal display modules, is a type of dot-matrix LCD dedicating to display letters, numbers, symbols and so on.Considering economy and practice in this regard,adopting LCDl602 is enough to meet the requirements of character displaying on the LCD.

4*3 keyboard module: Because of I/O port of MCU is limited, according to matrix keyboard to realize circuit.In this way,we can design enough buttons on the keyboard but not take up too many ports of the MCU.

Infrared remote control module: the design used a universal TV remote controller as input device,the device can provide a wide range of infrared encoding format, so we make use of the coding format of the pulse width modulation.

Alarm modules: In this design, select the buzzer to sound a warning. The single-chip through the port P3.2 outputs a square wave pulse-driven audio loudspeakers.

Unlocking instructions: In this design,1 choose to use LED lights to simulate the situation of the lock.when we enter password,LED lights will flash on behalf of the unlocking is successful.

4*3 keyboard AT89S51 Alarm circuit Infrared remote control module Single chip Unlocking simulation LCD 1602 Figure 1.The framework of the designment

A. The design of Matrix keyboard

Matrix keyboard working principle: vertical lines through the resistance connected +5V power.when no keys are pressed down,the vertical lines is in high level situation,otherwise ,the situation is the same with the horizontal line's which is crossed on the button.Originally ,the horizonal lines are in low-level, when we check the varying situation of the vertical Iines,that means button is pressed down,at this time we save the situation of port p2.4-p2.6,then we program to make the port p2.0-p2.3 in high level situation line by line,at the meantime checking the varying of the situation of the port p2.4-p2.6,when it changes,we save the situation of the port p2.0-p2.3.In this way,we have known which button had been press down,because we have recorded situation of the port p2.0~p2.6.Different keys have different coding format, the keyboard processing tasks are:Firstly, to determine whether or not press the button,then check which button have pressed,through the programming,get the formation of key coding.All of the key code shown in the following table: TABLE 1. THE VALUE OF KEY CODING

EE ED EB E7

DE DD DB D7 BE BD BB B7

Figure 2. The 4 ? 3 keyboard circuit

B. The design of infrared remote – control

1) The introduction of the LC7461

At present,there are lots of chips dedicating to transmit the

infrared ray, in terms of the encoding format that can be divided into two major categories: PWM and PPM. Here we have adopted a relatively easy to modulate,the PWM's, LC7461 chip. When the infrared controller'button is pressed,it will send out some signal which contains the information about the coding format.The signal has the following characteristics: the PWM pulse width last for 0.56ms, interval 0.56ms as a period of 1.12ms representing the binary \the PWM pulse width last for 0.56ms,interval 1.68 ms as a period of 2.24ms representing the binary \above-mentioned \and \composed of 42 bits binary code, as contained in the 38kHz frequency modulation for the second launch in order to enhance efficiency and reduce lower power consumption, and

then through the infrared diode to send out. “0” “1”

0.56 ms 0.56ms

1.125ms 2.25ms

Figure 3. The formation of the signal.

2) The infrared receivers

Infrared receiver is an integrated circuit including a set of funtions of receiving,amplification and shaping, without any external components,takes all the work compatible with TTLlevel, it is suitable for a variety of infrared remote control and infrared signal transferring.Infrared receiver transmits the demodulated signal to the single-chip AT89S51 by the way of interruption. NOTE: When there is no infrared signal,the output port is in high-level,so the signal we received is contrary to the signal sent out before.

3) The decoding of the infrared signal

When we receive a signal containing a synchronized

beginning of 9ms low-level and 4.5ms high-Level,it makes us prepare to decode the data.The key of decoding is how to identify \and \According to the formation of the signal we can find that the definition of \and\1\starts with 0.56ms low-level, the only difference between them is the width of the high-level, \bit is 0.56 ms,\1\bit is 1.68 ms,so we delay 0.9ms to compare the current level for identifying the bit,the flow chart as follows:

N

initially Waiting interruption function Access the decoding procedure Delay 9ms to check the level is high or not? Y

N Is the anti-code data

contrary to the data code? Obtain the anti-code data Delay 4.5ms to prepare getting the data Obtain the data code Y

Turn to the relating procedure according to the data code Output the data code End Figure 4. The flow chart of decoding

4) The working process of the infrared remote-conroller

IR transmit / receive control circuits are achieved

by the AT89S51microcontroller with simple circuit, selectable output control method and very practical The specific work process is as follows:

Launch: First, sent back the data from the serial transmit port P3.1 to the P1.1 port for internal modem, sent out from the P1.2 port, and then fired out through the infrared emitting diodes, firing distance is about 10m.

Receipt: The infrared receiver head matched with the launch is used. , sent out the data launched to the serial port 3.0, and then the system will confirm whether the send data are consistent with the receive data, yes will unlock, no will give up. C. The design of main circuit

According to the design of the analysis, the hardware circuitry of single-chip electronic locks as shown in the Figure below. P0port connect LCDl602 8-bit data bus,at the same time, P0port is connected to the 8-bit ports of anode-sharing digital tube,the port of P0.1strobes LED. P2 port access 4 * 3 matrix keyboard circuit, while P2.5, P2.6 and P2.7 respectively connect the RS, RW, E-port of the LCD1602. Buzzer alarm prompted by the P3.2 output.

Figure 5. The design of main circuit

III. RESULT

Accrding to the design ,the operation is shown as the figures below:

Figure 6. a unlocking interface

When we want to reset the password,firstly,the system checks out the password is correct or not,if the password is right,we could get in the next step,otherwise the system makes warning.

Figure 7. Interface of checking the password

Figure 8. Interface of reset password

IV. COCLUSION

In this paper, an infrared remote control electronic

locks was designed and implemented, the main technical indicators are: the lock opening, password storage, the effective protection of user's password, auto-alarm if the wrong password, unlock the keyboard of the machine, remote unlocking and other functions. Because of infrared remote control used in this lock system, there are many advantages: Infrared launching device use infrared light-emitting diodes miniature remote control transmitter is easy and inexpensive; use digital signal coded modulation to improve anti-interferencewhen signal are transmitted, less misoperation , low power consumpti-on, including other advantages, such as fast response infrared transmission, high transmission efficiency, stable and reliable operation .Based on these advantages, this lock can be widely used in civil doors and warehouse doors. In the information age,in my opinion,the design could play an important part in our daily life and will supplant the tranditon traditional mechanical lock later on.Though there is some points needed to improve, I also make further research on it to improve the funtion.

ACKNOWLEDGMENT

The authors of this paper would like to thank the anonymous reviewers of this paper for their carefully reading of the manuscript as well as their many helpfully suggestions and corrections. This project is supported by the Planning

Project of the National Eleventh-Five Science and Technology (2007BAK34- B04) and the Chinese National Natural Science Fund (60704042) and the Program of 985 Innovation Engineering on Information in Xiamen University (2004-2007).

REFERENCES

[1]Guangfei. Microcontroller C Programming examples guide. [M]. Beijing: Beijing University of Aeronautics and Astronautics Press. [2] Zhou Jing. PROTEUS based on the single-chip system and circuit

design and simulation. [M]. Beijing : Beijing University of Aeron- autics and Astronautics Press.

[3] Han Zhijun. Single-chip design applications - Getting Started guide and design examples. [M]. Machinery Industry Press.

[4] Fu Jiacai. SCM technology works in practice . [M]. Chemical Industry press.

[5] Peng Wei, Huang Ke, Lei Daozhong . Typical single-chip system design example. [M]. Beijing: Press of Electronics Industry. 2006: 299-323.

[6] Ding Yuanjie . Principle and Application of single-chip computer. [M]. Beijing: China Machine Press .2005:45-51.

[7] C51 Compiler User'S Guide.[M] . Keil Elektronik GmbH .And keil Software .Inc.2000.

[8] Atmcl Corporation. 8-bit Microcontroller With4K Bytes In-System Programmable Flash.[M].AtmeICorporation .2001.

[9] MCS-5l family of single chip microcomputers user's mnual.[M].1981 [10] Fenzl Heinz, Kliner Alois. ELECTRONIC LOCK SYSTEM: CONVENIENT AND SAFE. Journal article. 1987, 22(4):150-153. [11] Yongxiong Pan, He Sha, Xiangyang Liu. Practical teaching materials of electronic circuit CAD. [M]. Xi’an: Xi’an electronic

science and technology university publishing company.2001. [12] Ur Rehman, Ejaz. Simple electronic lock uses single-transistor circuit. Journal article. 2003, 51(11):67.

2009年第四届国际计算机新科技与教育论文集

基于单片机的红外遥控电子锁的设计

薛章成 中国厦门大学自动化院 xuezhangcheng@126.com 吴顺祥 中国厦门大学自动化院 wsx1009@163.com

摘要

目前,带有报警功能的键盘电子锁正在逐渐取代传统机械锁,它克服了传统机械锁保密性和可靠性差的缺点。键盘电子锁在技术和性能方面都取得了巨大的进步。本文介绍了一种基于芯片AT89S51开发的远程遥控电子锁。这种锁有两个输入设备,一个是安装在锁上的4*3的矩阵键盘,另一个是同样带有4*3的矩阵键盘的远程控制器。我们可以使用其中的任何一个开锁和修改我们设置的密码。在本次设计中,我采用红外线作为传输中介,因为红外线有着很强的抗干扰能力,能够稳定的传输信息。

关键词-单片机 电子锁 红外遥控 LCD1602

一 、简介

该设计是基于单片机,使用4*3的矩阵键盘和红外远程控制器作为输入,

LCD1602可以显示当你操作步骤时的一些信息。该设计也可以实现密码修改和报警。当要求重设密码时,必须确保输入的密码是正确的,否则会发出声音来提醒你密码是错误的。在此次设计中,我设定密码为6位,就像银行ATM机上的密码一样。如果你想开锁的话就必须输入正确的密码。

二、设计框架

该设计包括六个模块:主控制器模块,LCD1602模块,4*3键盘模块,红外遥控模块,报警模块,模拟开锁模块。

主控制器模块:一个低功耗,高性能CMOS的8位单片机。它使用的是ATMEL公司高密度,非易失性存储技术,与标准指令系统兼容的51单片机。一个8位通用中央处理单元和ISP Flash存储单元集成在这个芯片上。

LCD模块:LCD1602是一个字符液晶显示模块,是一种用来显示字母,数字,符号等等的点阵LCD。考虑到经济和实际因素,采用LCD1602足以满足字符显示上的要求。

4*3键盘模块:由于单片机的I/O口是有限的,所以用矩阵键盘实现电路。这样,我们可以在键盘上设计足够多的按钮而不用占用单片机过多的端口。 红外遥控模块:该设计采用一种通用电视机遥控设备作为输入设备,该设备可以提供一个 广泛的红外编码格式,所以我们使用 编码脉冲宽度调制的格式。 报警模块:该设计中,使用蜂鸣器报警。单片机通过P3.2口输出一个驱动的音频扬声器方波脉冲。

解锁指令:在本设计中,我选择使用LED 灯光来模拟开锁情况。当我们输入密码后,LED灯亮代表锁打开。

4*3键盘 AT89S51 报警电路 单片机 红外遥控模块 LCD1602 图1. 设计框架 A、 矩阵键盘设计

模拟解锁 矩阵键盘工作原理:竖直线通过电阻接+5V电源,当没有按下按键时,竖直

线都处于高电平,否则将和按下按键所在的水平线处于同样的状态。开始,水平线处于低电平。当我们检查竖直线的状态有变化时,说明有按键被按下,此时我们记下P2.4口到P2.6口的状态,然后我们依次使P2.0口至P2.3口为高电平,同时检查P2.4口至P2.6口变化情况,当有变化,我们记下此时P2.0口至P2.3口的状态。这样,我们能知道哪个按键被按下,因为我们已经记下了P2.0口至P2.6口的状态。不同的键有不同编码格式,键盘处理情况如下:首

先确定是否有按键按下,然后确定哪个键被按下,再通过程序获得键码信息。所有键码如下表:

表 1 键码值

EE ED EB E7

DE DD DB D7 BE BD BB B7

图2 4*3键盘电路 B、 红外遥控设计 1)LC7461简介

目前,有很多芯片用来传输红外线,根据编码格式被分为两个主要类别:P

WM和PPM。这里我们选择了比较容易调制的,PWM系列的LC7461芯片。当红外遥控按钮被按下时,它会发送包含编码格式信息的信号。该信号有如下特征:PWM脉宽0.56ms,间隔0.56ms,以1.12ms为一个周期,代表二进制“0”。PWM脉宽0.56ms,间隔1.68ms,以2.24ms为一个周期,代表二进制“1”。上面所提到的“0”和“1”由42位二进制码组成,包含在二次发射的38kHz的调制频率中,用来提高效率并降低功耗,然后通过红外二极管发射出去。

图3 信号组成 2) 红外接收器

红外接收器是包含接收,放大和整形一些列功能的集成元件,无需任何外部

元件,与需要用TTL电平的所有工作兼容,它适合各种红外线遥控和红外信号传输。红外接收器通过中断方式将解调过的信号传送给单片机AT89S51。注意:当没有红外信号时,输出端是高电平,所以我们接收到的信号和之前发送出去的信号是相反的。

3)红外信号的解码

当我们接收到一个包含同步开始的9ms低电平和4.5ms高电平的信号时,

这提示我们准备解码。解码关键是如确定“0”和“1”。根据信号的组成,“0”和“1”都定义为0.56ms低电平开始,唯一的区别是它们高电平的宽度不一样。“0”是0.56ms,“1”是1.68ms。所以我们延迟0.9ms比较当前电平,以识别该信号。流程图如下 :

开始 等待中断 访问解码程序 否 延迟9ms检

查是否高电平 是

获得数据编码 延迟4.5ms准备读数据 获得反码数据 否 否 反码数据是否和数据编码相反 是

根据数据编码转向有输出数据编码

关程序 结束 图4 解码流程图

3)红外遥控器的工作过程

红外发射/接收控制电路使用单片机AT89S51来实现,该电路非常简

单,采用可选择的输出控制方法并且非常实用。该系统具体的工作过程如下:

发射:首先,把来自串行传输口P3.1的数据传送回P1.1口进行内部调制,再从P1.2口发送出去,然后通过红外线发光二级管发射出去,发射距离为10米左右。

接收:红外接收头与发射器配合使用,发射数据至串行端口3.0,然后系统确认发射的数据是否与获得的数据一致,是则开锁,不是则不开锁。

C 、主电路设计

根据分析的设计,单片机电子密码锁电路如下图所示。P0口连接LCD1602的8位数据总线,同时P0口被连接到共阳的8位端口数码管,P0.1口选通LED端口指示灯。P2口访问矩阵键盘电路,P2.5,P2.6和P2.7口分别接LCD1602的RS,RW,E端口。蜂鸣器报警信号由P3.2口输出。

图5 主电路 三、结果

根据该设计,操作结果如下图所示:

图6 解锁画面

当我们想重设密码时,首先,系统会检查我们所输密码是否确。如果密码

正确,我们可以进行下一步,否则系统会发出警告。

图7 修改密码画面

图8 重设密码画面 四、小结

在本文中,一个红外遥控电子密码锁被设计和采用了,它的主要技术指标有:锁的成功开启,密码存储,用户密码的有效保护,输入密码错误能否自动报警,机器键盘的解锁,遥控解锁和一些其它的功能。因为在这个锁的系统中使用了红外遥控功能,所以有许多优点:红外发射器使用的是发光二极管,该红外发射器易操作并且便宜;当信号被传输时,使用数字信号编码调制以提高抗干扰能力;误操作少,低功耗,除此之外还包括其它的优点,比如红外传输

响应快,传输效率高,操作性能稳定可靠。基于上述这些优点,这种锁可以被广泛应用于民用门和仓库门。

在当今信息时代,在我看来该设计可以在我们的日常生活中发挥重要的作用,今后电子锁会取代传统的机械锁,尽管它有需要改善的方面,所以我还将进一步的研究来改善它的功能。

致谢

在此我们想感谢一些匿名的读者,感谢他们仔细的阅读以及他们提出的许多有益的建议和指正。该课题也得到了国家十一五科技项目(2007BAK34- B04),中国国家自然科学基金(60704042)和厦门大学985信息项目创新工程(2004-2007)的大力支持。

原文来源:

Xue zhangcheng,Wu shunxiang.The design of electronic locks based

on infrared remote-Control with MCU .[A]. Nanning:Computer Science & Education, 25-28 July 2009.592~594

本文来源:https://www.bwwdw.com/article/e90f.html

Top