2 sensors expo gislason

Upload: pantera226

Post on 09-Apr-2018

225 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/8/2019 2 Sensors Expo Gislason

    1/33

    11

    Application Development ForApplication Development For

    ZigBee Wireless NetworkingZigBee Wireless Networking

    By San Juan SoftwareBy San Juan Software

    Presented by Drew Gislason

    [email protected]

    Voice: (360) 243-7407 Mobile: (206) 214-7884

    190-101-01

  • 8/8/2019 2 Sensors Expo Gislason

    2/33

    22

    Presentation OverviewPresentation Overview

    Why ZigBee?Why ZigBee?

    ZigBee ArchitectureZigBee Architecture

    ZigBee Application DevelopmentZigBee Application Development

    Sample ApplicationSample Application Lighting DemoLighting Demo

  • 8/8/2019 2 Sensors Expo Gislason

    3/33

    33

    Why ZigBee?Why ZigBee?

    A global hardware and softwareA global hardware and software

    standardstandard

    forfor

    wirelessly networking deviceswirelessly networking devices

    Highly reliableHighly reliable

    Low costLow cost Low powerLow power

    Low data rateLow data rate

    Highly secureHighly secure

  • 8/8/2019 2 Sensors Expo Gislason

    4/33

    44

    ZigBee StandardZigBee Standard -- EcosystemEcosystem

    OEMsOEMs PlatformPlatform

    Development ToolsDevelopment Tools

    TrainingTraining

    Custom Engineering & ServicesCustom Engineering & Services

    GatewaysGateways

    ModulesModules

  • 8/8/2019 2 Sensors Expo Gislason

    5/33

    55

    ZigBee StandardZigBee Standard -- InteroperableInteroperable

    ZigBee Alliance ensures interoperabilityZigBee Alliance ensures interoperabilitywith conformance testswith conformance tests

    Level 1 (L1)Level 1 (L1) MAC/PHYMAC/PHY

    Level 2 (L2)Level 2 (L2) Networking profileNetworking profile

    Level 3 (L3)Level 3 (L3)Application profileApplication profile

    Compatibility ensured through approvedCompatibility ensured through approvedtest houses and at ZigBeetest houses and at ZigBee interopinterop eventsevents

  • 8/8/2019 2 Sensors Expo Gislason

    6/3366

    ZigBee Wireless NetworkingZigBee Wireless Networking

    Star Network(Simplest)

    Coordinator End Device (RFD)

    Mesh Network(Best Reliability)

    Cluster Tree Network(Large Scale Networks)

    Router (FFD)

  • 8/8/2019 2 Sensors Expo Gislason

    7/33

    77

    ZigBee Mesh NetworkingZigBee Mesh Networking

    Node

    Node

    NodeNode

    Increase range, increased reliability (self-healing),

    and ad-hoc network formation

    Node

  • 8/8/2019 2 Sensors Expo Gislason

    8/33

    88

    Node

    Node

    NodeNode

    Node

    Barrier

    Increase range, increased reliability (self-healing),

    and ad-hoc network formation

    ZigBee Mesh NetworkingZigBee Mesh Networking

  • 8/8/2019 2 Sensors Expo Gislason

    9/33

    99

    ZigBeeZigBee Highly ReliableHighly Reliable

    Mesh and tree networking protocolMesh and tree networking protocolprovides redundant pathsprovides redundant paths

    Automatic retries and acknowledgementsAutomatic retries and acknowledgements

    Broadcast delivery scheme ensuresBroadcast delivery scheme ensuresreliable broadcasts across the networkreliable broadcasts across the network

    Parents keep track of messages forParents keep track of messages forsleeping childrensleeping children

  • 8/8/2019 2 Sensors Expo Gislason

    10/33

    1010

    ZigBeeZigBee Highly SecureHighly Secure

    Utilizes AES 128Utilizes AES 128--bit encryptionbit encryption Concept of a trust centerConcept of a trust center Link and network keysLink and network keys

    Authentication and encryptionAuthentication and encryption Security can be customized for theSecurity can be customized for the

    applicationapplication Keys can be hardKeys can be hard--wired into applicationwired into application

  • 8/8/2019 2 Sensors Expo Gislason

    11/33

    1111

    RESIDENTIAL/

    LIGHT

    COMMERCIAL

    CONTROL

    CONSUMER

    ELECTRONICS

    TVTV

    DVD/CDDVD/CD

    remoteremotecell phonecell phone

    PRECISION

    AGRICULTURE

    INDUSTRIAL

    CONTROL

    asset mgtasset mgt

    processprocess

    controlcontrolenvironmentalenvironmental

    energy mgtenergy mgt

    PERSONAL

    HEALTH CARE

    BUILDING

    AUTOMATION

    securitysecurity

    HVACHVAC

    AMRAMRlighting controllighting control

    accessaccess controlcontrol

    irrigationirrigationfertilizerfertilizer

    golf coursegolf course

    farmfarm

    ranchranch

    securitysecurity

    HVACHVAC

    lighting controllighting control

    access controlaccess controllawn & gardenlawn & garden

    irrigationirrigation

    patientpatientmonitoringmonitoring

    fitnessfitness

    monitoringmonitoring

    ZigBeeZigBeeWireless Control thatWireless Control that

    Simply WorksSimply Works

  • 8/8/2019 2 Sensors Expo Gislason

    12/33

    1212

    Presentation OverviewPresentation Overview

    Why ZigBee?Why ZigBee?

    ZigBee ArchitectureZigBee Architecture

    ZigBee Application DevelopmentZigBee Application Development Sample ApplicationSample Application Lighting DemoLighting Demo

  • 8/8/2019 2 Sensors Expo Gislason

    13/33

    1313

    ZigBee FrameworkZigBee Framework

    Application &

    Profiles

    Network &Security Layers

    Application

    Framework

    MAC Layer

    PHY Layer

    IEEE 802.15.4

    ZigBeeSpecification

    Application

    ZigBee Stack

    Hardware

  • 8/8/2019 2 Sensors Expo Gislason

    14/33

    1414

    IEEE 802.15.4 FrequencyIEEE 802.15.4 Frequency

    and Data Ratesand Data Rates

    BANDBAND COVERAGECOVERAGE DATA RATEDATA RATE # OF CHANNEL(S)# OF CHANNEL(S)

    2.4 GHz ISM2.4 GHz ISM WorldwideWorldwide 250 kbps250 kbps 1616

    868 MHz868 MHz EuropeEurope 20 kbps20 kbps 11

    915 MHz ISM915 MHz ISM AmericasAmericas 40 kbps40 kbps 1010

  • 8/8/2019 2 Sensors Expo Gislason

    15/33

    1515

    802.15.4 Technical Details802.15.4 Technical Details Direct Sequence Spread SpectrumDirect Sequence Spread Spectrum

    provides excellent performance in lowprovides excellent performance in lowSNR environmentsSNR environments

    CSMACSMA--CA used for collision avoidanceCA used for collision avoidance OO--QPSK and BPSK minimize powerQPSK and BPSK minimize power

    consumption and reduce complexityconsumption and reduce complexity HalfHalf--duplex operationduplex operation

  • 8/8/2019 2 Sensors Expo Gislason

    16/33

    1616

    ZigBee FrameworkZigBee Framework

    Application &

    Profiles

    Network &Security Layers

    Application

    Framework

    MAC Layer

    PHY Layer

    IEEE 802.15.4

    ZigBeeSpecification

    Application

    ZigBee Stack

    Hardware

  • 8/8/2019 2 Sensors Expo Gislason

    17/33

    1717

    Physical (PHY) Layer

    Security

    Service

    Provider

    PD-SAP

    APSSE-SAP

    NLSE-SAP

    PLME-SAP

    Medium Access Layer (MAC) Layer

    MLME-SAPMCPS-SAP

    Network (NWK) Layer

    NLME-SAP

    NLDE-SAP

    Application Support (APS) Sub-Layer

    APSDE-SAP APSDE-SAP APSDE-SAPAPSME-SAP

    Application Framework

    Application

    Object 240

    [On Endpoint 240]

    Application

    Object 1

    [On Endpoint 1]

    ZPUI ZigBee Device

    Object (ZDO)

    [On Endpoint 0]

    ZigBee ArchitectureZigBee Architecture

  • 8/8/2019 2 Sensors Expo Gislason

    18/33

    1818

    ZigBee Networking Stack FeaturesZigBee Networking Stack Features Reliable 2Reliable 2--way wireless communicationsway wireless communications

    Choice of star, mesh and tree topologiesChoice of star, mesh and tree topologies Device service discoveryDevice service discovery

    Broadcast servicesBroadcast services Gateway (multiGateway (multi--network) servicesnetwork) services Device interoperability through profilesDevice interoperability through profiles

    Security managementSecurity management No common C API among stack vendorsNo common C API among stack vendors

  • 8/8/2019 2 Sensors Expo Gislason

    19/33

    1919

    Presentation OverviewPresentation Overview

    Why ZigBee?Why ZigBee?

    ZigBee ArchitectureZigBee Architecture

    ZigBee Application DevelopmentZigBee Application Development Sample ApplicationSample Application Lighting DemoLighting Demo

  • 8/8/2019 2 Sensors Expo Gislason

    20/33

    2020

    Components For ZigBee DevelopmentComponents For ZigBee Development

    Development platformDevelopment platform 802.15.4 radio802.15.4 radio Development boardDevelopment board

    ZigBee compatible networking stackZigBee compatible networking stack

    Development toolsDevelopment tools Editor/IDEEditor/IDE Cross compilerCross compiler

    Debugging toolsDebugging tools

    WorkstationWorkstation

  • 8/8/2019 2 Sensors Expo Gislason

    21/33

    2121

    Freescale SARD (DIG 536) BoardFreescale SARD (DIG 536) Board

  • 8/8/2019 2 Sensors Expo Gislason

    22/33

    2222

    ZigBee RF ModulesZigBee RF Modules

    Panasonic ZigBee ModulePanasonic ZigBee Module Will be available through Arrow Q2 2005Will be available through Arrow Q2 2005 Freescale MC13193, HCS08, Dipole AntennaFreescale MC13193, HCS08, Dipole Antenna

    MaxstreamMaxstream XBeeXBee ZigBee Module ZigBee ModuleAvailable nowAvailable now

    Freescale MC13193,Freescale MC13193,HCS08, Dipole AntennaHCS08, Dipole Antenna

  • 8/8/2019 2 Sensors Expo Gislason

    23/33

    2323

    Development ProcessDevelopment Process Write the ZigBee applicationWrite the ZigBee application

    Compile for target MCUCompile for target MCU Download binary code into ZigBeeDownload binary code into ZigBee

    nodes using BDM/JTAG, serial port ornodes using BDM/JTAG, serial port oroverover--thethe--airair

    Reset nodes and debug themReset nodes and debug them Repeat as necessaryRepeat as necessary

  • 8/8/2019 2 Sensors Expo Gislason

    24/33

    2424

    Debugging The NetworkDebugging The Network

    BDM/JTAGBDM/JTAG

    one node at a timeone node at a time

    Packet Packet SniffersSniffers

    Debug info (e.g. printf() / monitor)Debug info (e.g. printf() / monitor)

    LEDsLEDs, other on, other on--board indicatorsboard indicators

    SimulationSimulation NS2NS2

    Keep it simpleKeep it simple

  • 8/8/2019 2 Sensors Expo Gislason

    25/33

    2525

    DaintreeDaintree Sensor Network AnalyzerSensor Network Analyzer

    Capture network dataCapture network data View based on fieldView based on field

    Customizable forCustomizable forapplicationapplication

    Visual view into theVisual view into thenetworknetwork

  • 8/8/2019 2 Sensors Expo Gislason

    26/33

    2626

    Presentation OverviewPresentation Overview

    Why ZigBee?Why ZigBee?

    ZigBee ArchitectureZigBee Architecture

    ZigBee Application DevelopmentZigBee Application Development Sample ApplicationSample Application Lighting DemoLighting Demo

  • 8/8/2019 2 Sensors Expo Gislason

    27/33

    2727

    ZigBee Interoperable ApplicationZigBee Interoperable Application

    Buy products from multiple vendorsthat simply work

  • 8/8/2019 2 Sensors Expo Gislason

    28/33

    2828

    Home Lighting ControlHome Lighting ControlLight Switch Light

  • 8/8/2019 2 Sensors Expo Gislason

    29/33

    2929

    APSDEAPSDE--DATA.requestDATA.request

    ))

    Broadcast radius (broadcast transmissions only)Broadcast radius (broadcast transmissions only)RadiusCounterRadiusCounter

    Route discovery overrideRoute discovery overrideDiscoverRouteDiscoverRoute,,

    Security, NWK key, acknowledgement selectSecurity, NWK key, acknowledgement selectTxOptionsTxOptions,,

    The application dataThe application dataasduasdu,,

    The length ofThe length ofasduasdu and

  • 8/8/2019 2 Sensors Expo Gislason

    30/33

    3030

    afFillAndSendMessageafFillAndSendMessageafStatus_t afFillAndSendMessage (

    afAddrType_t *dstAddr, byte srcEndPoint, byte clusterID,

    byte TransCount,

    byte FrameType,

    byte *TransSeqNumber,

    byte CommandType,byte AttribDataType,

    uint16 AttribId,

    byte ErrorCode,

    byte DataLength, byte *Data,byte txOptions, byte DiscoverRoute, byte RadiusCounter );

  • 8/8/2019 2 Sensors Expo Gislason

    31/33

    3131

    Switch Load Control Source CodeSwitch Load Control Source Code/***************************************************************/**************************************************************************** @fn SLC03394_RcvSET_OnOffSRC* @fn SLC03394_RcvSET_OnOffSRC**

    */*/byte SLC03394_RcvSET_OnOffSRC( bytebyte SLC03394_RcvSET_OnOffSRC( byte endPointendPoint, uint16, uint16AttribIdAttribId, byte State), byte State)

    {{bytebyte ledsleds;;if (State ==if (State == OnOffSRC_ONOnOffSRC_ON))

    SLC03394_State =SLC03394_State = OnOffSRC_ONOnOffSRC_ON;;else if (State ==else if (State == OnOffSRC_OFFOnOffSRC_OFF))

    SLC03394_State =SLC03394_State = OnOffSRC_OFFOnOffSRC_OFF;;

    else if (State ==else if (State == OnOffSRC_TOGGLEOnOffSRC_TOGGLE)){{// Make sure SLC03394_State matches// Make sure SLC03394_State matches LEDsLEDsledsleds == SetLedSetLed( LED_NONE, LED_ON );( LED_NONE, LED_ON );SLC03394_State = (SLC03394_State = ( ledsleds & LED4 ) ?& LED4 ) ? OnOffSRC_ONOnOffSRC_ON :: OnOffSRC_OFFOnOffSRC_OFF;;// Toggle, if current state is ON// Toggle, if current state is ON ----> OFF, OFF> OFF, OFF ----> ON> ONif (SLC03394_State ==if (SLC03394_State == OnOffSRC_ONOnOffSRC_ON))

    SLC03394_State =SLC03394_State = OnOffSRC_OFFOnOffSRC_OFF;;elseelse

    SLC03394_State =SLC03394_State = OnOffSRC_ONOnOffSRC_ON;;}}osal_set_eventosal_set_event( SLC03394_taskID, SLC03394_STATE_CHANGED_EVT );( SLC03394_taskID, SLC03394_STATE_CHANGED_EVT );return ( ERRORCODE_SUCCESS );return ( ERRORCODE_SUCCESS );

    }}

  • 8/8/2019 2 Sensors Expo Gislason

    32/33

    3232

    Switch Remote Control Source CodeSwitch Remote Control Source Code/***************************************************************/**************************************************************************** @fn SRC03391_Set_OnOffSRC* @fn SRC03391_Set_OnOffSRC*** @brief Sends a SET command for* @brief Sends a SET command for OnOffSRCOnOffSRC Cluster.Cluster.**

    * @* @paramparam dstAddrdstAddr -- NULL or DSTINDIRECT, if indirectNULL or DSTINDIRECT, if indirect* @* @paramparam epDescepDesc -- pointer to the originating endpoint descriptorpointer to the originating endpoint descriptor* @* @paramparam StateState -- OnOffSRC_OffOnOffSRC_Offoror OnOffSRC_OnOnOffSRC_On..*** @return 0* @return 0 -- Sent it on its way, !0 if errorSent it on its way, !0 if error*/*/

    byte SRC03391_Set_OnOffSRC(byte SRC03391_Set_OnOffSRC( afAddrType_tafAddrType_t **dstAddrdstAddr,, endPointDesc_tendPointDesc_t **epDescepDesc,,byte State )byte State )

    {{byte status;byte status;status =status = afFillAndSendMessageafFillAndSendMessage(( dstAddrdstAddr,, epDescepDesc-->>endPointendPoint,,

    CLUSTERID_OnOffSRCCLUSTERID_OnOffSRC, 1, FRAMETYPE_KVP,, 1, FRAMETYPE_KVP,&SRC03391_TransSeqNumber,&SRC03391_TransSeqNumber,CMDTYPE_SET, DATATYPE_UINT8,CMDTYPE_SET, DATATYPE_UINT8, OnOffSRC_OnOffOnOffSRC_OnOff,,ERRORCODE_SUCCESS,ERRORCODE_SUCCESS,sizeof(Statesizeof(State), &State,), &State,

    AF_MSG_ACK_REQUEST, true, AF_DEFAULT_RADIUS );AF_MSG_ACK_REQUEST, true, AF_DEFAULT_RADIUS );return ( status );return ( status );

    }}

  • 8/8/2019 2 Sensors Expo Gislason

    33/33