Tiny OS Tutorial Part I Phil Levis et
- Slides: 47
Tiny. OS Tutorial, Part I Phil Levis et al. Mobi. Sys 2003 5/5/2003 Mobi. Sys 2003
Goals • Deploy a (small) sensor network • See, modify, and install some nes. C code • Write a simple application 5/5/2003 Mobi. Sys 2003 2
Tiny. OS Applications • Application specific images • Top-level configuration • tinyos-1. x/apps/ 5/5/2003 Mobi. Sys 2003 3
Tiny. DB • Data collection and aggregation • SQL-like queries • Ad-hoc multi-hop routing 5/5/2003 Mobi. Sys 2003 4
Two Steps • Prepare PC-side application • Install Tiny. DB on two or more motes 5/5/2003 Mobi. Sys 2003 5
Building Java Tools • cd tinyos-1. x/tools/java • make 5/5/2003 Mobi. Sys 2003 6
Tiny. DB Java Application • cd tinyos-1. x/tools/java • cd net/tinyos/tinydb • java –jar tinydb. jar • After you run this, close it 5/5/2003 Mobi. Sys 2003 7
Installing Tiny. DB • cd tinyos-1. x/apps/tinydb • make mica – Make sure application builds properly • Plug in programming board • make mica install. 1 – Installs application with mote ID 1 5/5/2003 Mobi. Sys 2003 8
Build a Tiny. DB Base Station • Plug in a new mote • cd apps/Tiny. DB • make mica install. 0 • Make sure serial cable is connected 5/5/2003 Mobi. Sys 2003 9
Running the Application • Plug in (and turn on) base station • Turn on Tiny. DB mote • Run Tiny. DB PC application 5/5/2003 Mobi. Sys 2003 10
A Simple Query • Report light at one Hz • Look at data output 5/5/2003 Mobi. Sys 2003 11
Multi-Mote Network • Close Tiny. DB PC application • Turn off motes • Install Tiny. DB on more motes – make install. 2 – make install. 3 • Run Tiny. DB PC application • Send query again 5/5/2003 Mobi. Sys 2003 12
Applications • Tiny. OS applications have a top-level configuration • Wires application components to boot sequence, etc. • Some applications have no app-specific modules 5/5/2003 Mobi. Sys 2003 13
Example Configuration 5/5/2003 Mobi. Sys 2003 14
A Simple App: Cnt. To. Leds • Displays bottom 3 bits of a counter on LEDs • apps/Cnt. To. Leds 5/5/2003 Mobi. Sys 2003 15
Cnt. To. Leds Configuration (apps/Cnt. To. Leds. nc) configuration Cnt. To. Leds { } implementation { components Main, Counter, Int. To. Leds, Timer. C; Main. Std. Control -> Int. To. Leds. Std. Control; Main. Std. Control -> Counter. Std. Control; Main. Std. Control -> Timer. C. Std. Control; Counter. Timer -> Timer. C. Timer[unique("Timer")]; Counter. Int. Output -> Int. To. Leds. Int. Output; } 5/5/2003 Mobi. Sys 2003 16
Step By Step (apps/Cnt. To. Leds. nc) configuration Cnt. To. Leds { } • This is a configuration (wiring) • Named Cnt. To. Leds (Cnt. To. Leds. nc) 5/5/2003 Mobi. Sys 2003 17
Step By Step (apps/Cnt. To. Leds. nc) implementation { components Main, Counter, Int. To. Leds, Timer. C; • This is the implementation block – As this is a configuration, implementation is wiring • This wiring uses these components – There can be more than one components statement – Component order unimportant 5/5/2003 Mobi. Sys 2003 18
Step By Step (apps/Cnt. To. Leds. nc) Main. Std. Control -> Int. To. Leds. Std. Control; Main. Std. Control -> Counter. Std. Control; Main. Std. Control -> Timer. C. Std. Control; • Connect Main’s Std. Control (uses) to the Std. Control interfaces (provides) of three components • In the boot sequence, Main will call these components’ init() and start() 5/5/2003 Mobi. Sys 2003 19
Step By Step (apps/Cnt. To. Leds. nc) Counter. Timer -> Timer. C. Timer[unique("Timer")]; • Wire counter to a unique Timer. C timer • Counter. Timer. start. Timer() will call Timer. C. Timer[x]. start. Timer • Timer. C. Timer[x]. fired() will call Counter. Timer. fired() 5/5/2003 Mobi. Sys 2003 20
Finally…. (apps/Cnt. To. Leds. nc) Counter. Int. Output -> Int. To. Leds. Int. Output; • Wire the counter output to the LEDs 5/5/2003 Mobi. Sys 2003 21
Cnt. To. Leds, Revisited (apps/Cnt. To. Leds. nc) configuration Cnt. To. Leds { } implementation { components Main, Counter, Int. To. Leds, Timer. C; Main. Std. Control -> Int. To. Leds. Std. Control; Main. Std. Control -> Counter. Std. Control; Main. Std. Control -> Timer. C. Std. Control; Counter. Timer -> Timer. C. Timer[unique("Timer")]; Counter. Int. Output -> Int. To. Leds. Int. Output; } 5/5/2003 Mobi. Sys 2003 22
How it Works • On boot, Main initializes components • When Counter starts, it starts its Timer • When Timer fires, Counter increments is value, then calls Int. To. Leds • Int. To. Leds displays bottom three bits 5/5/2003 Mobi. Sys 2003 23
Install Cnt. To. Leds • cd apps/Cnt. To. Leds • make mica install • Watch the mote blink 5/5/2003 Mobi. Sys 2003 24
Simulation • Tiny. OS has a simulator, TOSSIM • Builds directly from Tiny. OS code – make pc – build/pc/main. exe –h • Configurable output – export DBG=led • Scalable to thousands of nodes 5/5/2003 Mobi. Sys 2003 25
Simulating Cnt. To. Leds • Syntax: main. exe <number of nodes> • Sample command line options – -h: help – -x <floating point>: Scale simulated time to real world time (2. 0 = twice as fast) – -r <simple|static|lossy>: Radio models • Running Cnt. To. Leds – build/pc/main. exe –x 1. 0 1 5/5/2003 Mobi. Sys 2003 26
Tiny. Viz • GUI for visualization and actuation • Connects directly to TOSSIM • build/pc/main. exe –gui 4 • cd tinyos-1. x/tools/java/ • java net. tinyos. sim. Tiny. Viz 5/5/2003 Mobi. Sys 2003 27
Tiny. Viz Screenshot 5/5/2003 Mobi. Sys 2003 28
Adding Debugging Output • tinyos-1. x/tos/lib/Counter. nc: event result_t Timer. fired() { state++; dbg(DBG_USR 3, “Counter: %i. n”, state); return call Int. Output. output(state); } • export dbg=led, usr 3 • make pc • build/pc/main. exe –x 1. 0 1 5/5/2003 Mobi. Sys 2003 29
Simple Messaging • Build a Cnt. To. Rfm mote • Build a Rfm. To. Leds mote • One mote displays the other’s counter 5/5/2003 Mobi. Sys 2003 30
Cnt. To. Rfm (apps/Cnt. To. Rfm. nc) configuration Cnt. To. Rfm { } implementation { components Main, Counter, Int. To. Rfm, Timer. C; Main. Std. Control -> Counter. Std. Control; Main. Std. Control -> Int. To. Rfm. Std. Control; Counter. Timer -> Timer. C. Timer[unique("Timer")]; Counter. Int. Output -> Int. To. Rfm. Int. Output; } 5/5/2003 Mobi. Sys 2003 31
Rfm. To. Leds (apps/Rfm. To. Leds. nc) configuration Rfm. To. Leds { } implementation { components Main, Rfm. To. Int, Int. To. Leds; Main. Std. Control -> Int. To. Leds. Std. Control; Main. Std. Control -> Rfm. To. Int. Std. Control; Rfm. To. Int. Output -> Int. To. Leds. Int. Output; } 5/5/2003 Mobi. Sys 2003 32
Sensing • Instead of a counter, display sensor reading on LEDs • See what sensing code looks like • Install Sense. To. Rfm on Cnt. To. Rfm node 5/5/2003 Mobi. Sys 2003 33
Sensing: Sense. To. Rfm (apps/Sense. To. Rfm. nc) configuration Sense. To. Rfm { // this module does not provide any interface } implementation { components Main, Sense. To. Int, Int. To. Rfm, Clock. C, Photo; Main. Std. Control -> Sense. To. Int; Main. Std. Control -> Int. To. Rfm; Sense. To. Int. Clock -> Clock. C; Sense. To. Int. ADC -> Photo; Sense. To. Int. ADCControl -> Photo; Sense. To. Int. Output -> Int. To. Rfm; } 5/5/2003 Mobi. Sys 2003 34
Sensing, Continued • Build a new application • Goals – Have two motes sense – Each displays other’s reading on LEDs • Starting blocks – Sense. To. Rfm – Rfm. To. Leds 5/5/2003 Mobi. Sys 2003 35
Making a New Application • Create a new application directory • Create the Makefile • Write the code 5/5/2003 Mobi. Sys 2003 36
Directory • mkdir tinyos-1. x/apps/Sense. Exchange • cd tinyos-1. x/apps/Sense. Exchange 5/5/2003 Mobi. Sys 2003 37
Makefile • Create and edit Makefile: COMPONENT=Sense. Exchange include. . /Makerules 5/5/2003 Mobi. Sys 2003 38
Application File • What components do we need? – – – – 5/5/2003 Main Photo Sense. To. Int. To. Rfm. To. Int. To. Leds Clock. C Mobi. Sys 2003 39
Wiring It Up: The Components (apps/Sense. Exchange. nc) configuration Sense. Exchange { // this module does not provide any interfaces } implementation { components Main; // The output part components Sense. To. Int, Int. To. Rfm, Clock. C, Photo; // The input part components Rfm. To. Int, Int. To. Leds; 5/5/2003 Mobi. Sys 2003 40
Wiring It Up: Output Connections (apps/Sense. Exchange. nc) Main. Std. Control -> Sense. To. Int; Main. Std. Control -> Int. To. Rfm; Sense. To. Int. Clock -> Clock. C; Sense. To. Int. ADC -> Photo; Sense. To. Int. ADCControl -> Photo; Sense. To. Int. Output -> Int. To. Rfm; 5/5/2003 Mobi. Sys 2003 41
Wiring It Up: Input Connections (apps/Sense. Exchange. nc) Main. Std. Control -> Int. To. Leds. Std. Control; Main. Std. Control -> Rfm. To. Int. Std. Control; Rfm. To. Int. Output -> Int. To. Leds. Int. Output; 5/5/2003 Mobi. Sys 2003 42
Wiring It Up: Result (apps/Sense. Exchange. nc) configuration Sense. Exchange { // this module does not provide any interfaces } implementation { components Main; components Sense. To. Int, Int. To. Rfm, Clock. C, Photo; components Rfm. To. Int, Int. To. Leds; Main. Std. Control -> Sense. To. Int; Main. Std. Control -> Int. To. Rfm; Sense. To. Int. Clock -> Clock. C; Sense. To. Int. ADC -> Photo; Sense. To. Int. ADCControl -> Photo; Sense. To. Int. Output -> Int. To. Rfm; 5/5/2003 Main. Std. Control -> Int. To. Leds. Std. Control; Main. Std. Control -> Rfm. To. Int. Std. Control; Rfm. To. Int. Output -> Int. To. Leds. Int. Output; } Mobi. Sys 2003 43
Running Sense. Exchange • Compile and run on two motes • Cover one light sensor • Cover the other 5/5/2003 Mobi. Sys 2003 44
Conclusion of Part I • • • Deployed a small sensor network Installed simple applications Used TOSSIM Wrote Sense. Exchange Part II: Communication, actuation 5/5/2003 Mobi. Sys 2003 45
Questions 5/5/2003 Mobi. Sys 2003 46
Serial. Forwarder • Sensor network proxy • Connects to serial port • Provides TCP socket interface java net. tinyos. sf. Serial. Forward & Mobi. Sys 2003 5/5/2003 47
- Torfm
- Esofagectomia secondo ivor lewis
- Levis ph
- Levis moscow t shirt
- Levis tainted love
- Contoh culpa levis
- Asas tiada pidana tanpa kesalahan
- Levis competitive advantage
- Sara levis
- Addition symbol
- Part to part ratio definition
- Part part whole
- Technical description meaning
- The parts
- The phase of the moon you see depends on ______.
- Two way anova minitab 17
- Phil collins choroba
- Philip bayard "phil" crosby
- Sara toogood
- Phil ukrainetz
- When i visited phil finches of japan
- Philippians 4
- Philippians 4 nkjv
- Philippians 3 4-11
- Philippians 2:5-8 nkjv
- Phil 1:27-28
- Philip bayard "phil" crosby
- Michelle wilkins dr phil
- Phil denning
- Phil and cath make and sell boomerangs
- Cerita citra chapter 7
- Phil race ripples model of learning
- Cam4 phil
- Phil rasch
- Philippians 4 6 esv
- Mini case study example
- Phil 314
- Phil nigh
- Phil armitage
- Phil dybvig
- Words that rhyme with phil
- Philippians 4 6 9
- Philippians 2:8-11
- Phil 4:3
- Phil karn
- Freddie poem
- Phil daro
- Phil gibbons cmu