330 likes | 465 Views
Lab 6: Routing. Administration. Schedule 13. Week 13 (12/10): Lab-6: Routing Labs 14. Week 14 (12/17): How to made you own hardware 15. Week 15 (12/24): Survey presentation In-class presentation (15 minutes or less) 16. Week 16 (12/31): Low Power And Advance Microcontroller Functions
E N D
Administration • Schedule • 13.Week 13 (12/10): Lab-6: Routing Labs • 14.Week 14 (12/17): How to made you own hardware • 15.Week 15 (12/24): Survey presentation • In-class presentation (15 minutes or less) • 16.Week 16 (12/31): Low Power And Advance Microcontroller Functions • 17.Week 17 (1/7): Term Project workshop • 18.Week 18 (1/14) Term Project Demo You have to present you survey report on this week
Term Project: Environment • BL building, 6 floor • A sensor network and a localization system deployed
Scenario • Your car: • Start at some unknown location • You must use • Sensor (infrared) information • Localization information • To reach the destination we assigned There will be some obstacles in the environment Destination
You Already Know • How to control robot car • How to read infrared sensor data • How to communication with PC • You don’t know • How to get location information • Today’s lab
Localization System • 4 elements • Beacons • Tag • Forwarding network • Location engine The localization system wants to track the location of the tag PC Location engine is a PC that will calculate the location of the tag Beacons and forwarding network are deployed in the environment
Beacons And Tag Each beacon sends a beacon packet to tag. Tag receive many beacon packet from different beacon. It collect the RSSI (Receive signal strength indicator) of each beacon. And put these (id, RSSI) pairs into one packet. PC
ForwardingAndLocalization Afterthetag combinedall these (id, RSSI) pairs into one packet.Itsendsthispackettotheforwardingnetwork Forwardingnetworkforwardsthispackettothelocationengine PC Locationengineusetheinformationinthepackettocalculatethelocationofthetag
YourWork • You don’t have to implement the localization system • Beacons, tag, forwarding network, and location engine are all provided to you • You must • Program a node to receive the location from PC • And send the location to the node on your robot car
Whole System The tag receive beacon packet, combine the (id, RSSI) pairs into one packet, and send it to the location engine through forwarding network. PC You must program a node to receive UART message from PC. The UART message contain the location of the tag. After you receive this UART message, send it to the node on your robot car through another network. PC (location engine) UART message Two Taroko on your car. One is tag, the other is robot car control node This is what you have to implement
Your Implementation PC (location engine) • This node (sink) will: • Receive location (x,y) from network • Based on the location and sensor(infrared) reading, control the robot to reach the destination • This node (source) will: • Receive UART message from PC • Send the location (x,y) to the forwarding network • These nodes (network relay nodes) will: • Forward the location message from source to sink We will provide you a set of nodes that runs the MD (magnetic diffusion) routing protocol. You can use these nodes to forward the packet for you. You could also implement you own routing protocol. UART message At least you have to implement source and sink. Relay nodes are optional, you can use what we provide or implement you own.
(x, y) Coordination y 185 150 173 39 197 26 (0,0) x (197,24) (26,24) 24 31 (39,31) (173,55) 55 62 67 (26,67)
Magnetic Diffusion (MD) • We will provide this routing protocol for you • You have to implement • A source node • Receive UART message (location) from PC • Send the location to the MD network • A sink node • Broadcast MD interest message • Receive location packet from MD network
Multihop Routing • Magnetic diffusion (MD) • A flooding-based(limited) routing algorithm • 2 phases • Charge setup phase • Data collection phase • Provides reliable data disseminations
MD Phase I – Charge Setup Sink node broadcasts interest packet and set its charge to some value (eg. 8) Data sink 8 7 7 A B It’s next hop neighbors (A and B) receive the interest packet. They decrease the charge by 1 and set their charge to 7. D C
MD Phase I – Charge Setup Data sink 8 A and B broadcast the interest packet again. 7 7 A B 6 D 6 C The next hop neighbors receive the interest packet. They decrease the charge by 1 and set their charge to 6. The charge setup process continuous until every node in the network has setup a charge
MD Phase II – Data Collection Data flows from low charge to high charge Data sink 8 7 7 A B Data source sends the data packet to the network. 6 D 6 C Relay nodes Data source
MD Packets • MD has three types of packet • LQI measurement packet • For link quality measurement • You don’t need to implement this • Interest packet • Data sink must broadcast this packet periodically • Data packet • For data transmission
length (8-bit) frame control field (16-bit) seq number (8-bit) Data Packet Format 802.15.4 header destination pan address (16-bit) destination node address (16-bit) MD id (8-bit) group (8-bit) type (8-bit) charge (8-bit) } last hop id (16-bit) packet timestamp (32-bit) magnetic diffusion header } packet timestamp (32-bit) packet sequence number (16-bit) data source id (16-bit) data block data block : : data block
} length (8-bit) frame control field (16-bit) seq number (8-bit) Interest Packet Format 802.15.4 header destination pan address (16-bit) destination node address (16-bit) } MD id (8-bit) group (8-bit) type (8-bit) charge (8-bit) last hop id (16-bit) packet timestamp (32-bit) magnetic diffusion header packet timestamp (32-bit) packet sequence number (16-bit) data source id (16-bit) timecheck (32-bit) } timecheck (32-bit) destination address 1 (16-bit) Interest format destination address 1 (16-bit) destination address 1 (16-bit)
Data Source Node • This node connects to a PC (location engine) • It does two things • Receive location of the robot car from PC • Through USB interface • UART packet format: • You already know how to receive data from PC • Send the location data to the network 8-bit 8-bit 8-bit 8-bit
MD Data Packet Data Source send out this packet 8-bit 16-bit 8-bit 16-bit 16-bit 8-bit 8-bit Variable length 16-bit 8-bit 8-bit 16-bit 32-bit 16-bit 16-bit Variable length ACK requested = 0x0821 No ACK requested = 0x0801 Increase 1 each time 8-bit 16-bit 8-bit 16-bit 16-bit 8-bit 8-bit Variable length 16-bit 8-bit 8-bit 16-bit 32-bit 16-bit 16-bit Variable length 0x00: LQI measurement packet 0x01: Interest packet 0x02: Data Data source address Increase 1 each time Put your location data at here
Data Sink Node • This node is on robot car, it will receive the location of the robot car from the network • Data sink does two things • Periodically broadcast interest packet • Length of the period is your design choice • Receive data packet from network • Check MD packet type • If MD type is data (0x02), check sequence number • If this is new packet, get payload 0x00: LQI measurement packet 0x01: Interest packet 0x02: Data
MD Interest Packet Data Sink send out this packet periodically 8-bit 16-bit 8-bit 16-bit 16-bit 8-bit 8-bit Variable length 16-bit 8-bit 8-bit 16-bit 32-bit 16-bit 16-bit 80-bit (5 bytes) ACK requested = 0x0821 No ACK requested = 0x0801 Increase 1 each time 8-bit 16-bit 8-bit 16-bit 16-bit 8-bit 8-bit Variable length 16-bit 8-bit 8-bit 16-bit 32-bit 16-bit 16-bit 80-bit (5 bytes) 0x00: LQI measurement packet 0x01: Interest packet 0x02: Data 32-bit 16-bit 16-bit 16-bit Data sink address Increase 1 each time
Today’s Lab • Lab 1: MD sink • You can use the Mac layer transmit/receive routine you wrote in lab 5 • Or you can use a simple but un-tested MAC we provide • Available on course webpage • Implement a MD sink node that can • Broadcast interest packet • Receive data packet from
Today’s Lab • Lab 2: MD source • Implement a MD source node that can • Receive packet from PC • Connect the source node to your NB • Use Realterm to send this packet to the source node • X coordinate, Y coordinate: number between (0 ~ 255) • Make sure your source node can receive this packet • send data packet to sink node through MD network • Put the (X coordinate, Y coordinate) you receive in your MD packet • Sent it to the sink node • Must be multi-hop
About MD • Polly has talk about it in the class • check her slides for more detail • you might need a better understanding of the routing protocol, in order to fine tune the performance • We implement MDB + MDlq in the relay node
Relay nodes • We will provide the program of MD relay nodes • You will be given two extra Taroko • So you have 7 Taroko in total • 1 for source node • 1 for sink node • 5 for relay node • Should be able to cover whole corridor
car Sink node Location engine PC Relay node Source node Destination
Install Relay Node • Open IAR • Create a new project • Choose “Externally built executable” • Remove the “readme.txt” file • Add the relay node program you downloaded to the project • Setting option • Load the program to Taroko