Zigbee无线中继控制和电源监控系统.doc_第1页
Zigbee无线中继控制和电源监控系统.doc_第2页
Zigbee无线中继控制和电源监控系统.doc_第3页
Zigbee无线中继控制和电源监控系统.doc_第4页
Zigbee无线中继控制和电源监控系统.doc_第5页
已阅读5页,还剩29页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

Zigbee无线中继控制和电源监控系统Shrey Surana (ss632) Shrey Surana (ss632)Casey Worthington (cdw38) 凯西沃辛顿 (cdw38)Contents内容Introduction . 1 导言1。Rationale and sources of your project idea . 1 基本原理和思想来源的项目1。Background Theory . 1 背景理论1。Physical Layer . 2 物理层2。Link Layer . 2 链路层2。Network and Transport Layers . 2 网络层和传输层2。Session, Presentation, and Application Layers . 2 会议,简报,以及应用层。2Our Project . 2 我们的项目2。Logical Structure . 2 逻辑结构2。Hardware/Software Tradeoffs . 2 硬件/软件权衡2。Standards . 3 标准3。Software Details . 3 软件的详细信息。3Overview . 3 概述. 3Evolution of Software Design . 3 软件设计的演变3。Software Design, Microcontroller Side . 3 软件设计,单片机侧3。Software Design, PC Side . 3 软件设计,PC端3。Xbee Configuration: A Brief Primer . 6 的XBee配置:简引物6。Our Xbee Configuration . 6 我们的XBee配置6。PC Side: The Coordinator . 6 PC端:协调员6。MCU Side: The End Device . 6 单片机端:终端设备6。Why use Xbee IO to monitor relays controlled by the MCU? . 7 为什么使用单片机的XBee印务局,监察继电器控制的?7。Hardware Details . 7 硬件详细信息7。Arduino Board . 7 阿尔杜伊诺委员会7。Xbee Chip . 7 的XBee芯片7。Relays . 8 继电器8。Things We Tried that Did Not Work (Hardware) . 8 事情我们试过了没有工作(硬件)8。Results of the design . 9 设计结果的9。Speed of execution . 9 执行速度9。Accuracy . 9 精度9。How you enforced safety in the design . 9 你如何实施设计中的安全9。Interference with other peoples designs . 9 干扰与人的其他设计9。Usability by you and other people . 9 可用性你和其他人9。Conclusions . 9 结论9。Overview . 9 概述. 9Things We Could Improve Upon . 9 事情是我们可以改善我们9。IP Considerations . 10 IP注意事项10。Ethical considerations. 道德方面的考虑。 10 10Societal Impact . 10 社会影响10。Legal considerations . 10 法律方面的考虑10。Hardware . 10 硬件10。Software . 10 软件10。Appendix of Code . 11 附录代码11。Appendix of Schematics . 12 附录示意图12。Appendix of Cost . 12 附录成本12。Appendix: Member Tasks . 13 附录:会员任务13。Shrey Surana . 13 Shrey Surana 13。Casey Worthington . 13 凯西沃辛顿13。References . 13 参考文献13。Data Sheets . 13 数据表13。Vendor Sites . 13 供应商的网站13。Code and Designs Borrowed From Others . 13 代码和设计借鉴了其他13。Background Sources . 13 背景来源13。Acknowledgements . 13 致谢13。Introduction 简介We designed a system for wirelessly controlling relays and monitoring current.我们设计了一个无线控制继电器和监测当前的系统。 This is used for a home load simulation.这是用于家庭负载模拟。 By wirelessly turning relays on and off by sending commands from a PC to a microcontroller we can change the total load (current) to our simulated home.通过无线方式打开和关闭继电器从PC发送命令到微控制器,我们可以改变我们的模拟家用总负载(电流)。 For wireless communication, we used XBee Series 2 Zigbee RF modules.对于无线通信中,我们使用的XBee系列2 ZigBee射频模块。 One of these modules was connected to a microcontroller and the home load simulation, while another was connected to the PC, which was used for collecting and displaying data as well as for relay monitoring and control.这些模块之一,是连接到微控制器和家庭模拟加载,而另一个是连接到PC,这是收集和展示为继电器监测和控制数据以及使用。Rationale and sources of your project idea 思想的基本原理和你的项目来源This project was proposed by a research/project team here at Cornell working on a so-called “Smart Home Energy Monitoring System. Our points of reference within this group are Professor John Belina ( ) and Kamil Bojanczyk ( ).该项目是由一个研究/智能家居系统能源监测“项目的团队在康奈尔大学工作的一个所谓的。我们在本组的参考点是教授约翰Belina( )和卡米尔Bojanczyk ( )。What this group is working on is an energy-monitoring system for a home using alternative energy sources.这个集团是什么工作,是一个使用替代能源的家庭能源监测系统。 A very high-level block diagram of this system is shown below:非常高的级别该系统的框图如下:Figure 1.图1。 High-level diagram of the Smart Home Energy Monitoring System.高级别图“智能家庭能源监测系统。”In the above diagram, the “Magic Box” essentially exists to route energy between the house, the various energy sources (for example, a solar cell or the electric grid), and an energy storage unit (such as a rechargeable battery).在上面的图中,“魔术盒”的存在是为了基本路线之间的众议院能源,各种能源(例如,太阳能电池或电网)和一个能量存储单元(如充电电池)。 In this project, we will “black box” this Magic-Box system, and instead focus on another portion of this energy monitoring system, which involves sending data regarding energy usage and various energy loads (by wirelessly controlled relays) to a PC in order to display and monitor energy usage within the home.在这个项目中,我们将“黑盒子”这个魔术盒系统,而是集中在另一本能源监测系统,它包括发送数据在能源使用和各种能源负载(由无线控制继电器)的一部分,以便到PC显示和监测在家庭能源消耗。 Our project focuses on the House to In-Home Display (IHD) part of this system.我们的项目集中到在众议院在家庭显示器(IHD的)这个系统的一部分。 What our project does is the following:我们做什么项目如下: Simulates a home by using resistors to model various appliances or groups of appliances模拟家庭使用电阻来模拟各种用具或设备组 Allows a user to wirelessly turn on and off various sets of appliances by controlling relays允许用户以无线方式打开和关闭各种成套设备通过控制继电器 Monitors total power consumption and current in this home显示器总功率消耗,在这个家里电流 Wirelessly transmits the above data to a PC, displaying the data on a graph that shows real-time power consumption in the home (or simulated home)上述数据无线传输到电脑,显示在图上显示实时的家用电源消耗(或模拟的家庭)中的数据Our simulated “home” consists of 7 appliances, each modeled by a resistance (a load).我们模拟的“家”由7用具,用电阻(负载)为蓝本每个。 These 7 loads are all in parallel, and are fed voltage from a 5 V DC source (the microcontroller).这7个都在并行加载,并美联储从5 V直流源(微控制器)电压。 In a real house, the source voltage would be 120 V AC (in the United States at least).在实际的房子,电源电压120伏交流会(在美国至少)。 We considered attempting to implement this, but considering the practical dangers of “playing around” with 120 V AC circuits as well as the fact that a relay control system shouldnt depend on the voltages being fed through the relays led us to decide to stick with 5 V DC circuits for testing and simulation. 我们认为试图实现这一点,但考虑“玩弄”的120伏交流电电路,这样一个事实:继电器控制系统不应依赖于正在通过继电器的电压以及美联储的现实危险使我们决定坚持5 V直流测试和模拟电路。Background Theory 背景理论What we have built is a simple transmission system based on the Zigbee routing and networking protocol. 我们已经建立是一个简单的传输系统协议基于ZigBee路由和网络。 This protocol and its details are discussed in greater detail in the Standards section (below); in this section, we focus on underlying network theory and the role this theory played in our project. 本议定书和它的细节更详细地讨论在标准节(下),在这节中,我们侧重于基础网络理论与我们的项目中的作用发挥这一理论。Data networks (and transmission systems) are typically divided into various layers based on functionality. 数据网(与传输系统)是典型的基于功能分成不同的层次。 This is sometimes called a “protocol stack” (in our case, we are using a “Zigbee stack”). 这有时被称为一个“协议栈”(在我们的例子中,我们使用的是“ZigBee协议栈”)。 Essentially, the lower the layer, the closer we are to worrying about actual physical electrons flying around. 从本质上讲,层越低,越接近我们要担心实际物理电子飞来飞去。 Conversely, the higher the layer, the less we are worrying about physical constraints and the more abstract the data structures are that we are dealing with and manipulating. 相反,较高的层,那么我们担心的物理限制和更抽象的数据结构是,我们正在处理和操作。The most famous of these layering models is the Open System Interconnection (OSI) Reference Model, which is shown below: 其中最有名的这些分层模型是开放系统互联(OSI)参考模型,它是如下所示: Figure 2.图2。 The OSI Reference Model (Source: /wiki/OSI_model) OSI参考模型(来源:/wiki/OSI_model)The functionality of each layer (or group of layers) is described in a bit more detail below. 本)功能的每一层(或组层位中描述更详细说明。Physical Layer 物理层 The physical layers job is to move individual digital bits from one place to another. 物理层的工作是从一个地方到另一个个人数码位。 The protocols in this layer depend on the actual physical medium. 在这一层的协议依赖于实际的物理介质。 For example, in a wireless system, the actual physical medium is simply the atmosphere. 例如,在一个无线系统,实际的物理介质是简单的气氛。Link Layer 链路层 A networks link layer routes a series of bits (sometimes called a datagram ) from one node in a network to another. 一个网络的链路层路线的一系列位从 一个网络节点 (有时 ) 称为 数据包 到另一个地方。 This can happen through a series of intermediate switches (or routers). 这可能发生通过)系列交换机或路由器中间(。 Protocols at this layer provide more robust and full-featured services than protocols at the physical layer. 在这层协议提供服务而不是在物理层协议功能强大,更全面。 WiFi is one example of a link-layer protocol. WiFi是一种协议的一个例子链路层。Network and Transport Layers 网络层和传输层Again, since these layers are higher in the model, protocols at this layer typically are more full-featured than protocols at the link or physical layers. 同样,因为这些层较高的模型,在此协议层通常是更全面的功能比在链路层协议或身体。 Protocols at these layers use the link layers routing capabilities to move the aforementioned datagrams between nodes in a network. 在这些层协议使用的链路层的路由功能,移动网络节点之间的上述 数据报 。 The Internet Protocol (IP) is probably the most famous network layer protocol, while the Transmission Control Protocol (TCP) and the User Datagram Protocol (UDP) are two examples of well-known and widely-used transport-layer protocols. 因特网协议(IP)可能是最有名的网络层协议,而传输控制协议(TCP)和用户数据 报协议(UDP)协议的例子有两个知名的和广泛使用的传输层。 Certain higher-level functionality is more prevalent in these two layers than in lower levels. 某些更高级别的功能是越层普遍比在这两个较低的水平。 For example, flow control controlling the transmission rate between nodes in order to lower congestion on the network (realizing that even just a two-node transmission system can be considered a “network”) and reliable transmission (ensuring that a packet is actually received) are two features commonly implemented in the network and transport layers. 例如,流量控制-为了控制节点之间的传输速率降低)的网络拥塞(意识到,甚至只是一个两节点的传输系统可以被认为是“网络” -可靠的传输(确保数据包实际上是收到)是传输层的功能一般两年实施的网络。Session, Presentation, and Application Layers 会议,演示和应用层These layers are essentially the end-result of a networking protocol stack. 这些层在本质上是最终结果栈网络协议。 For example, a web browser resides in the application layer. 例如,Web浏览器驻留在应用层。 These layers make use of all of the lower layers to send data between nodes on a network, and then use their own protocols for manipulating that data. 这些层使层使用较低的所有发送网络上的节点之间的数据,然后使用自己的协议来操纵数据。 A web browser renders HTML but uses lower-level protocols to send HTML between nodes in a network. 呈现HTML网页浏览器,但使用较低级别的协议来发送网络节点之间的HTML中。Our Project 我们的项目The part of our project that we implemented basically deals with the network layer and above. 该项目的一部分,我们,我们基本上实现上述处理的网络层和。 The XBee chips (which are discussed in much greater detail later in the report) and firmware allow us to “black box” the Data Link and Physical layers, and the open source Xbee-API and Xbee-Arduino software packages greatly simplified our work in the network layer. 该芯片的XBee(这是更详细讨论后,在报告)和固件让我们“黑盒子”中的数据链路和物理层,和开源的XBee - API的和XBee -阿尔杜伊诺软件极大地简化了我们的工作网络层。 Thus, it was not strictly necessary for us to have a deep understanding of the underlying physical, link, and network layer protocols used, but a brief discussion of this is warranted nonetheless. 因此,它不是完全有必要让我们能够有一个,链接的深刻理解的基础物理和网络层协议使用,但这个简短的讨论是必要的仍然。The physical layer protocol/standard used in Zigbee systems is IEEE 802.15.4 ( /15/pub/TG4.html ). 物理层协议/标准系统使用在Zigbee是IEEE 802.15.4( /15/pub/TG4.html )。 This is a wireless standard that operates, in North America, in the range of 2400-2483.5 MHz or 902-928 MHz. 这是一个无线标准,经营美国,北,在兆赫范围2400-2483.5 MHz或902-928。 Zigbee, and most importantly our chips, operate in the higher 2.4 GHz range, so that is the range we will briefly discuss here. ZigBee和最重要的是我们的芯片,工作在更高的2.4 GHz频率范围,所以这是我们将简要的范围在这里讨论。 The data transmission rate is up to 250 kilobits per second. 数据传输速率达到每千位二百五十秒。Logical Structure 逻辑结构A block diagram of our system is shown below.我们的系统框图如下所示。 As you can see there are seven relays which are controlled by the MCU.正如你可以看到其中有七个是由单片机控制继电器。 The MCU gets its command from the Xbee Chip which is wirelessly transmitted from another Xbee chip that is connected to the PC.从得到的单片机芯片,无线的XBee另一个的XBee芯片连接到电脑发送的命令。 The user can specify from the PC which relays they want to turn on and off.用户可以从电脑中指定的继电器他们要打开和关闭。 Also all seven of the relays load goes through a .2 ohm power resistor which goes through an optoisolator to keep it safe from the MCU and finally to the Xbee chip.另外所有负载的继电器七经过一个0.2欧姆的电阻,电源通过一个光隔离器去保证它的安全从MCU,最后到的XBee芯片。 This gets transmitted back to the PC to be displayed on a graph in a GUI.这得到传回的电脑上,在一个GUI图形显示。Figure 3.图3。 High-level design overview of our project.高级别我们的项目设计的概述。Hardware/Software Tradeoffs 硬件/软件权衡We didnt really have much hardware/software tradeoffs because we didnt have a budget constraint since we were working for a project team.我们并没有真正有很多硬件/软件的权衡,因为我们没有一个预算约束,因为我们是一个项目团队工作。 However we did decide to use an Arduino board instead of the STK500 which we were used to.但是,我们也决定使用,而不是我们被用于STK500的一阿尔杜伊诺板。 This required less software for us to write.这就要求我们少写软件。 It seemed much less tedious to write certain tasks in Arduino such as turning on an LED.这似乎更繁琐,如写一个LED的转折点Arduino的某些任务。 We were interested in expanding our knowledge of other hardware/software that were similar but not exactly the same as what we had learned throughout the semester.我们有兴趣扩大我们的其他硬件/软件知识相似,但并不像我们在整个学期学到的完全一样。 Other than that we did not have to do any other sort of tradeoff between hardware and software.除此之外,我们没有做任何的硬件和软件之间的权衡其他排序。标准The most relevant standard for our project is the Zigbee wireless networking standard, which is IEEE 802.15.4.最适合我们的项目相关的标准是ZigBee无线网络标准,这是IEEE 802.15.4。 The reason we chose Zigbee over WiFi (802.11) or another RF standard was twofold.我们之所以选择了通过WiFi(802.11)或其他RF标准是双重的Zigbee技术。 First, it consumes a very low amount of power, which could be very useful on the MCU-end of our transmission system (see Tentative Design section).首先,它消耗的功率非常低的金额,这可能是非常单片机对我们的传输系统端(见初步设计部分)非常有用。 And second, it is (apparently) of much lower complexity than WiFi, making it easier to implement.第二,它为(显然)远低于无线的复杂性,使得它更容易实现。 It has a lower data rate than WiFi (only up to 250 Kbits/second) but is still easily capable of transmitting the relatively low amounts of data that are necessary in this domain.它具有较低的数据速率比无线(只到250千位/秒),但仍然很容易传输的数据都需要在这一领域的相对低量的能力。 The main feature of this standard is the necessity of achieving technological simplicity, low operation cost, and low manufacturing cost without sacrificing flexibility or generality.本标准的主要特点是实现不牺牲灵活性或一般性的技术简单,运行成本低,制造成本低的必要性。Software Details 软件详细信息Overview 概述The software portion of this project consists of two main applications: one for an Arduino-based microcontroller unit, and another for the PC. Arduino , as discussed in the hardware section, is an “open-source electronics prototyping platform” based on Atmel microcontrollers (in our case, an ATMega328) and its own Arduino programming language .该计划的软件部分包括两个主要应用:为一阿尔杜伊诺为基础的微控制器和彼此。筹委会一阿尔杜伊诺 ,如部分讨论的硬件,是一个“开放的源电子原型平台”基于Atmel微控制器(在我们的情况下,ATMega328)和自己的Arduino编程语言 。 This language is very similar to C/C+, and the programming paradigm is almost exactly the same as it is when writing in C for AVR-GCC and Atmel MCUs.这种语言是非常相似的C / C + +和编程范式是几乎完全一样,因为它是用C编写时的AVR - GCC和爱特梅尔微控制器的。On the PC side, we used Java to interact with an XBee chip connected through either a serial or a USB port (in other words, the XBee is recognized as a serial device on the PC).在PC方面,我们使用Java进行交互通过串行或USB端口连接一的XBee芯片(换句话说,该的XBee是PC上的串行设备识别)。Evolution of Software Design 软件设计的演变The reason for choosing a Java-Arduino based system is simple: we found a pair of very well-documented open source (GPLv3) projects implementing an API for data transmission using XBee chips and the Zigbee protocol.在选择Java的阿尔杜伊诺基础的系统的原因很简单:我们发现了一个非常良好的记录开源(GPLv3的)执行数据使用的XBee芯片和ZigBee协议传输的空气污染指数的项目配对。 These projects are:这些项目是:- - XBee-API : This is for the PC side. 的XBee - API的 :这是用于PC端。 It is a Java software library with the goal of providing “a flexible and simple to use API to interact with XBee radios.这是一个与提供“灵活,简单易用的API进行交互的XBee收音机目标Java软件库。- - XBee-Arduino : This is very similar to the XBee-API package (and was written by the same person), but is for Arduino-based micrcontroller platforms rather than PCs. 的XBee -阿尔杜伊诺 :这是非常类似的XBee - API包(并且是由同一人的手笔),但电脑是阿尔杜伊诺的micrcontroller平台,而不是。We had originally intended to implement much simpler (read: dumber) pieces of software ourselves to provide a minimal subset of the functionality found in the above two packages.我们原本打算实施更简单(阅读:笨)软件致力于提供一个最小的子集的功能在上面发现两个包件。 However, as we learned more and more about the XBee chips and their operation, we realized our project would be much better if, rather than reinventing the wheel, we focused on learning how to use and extend solutions that were already available.然而,当我们越来越多的有关其运作的XBee芯片和教训,我们意识到我们的项目会好得多,如果不是重新发明轮子,我们专注于学习如何使用和扩展解决方案,已经可用。 The stages of our high-level software design (and intentions) are briefly outlined below.我们的高层次软件设计(和意图)的各个阶段进行了简要概述如下。1. 1。 We originally looked into using either Java or C# for the PC side of our application.我们原先使用的看着我们的应用PC端Java或C的。 These are the two programming languages we were most familiar with, and are also two of the most widely-used and full-featured languages available today.这是两种编程语言,我们最熟悉的,也是最广泛使用的全功能的语言当今两个。 We spent about a week researching how to communicate through serial ports in these two languages, and found out that C# offered much better support for this.我们花了大约一个研究如何通过串行端口进行通信这两种语文周,并发现了C提供了这么多的更好的支持。 However, the downside to C# is that its not nearly as multi-platform friendly as Java is.然而,到C的缺点是,它几乎没有多平台的Java友好的。 Java is implemented and updated as a runtime environment on all major operating systems (Windows, Mac OS, Linux) whereas C# is a “standard” language (in the sense that anyone can read the language specification and write a compiler for it) but is generally used for Windows development using Visual Studio. Java是实施和作为所有主要作业系统而C(在Windows,Mac作业系统,Linux)运行环境更新的“标准”的语言(在这个意义上,任何人都可以读取的语言规范,为它写一个编译器),但一般用于Windows使用Visual Studio开发。 An open-source alternative to Visual Studio, called Mono , is available, however, so we also looked into using this during the first week.一个开放源码的替代到Visual Studio中,所谓的单声道 ,可用,但是,我们也研究过周在第一次使用这个。2. 2。 After realizing in our first week of research that serial communication with Java was someone nontrivial and with C# might be difficult on non-Windows platforms, we turned to Python.经过研究,实现我们的第一个星期与Java串行通信是有人平凡和C可能是在非Windows平台的困难,我们转向了Python。 We found an open-source

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论