基于CS模型的智能家居网络控制系统
摘要
几年前一些经济比较发达的国家提出了“智能住宅”的概念,住宅智能化是智能家居的先导,智能家居是住宅智能化的核心。智能家居是利用计算机、通讯与网络、自动控制、IC卡技术,通过有效的传输网络,将多元信息服务与管理、物业管理与安防、住宅智能化系统集成,为住宅小区的服务与管理提供高技术的智能化手段,以期实现快捷高效的超值服务与管理,提供安全舒适的家居环境”。
随着计算机技术,通信技术和嵌入式系统的发展,智能家居正逐步走进人们的生活。一个典型的现代智能家居系统提供安防、家电控制、远程抄表和信息服务等功能。低功率和高性能CPU的发展,为开发智能家居提供了现实可能性。其内部构成包括嵌入式处理器、相关支持硬件、嵌入式操作系统以及应用层的软件包等。针对智能家居需求,本文设计并实现了智能家居中的控制系统。采用计算机网络控制方式,结合了基于ARM的嵌入式系统、单片机系统、计算机网络、WIN32编程等技术,实现了对开关型家电的控制。
本文的智能家居控制系统设计方案是:以Philips LPC2103实验板为硬件平台,建立了嵌入式系统开发环境,移植了ucos内核;开发的应用软件分为单片机子系统、PC客户端和PC服务端三个模块。最终完成相关软硬件设计、调试,经测试,完全实现预期功能。最后提出系统改进的方案和措施。
在硬件方面着手于Philips LPC2103芯片的数据手册,通过对其针脚的定义,进行相关电路的设计,实现了单片机串口的通讯、电脑数据的接收和处理、继电器电路的开关和复位电路的实现。
在软件方面,在Delphi 2007中实现了PC服务端和客户端的数据收发和处理,并使服务端在接收到特定字符后发送相应的指令到串口。
基于LPC 2103的智能家居远程控制系统提供了一种对家庭普通家用电器进行远程控制的新思路,是嵌入式的一项有效的尝试和应用。
关键词:LPC 2103,Indy 10,智能家居,远程控制
Abstract
A few years ago a number of economically developed countries put forward the \ smart effective transport network, multi-information services and management, property management and security, for the residential district of order to achieve fast and efficient value for money services and management, providing a safe and comfortable technology and embedded system development, intelligent smart services functions. Low-power and , including embedded processors, related support layer software packages and so on. In response to this phenomenon, this paper designed and implemented one of the intelligent of software and order to experiment board for the Philips 2103 of uc os-core; developed application software, is divided into microcontroller subsystem, PC client and PC server-side three modules. Finalization of the relevant , debug, tested, fully achieve the desired functionality. Concludes with system improvements, programs and measures.
On the the Philips LPC2103 datasheet, through its pin definition of the related circuit design, implementation of the microcontroller serial port communication, computer data reception and processing circuit relay switch and reset circuit implementation.
On the software side, in the Delphi 2007 to achieve a PC server and client for data transmission and processing, to enable the service to a specific character on the receiving end, after sending the appropriate commands to the serial port. LPC 2103-based Remote Control System for Smart Home provides a family for common effective attempt to embed and applications. Key Words: LPC 2103, Indy 10, smart try
IdTCPClient1.IOHandler.Writeln(Cmd);[14] except
if MessageBox(Form1.Handle, PChar('服务端已断开,是否重连?'), PChar('系统提示'), 1) = 1 then begin
IdTCPClient1.IOHandler.Close;清除原来发送的命令,否则在发送命令失败后不能重新连接到服务端 IdTCPClient1.Disconnect; FormCreate(Form1); end else begin
Application.Terminate; Exit; end; end; end;
procedure TForm1.Button1Click(Sender: TObject); begin
Sendinf('opencom');打开串口 end;
procedure TForm1.Button2Click(Sender: TObject); begin
Sendinf('closecom');关闭串口 end;
procedure TForm1.Button3Click(Sender: TObject); begin
Sendinf('openno1');发送指令:打开1号开关 end;
procedure TForm1.Button4Click(Sender: TObject); begin
Sendinf('closeno1'); 发送指令:关闭1号开关 end;
procedure TForm1.Button5Click(Sender: TObject); begin
Sendinf('openno2'); 发送指令:打开2号开关 end;
procedure TForm1.Button6Click(Sender: TObject); begin
Sendinf('closeno2');发送指令:关闭2号开关 end;
procedure TForm1.Button11Click(Sender: TObject); begin
Sendinf('readstatus1');读取1号开关状态 end;
procedure TForm1.Button13Click(Sender: TObject); begin
Sendinf('readstatus2'); 读取2号开关状态 end;
procedure TForm1.Button12Click(Sender: TObject); begin
SendInf(edit1.Text); 发送16进制控制命令 end; end.
4.4 PC机服务端接收软件
如图4.5所示,服务端PC数据接收、处理过程分为判断是否为6个指令中的一个并采取相应的操作。