AddThis

Bookmark and Share

Thursday 27 January 2011

Zigbee Wireless Relay Control and Power Monitoring

This project was proposed by a research/project team here at Cornell working on a so-called “Smart Home Energy Monitoring System.”

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. 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.

· Our project focuses on the House to In-Home Display (IHD) part of this system. 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). These 7 loads are all in parallel, and are fed voltage from a 5 V DC source (the microcontroller). In a real house, the source voltage would be 120 V AC (in the United States at least). 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 shouldn’t depend on the voltages being fed through the relays led us to decide to stick with 5 V DC circuits for testing and simulation.

Background Theory

What we have built is a simple transmission system based on the Zigbee routing and networking protocol. 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”). 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:

mage

Figure 2. The OSI Reference Model (Source: http://en.wikipedia.org/wiki/OSI_model)

The functionality of each layer (or group of layers) is described in a bit more detail below.

Physical Layer

The physical layer's 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 network's 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.

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 layer's 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. 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. 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.

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. 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 (http://www.ieee802.org/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. Zigbee, and most importantly our chips, operate in the higher 2.4 GHz range, so that is the range we will briefly discuss here. 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. 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. This gets transmitted back to the PC to be displayed on a graph in a GUI.