22
Lab 4 Lab 4 ZigBee & 802.15.4 ZigBee & 802.15.4 with PICDEM Z Boards with PICDEM Z Boards 55:088 55:088 Spring 2006 Spring 2006

Lab 4 ZigBee & 802.15.4 with PICDEM Z Boards 55:088 Spring 2006

Embed Size (px)

Citation preview

Page 1: Lab 4 ZigBee & 802.15.4 with PICDEM Z Boards 55:088 Spring 2006

Lab 4Lab 4ZigBee & 802.15.4 with ZigBee & 802.15.4 with

PICDEM Z BoardsPICDEM Z Boards55:08855:088

Spring 2006Spring 2006

Page 2: Lab 4 ZigBee & 802.15.4 with PICDEM Z Boards 55:088 Spring 2006

Everyone has heard of Everyone has heard of 802.11…802.11…

IEEE 802.11 features:Ethernet matching speed, Long range(30-90m)Complexity to handle seamless

roamingMessage forwardingData throughput of 2-11Mbit/s

Page 3: Lab 4 ZigBee & 802.15.4 with PICDEM Z Boards 55:088 Spring 2006

……what about 802.15?what about 802.15?

Specializes in Wireless PAN Specializes in Wireless PAN (Personal Area Network) standards (Personal Area Network) standards

802.15.1 – a.k.a. Bluetooth(1 Mbps)802.15.1 – a.k.a. Bluetooth(1 Mbps) 802.15.2 - Deals with coexistence of 802.15.2 - Deals with coexistence of

Wireless LAN (802.11) and Wireless Wireless LAN (802.11) and Wireless PANPAN

802.15.3 - High-rate WPAN 802.15.3 - High-rate WPAN standards (Wireless USB)standards (Wireless USB)

802.15.4 – a.k.a ZigBee802.15.4 – a.k.a ZigBee

Page 4: Lab 4 ZigBee & 802.15.4 with PICDEM Z Boards 55:088 Spring 2006

What is ZigBee about?What is ZigBee about?

ZigBee can be found in embedded ZigBee can be found in embedded applications requiring low data rates applications requiring low data rates and low power consumptionand low power consumption

Fortunately, it is (relatively) low Fortunately, it is (relatively) low complexity as wellcomplexity as well

Applications include:Applications include: Embedded sensorsEmbedded sensors Medical devicesMedical devices Smoke and intruder alarmsSmoke and intruder alarms Home automation Home automation

Page 5: Lab 4 ZigBee & 802.15.4 with PICDEM Z Boards 55:088 Spring 2006

How does ZigBee form How does ZigBee form networks?networks? Basic Type: Star NetworksBasic Type: Star Networks

Page 6: Lab 4 ZigBee & 802.15.4 with PICDEM Z Boards 55:088 Spring 2006

How does ZigBee form How does ZigBee form networks?networks? More Complex: Cluster NetworkMore Complex: Cluster Network

Page 7: Lab 4 ZigBee & 802.15.4 with PICDEM Z Boards 55:088 Spring 2006

How does ZigBee form How does ZigBee form networks?networks?

Very Complex: Mesh NetworksVery Complex: Mesh Networks

Page 8: Lab 4 ZigBee & 802.15.4 with PICDEM Z Boards 55:088 Spring 2006

What does this have to do What does this have to do with 55:088?with 55:088? Lab 4 will be using 802.15.4 Lab 4 will be using 802.15.4

radios to create a wireless serial radios to create a wireless serial link between two nodeslink between two nodes

Each group will be provided with Each group will be provided with the pair of wireless radios on the pair of wireless radios on development boards from development boards from MicrochipMicrochip

These kits are NOT to be These kits are NOT to be removed from the labremoved from the lab

Page 9: Lab 4 ZigBee & 802.15.4 with PICDEM Z Boards 55:088 Spring 2006

PICDEM Z BoardsPICDEM Z Boards

Page 10: Lab 4 ZigBee & 802.15.4 with PICDEM Z Boards 55:088 Spring 2006

CC2420 Radio ICCC2420 Radio IC

2.4 GHz RF Transceiver2.4 GHz RF Transceiver Connect to microcontrollers via Connect to microcontrollers via

SPISPI Comes on a daughter board with Comes on a daughter board with

the PICDEM Z kitthe PICDEM Z kit 250 kbps data rate250 kbps data rate 2.1V – 3.6V2.1V – 3.6V 19.7 mA (RX)19.7 mA (RX) 17.4 mA (TX)17.4 mA (TX)

Page 11: Lab 4 ZigBee & 802.15.4 with PICDEM Z Boards 55:088 Spring 2006

18LF462018LF4620

Page 12: Lab 4 ZigBee & 802.15.4 with PICDEM Z Boards 55:088 Spring 2006

18LF462018LF4620

Microcontroller found with the Microcontroller found with the PICDEM Z kitsPICDEM Z kits

