Network and Systems Laboratory nslab.ee.ntu.edu.tw Copyright © Wireless Sensor Networks: Zigbee Stack Polly Huang Department of Electrical Engineering National Taiwan University
Network and Systems Laboratory nslab.ee.ntu.edu.tw Zigbee Stack Designed for indoor home appliances Routing MAC Copyright ©
Network and Systems Laboratory nslab.ee.ntu.edu.tw Radio Coverage Good linkGrey linkBad link Copyright © 2008
Network and Systems Laboratory nslab.ee.ntu.edu.tw Problems in Networking No one node can reach every other node Need multiple routing Each node can reach a high number of other nodes Need MAC with collision avoidance No link is 100% reliable Need (quasi-)reliable data transport Copyright ©
Network and Systems Laboratory nslab.ee.ntu.edu.tw Ad Hoc Routing Multi-hop Routing for Wireless Network Copyright ©
Network and Systems Laboratory nslab.ee.ntu.edu.tw Ad Hoc Network A collection of wireless and/or mobile nodes Forming a spontaneous network Copyright © 2008
Network and Systems Laboratory nslab.ee.ntu.edu.tw Ad Hoc Routing Finding a path Each host is also a router ? Simplest Solution Shortest path routing Ex: Distance Vector or Link State Copyright © 2008
Network and Systems Laboratory nslab.ee.ntu.edu.tw Temporally-Ordered Routing Algorithm (TORA) Presented INFOCOM ’ 97 by Park and Carson Think about it as water flowing through tubes on its way to a destination Node broadcasts a QUERY packet, recipient broadcasts an UPDATE packet Copyright © 2008
Network and Systems Laboratory nslab.ee.ntu.edu.tw Route Creation Example Copyright © 2008
Network and Systems Laboratory nslab.ee.ntu.edu.tw Ad Hoc On-Demand Distance Vector (AODV) Presented as Internet-Draft, Perkins and Royer, 1997 Takes the basic On-demand mechanism of Route Discovery and Maintenance from DSR Plus hop-by-hop routing, etc from DSDV Source broadcasts a Route Request packet, recipient sends back a Route Reply packet Copyright © 2008
Network and Systems Laboratory nslab.ee.ntu.edu.tw AODV Example Route Request Route Reply Copyright © 2008
Network and Systems Laboratory nslab.ee.ntu.edu.tw Wireless MAC Copyright ©
Network and Systems Laboratory nslab.ee.ntu.edu.tw Types of MAC Reservation Based Allocating a certain amount of resource Exclusive for a particular node Example: TDMA, FDMA, CDMA For cellular networks Random Access Sharing the channel Listen and try Example: CSMA, CSMA/CD, CSMA/CA For WiFi Copyright ©
Network and Systems Laboratory nslab.ee.ntu.edu.tw Copyright © Time Division Multiple Access Access to channel in "rounds" Each station gets fixed length slot in each round Length = packet transmission time Unused slots go idle Example: 6-station LAN, 1,3,4 have pkt, slots 2,5,6 idle
Network and Systems Laboratory nslab.ee.ntu.edu.tw Copyright © Frequency Division Multiple Access Channel spectrum divided into frequency bands Each station assigned fixed frequency band Unused transmission time in frequency bands go idle Example: 6-station LAN, 1,3,4 have pkt, frequency bands 2,5,6 idle frequency bands time
Network and Systems Laboratory nslab.ee.ntu.edu.tw Copyright © Carrier Sense Multiple Access CSMA: listen before transmit: If channel sensed idle: transmit entire frame If channel sensed busy, defer transmission Human analogy: don’t interrupt others!
Network and Systems Laboratory nslab.ee.ntu.edu.tw Copyright © CSMA Collisions collisions can still occur: propagation delay means two nodes may not hear each other’s transmission collision: entire packet transmission time wasted spatial layout of nodes
Network and Systems Laboratory nslab.ee.ntu.edu.tw Copyright © CSMA/CD (Collision Detection) CSMA/CD: carrier sensing, deferral as in CSMA Collisions detected within short time Colliding transmissions aborted, reducing channel wastage Human analogy: the polite conversationalist
Network and Systems Laboratory nslab.ee.ntu.edu.tw Copyright © CSMA/CD Illustrated
Network and Systems Laboratory nslab.ee.ntu.edu.tw Copyright © Collision Detection in Wireless Can’t sense all collisions in any case: Hidden terminal Signal fading goal: avoid collisions: CSMA/C(ollision)A(voidance) A B C A B C A’s signal strength space C’s signal strength
Network and Systems Laboratory nslab.ee.ntu.edu.tw CSMA/CA Collision Avoidance sender if sense channel idle for DIFS then transmit entire frame (no CD) if sense channel busy then 1. start random backoff time 2. timer counts down while channel idle 3. transmit when timer expires 4. if no ACK, increase random backoff interval, repeat receiver if frame received OK return ACK after SIFS (ACK needed due to hidden terminal, fading problems) Copyright © sender receiver DIFS data SIFS ack
Network and Systems Laboratory nslab.ee.ntu.edu.tw Copyright © Really Avoiding Collisions idea: allow sender to “reserve” channel rather than random access of data frames: avoid collisions of long data frames Sender first transmits small request-to-send (RTS) packets using CSMA RTSs may still collide with each other (but they’re short) Receiver broadcasts clear-to-send CTS in response to RTS RTS/CTS heard by all nodes sender transmits data frame other stations defer transmissions Avoid data frame collisions completely using small reservation packets!
Network and Systems Laboratory nslab.ee.ntu.edu.tw Copyright © CSMA/CA - Illustrated Receiver A B time RTS(A) RTS(B) RTS(A) CTS(A) DATA (A) ACK(A) reservation collision defer
Network and Systems Laboratory nslab.ee.ntu.edu.tw Zigbee Stack AODV Identifying single path On-demand for mobile network CSMA-like MAC Listen before transmit Ack optional RTS/CTS optional Copyright ©
Network and Systems Laboratory nslab.ee.ntu.edu.tw Copyright © Questions?