Overall, very similar to the Overall, very similar to the 18F45218F452

Use the MPLAB and C18 Use the MPLAB and C18 compiler to write code for the compiler to write code for the PICPIC

Page 13: Lab 4 ZigBee & 802.15.4 with PICDEM Z Boards 55:088 Spring 2006

Lab 4 OverviewLab 4 Overview

A text-input GUI on a computer will A text-input GUI on a computer will connect via RS-232 to one of the connect via RS-232 to one of the PICDEM Z boards (we’ll call this the PICDEM Z boards (we’ll call this the Base Station)Base Station)

The other PICDEM Z board will be The other PICDEM Z board will be connected to a Liquid Crystal Display connected to a Liquid Crystal Display (LCD) that will display the text (LCD) that will display the text messages from the base station messages from the base station (we’ll call this the Remote Station)(we’ll call this the Remote Station)

Page 14: Lab 4 ZigBee & 802.15.4 with PICDEM Z Boards 55:088 Spring 2006

Lab 4 OverviewLab 4 Overview

The remote station will have a The remote station will have a couple of “switches” which will couple of “switches” which will either indicate an “on” or “off” either indicate an “on” or “off” statestate

The switch states need to be The switch states need to be sent back to the base station sent back to the base station and displayed on the base and displayed on the base station GUIstation GUI

Page 15: Lab 4 ZigBee & 802.15.4 with PICDEM Z Boards 55:088 Spring 2006

PICDEM Z with LCDPICDEM Z with LCD

Page 16: Lab 4 ZigBee & 802.15.4 with PICDEM Z Boards 55:088 Spring 2006

GUI Layout on Base StationGUI Layout on Base Station

Use whatever language you Use whatever language you wish to create the GUI…wish to create the GUI…

Page 17: Lab 4 ZigBee & 802.15.4 with PICDEM Z Boards 55:088 Spring 2006

Tools that you will use…Tools that you will use…

Microchip has developed code Microchip has developed code that makes interfacing with the that makes interfacing with the 802.15.4 radios vastly easier802.15.4 radios vastly easier

This is called the “stack”This is called the “stack”

Page 18: Lab 4 ZigBee & 802.15.4 with PICDEM Z Boards 55:088 Spring 2006

Tools that you will use…Tools that you will use… In order to utilize the stack:In order to utilize the stack:

MPLAB v 7.31MPLAB v 7.31 C18 CompilerC18 Compiler Microchip ZigBee stack v 3.3Microchip ZigBee stack v 3.3

Look at example files:Look at example files: C:\MpZBee\Source\HCLight\C:\MpZBee\Source\HCLight\ C:\MpZBee\Source\HCRouter\C:\MpZBee\Source\HCRouter\ C:\MpZBee\Source\HCSwitchC\C:\MpZBee\Source\HCSwitchC\

Do NOT alter files in the Stack Do NOT alter files in the Stack directory as this could cause the directory as this could cause the computer (or worse, the TA) to computer (or worse, the TA) to explodeexplode ““Look, but don’t touch”Look, but don’t touch”

Page 19: Lab 4 ZigBee & 802.15.4 with PICDEM Z Boards 55:088 Spring 2006

Zigbee.defZigbee.def

This file should be one of the first This file should be one of the first files you createfiles you create

It selects many key parameters that It selects many key parameters that will define how a particular node will will define how a particular node will operate:operate: Specify Coordinator, Router, or End Specify Coordinator, Router, or End

DeviceDevice Frequencies to operate onFrequencies to operate on Power modePower mode Node addressNode address As well as many others…As well as many others…

Page 20: Lab 4 ZigBee & 802.15.4 with PICDEM Z Boards 55:088 Spring 2006

Callback functionsCallback functions

In the application code that you will In the application code that you will be writing/modifying there are a few be writing/modifying there are a few required functionsrequired functions

These callback functions are named These callback functions are named because the stack calls back to the because the stack calls back to the application to gather more dataapplication to gather more data

Definitions and examples can be Definitions and examples can be found in AN965 and documentation found in AN965 and documentation on the current version of the stackon the current version of the stack

Page 21: Lab 4 ZigBee & 802.15.4 with PICDEM Z Boards 55:088 Spring 2006

Callback function exampleCallback function example

In a coordinator node, we may In a coordinator node, we may wish to determine weather it is wish to determine weather it is okay to accept another node okay to accept another node trying to associate with the trying to associate with the network…network…

BOOL AppOkayToAcceptThisNode(LONG_ADDR *longAddr)BOOL AppOkayToAcceptThisNode(LONG_ADDR *longAddr){{

if (first three bytes of its MAC address match the coordinator)if (first three bytes of its MAC address match the coordinator)return TRUE;return TRUE;

elseelsereturn FALSE;return FALSE;

}}

Page 22: Lab 4 ZigBee & 802.15.4 with PICDEM Z Boards 55:088 Spring 2006