TinyOS Tutorial Lesson 8 Data logging application.

Slides:



Advertisements
Similar presentations
1 Tomás Sánchez López July 9, 2004 Real-time & Embedded Systems Laboratory TinyOS … in deep.
Advertisements

NesC Prepared for the Multimedia Networks Group University of Virginia.
Feb 2007WSN Training: First Steps in nesC Programming1 First Steps in TinyOS and nesC Programming Topics  Timer Application: MyApp  Application directory.
1 Lab 3 Objectives  Case study: “Hello world” program on motes  Write you first program on mote.
The nesc Language: A Holistic Approach to Networked Embedded Systems David Gay, Philip Levis, Robert von Behren, Matt Welsh, Eric Brewer, David Culler.
1 Lab4 Objectives  Learn to read light sensor data from sensor board  Learn to transmit a message containing the sensed data  through Mote serial port.
Mote Programming. 如何 compile 程式  make [re]install. : desired device address : target platform  install vs. reinstall install : compile the application.
Feb 2007TinyOS/nesC Basic Concepts1 Introduction to TinyOS Programming Topics  TinyOS execution model  Async and atomic code  Configuration and wiring.
TinyOS Introduction Advanced Computer Networks. TinyOS Outline  Introduction to the Architecture of TinyOS and nesC  Component Model –Components, interfaces,
TinyOS Tutorial Communication Networks I Wenyuan Xu Fall 2006.
GIIS’07 – Marrakech 3 rd July 2007 Behavioural Specification of Wireless Sensor Network Applications Nelson S Rosa and Paulo R F Cunha Universidade Federal.
Programming Motes A TinyOS and TOSSIM Tutorial By: Brent Rood.
Development of a Mica2 Mote Sensor Network Cliff Macklin Bill Ehrbar December 8, 2004 University of Colorado, Colorado Springs.
TinyOS Tutorial CS580S Sensor Networks and Systems February 7, 2007 Jisu Oh Dept. of Computer Science SUNY-Binghamton.
PtinyOS: Simulating TinyOS in Ptolemy II Elaine Cheong Dec 10, 2004 EE290N Project Presentation (Initial NC code generator by Yang Zhao and Edward Lee)
5/5/2003MobiSys 2003 Tutorial TinyOS Tutorial, Part II Robert Szewczyk, Joe Polastre, Phil Levis, David Culler Mobisys 2003.
Advanced Topics on Information Systems Spring 2004 Dimitrios Lymberopoulos Advanced Topics on Information Systems Embedded Software: The Case of Sensor.
NesC: 1.1 Bumps and Future Directions David Gay, Intel Research, Berkeley (and the nesC and TinyOS teams)
1 Lab 3 Objectives  Case study: “Hello world” program on motes  Write you first program on mote.
TinyOS 2.1 Jun Yi Partially based on the tutorial at IPSN 2009 By Stephen Dawson-Haggerty, Omprakash Gnawali, David Gay, Philip Levis, Răzvan Musăloiu-E.,
TinyOS Tutorial Based on Wenyuan Xu’s slides ( NetsF06/Comnet_TinyOS_Tutorial_xwy.ppt)
1 Software Development Infrastructure for Sensor Networks  Operating systems ( TinyOS )  Resource (device) management  Basic primitives  Protocols.
TinyOS Tutorial Jianping Wang (merge several tutorials found online)
Sown Code Report: Aggregation Tracking Group Management Pascal A. Vicaire University of Virginia
1 Lab 5 Objectives  Use XMesh multi-hop networking service to send sensing data to a base station  Using XServe to display the sensor data message on.
Programming in nesC (and TOSSIM)
By: R Jayampathi Sampath
1 System Architecture Directions for Networked Sensors (TinyOS & Mica2) Presented by Jang Young, Kim (Chris)
April 15, 2005TinyOS: A Component Based OSPage 1 of 27 TinyOS A Component-Based Operating System for Networked Embedded Systems Tom Bush Graduate College.
1 TinyOS Computer Network Programming Wenyuan Xu Fall 2007.
TinyOS 1/2 Onsystech Sangjae Han.
1 Lab2 Objectives  Basics of TinyOS  Basics of nesC programming language.
1 Lab2 Objectives  Basics of TinyOS  Basics of nesC programming language.
Tmote Sky Doug Schultz for FWLUG (Fort Wayne Linux Users Group)
WSN Platforms: Hardware & Software Murat Demirbas Lecture uses some slides from tutorials prepared by authors of these platforms.
HW2: Q&A Oct. 02, Lab Machine TinyOS is installed in one machine (531AB). But, you have to bring your kit. There is a sign up sheet. Please sign.
HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 Light Sense Lab. Read data from light(photo diode) sensor, display using oscilloscope.
Dhanshree Nimje Smita Khartad
An Introduction to nesC and TinyOS, or, A really complicated way to build very simple applications CENS Summer Internship 07/08/05 Ben Greenstein –
CIS 798 Sensor Network Implementation. Goals Learning sensor network programming with Crossbow motes Implement reasonable sized sensor applications Develop.
Lab 3 Introduction to TinyOS and nesC How to debug programs at PC Examples –Blink Timer –Blink –Hellow World Reference: 1.x/doc/tutorial/lesson1.html.
Simulation of Distributed Application and Protocols using TOSSIM Valliappan Annamalai.
HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 TinyOS & NesC.
Part 2 TinyOS and nesC Programming Selected slides from:
Feb 2007WSN Training: Creating a Simple Sensor Application1 A TinyOS Sensor Application called MyApp Objectives  How to create a simple Mote firmware.
HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 Wireless MAC Practice (MAC I)
Lecture 5 Sensing 石致豪. Introduction Sense application SenseAppC.nc configuration SenseAppC { } implementation { components SenseC, MainC, LedsC, new.
WSN Software Platforms - concepts Vinod Kulathumani Lecture uses some slides from tutorials prepared by authors of these platforms.
HANBACK ELECTRONICS CO., LTD. TinyOS 구조와 스케줄러의 이해 ㈜한백전자 이철희.
1 Lab2 Objectives  Basics of TinyOS  Basics of nesC programming language.
Lab 3, Part 2 Selected slides from: Wireless Sensor Networks Hardware/Software Tiny OS & NesC Programming borrowed from Turgay Korkmaz.
TinyOS Sandeep Gupta. Operating System (OS) What is an OS? Main functions  Process management  Memory management  Resource management Traditional OSs.
HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 Gossiping Protocol.
HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 Lab1: LED Control ZigbeX mote has Red, Yellow, Green LED. This lab using LED control component provided by TinyOS.
Based on slides from Andreas Larsson Table from CY Chong, SP Kumar, BA Hamilton - Proceedings of the IEEE, 2003.
HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 HelloWorld By using LED & Timer components, we will display “helloworld” in a manner of Morse code.
CPSC 233 Tutorial 5 February 9 th /10 th, Java Classes Each Java class contains a set of instance variables and methods Instance Variables: Type.
Blink Blink.nc configuration Blink { } implementation { components Main, BlinkM, SingleTimer, LedsC; Main.StdControl -> BlinkM.StdControl; Main.StdControl.
Feb 2007WSN Training: XMesh Enabled Sensor App1 Lab 5 Objectives  Use XMesh multi-hop networking service to send sensing data to a base station  Using.
Cyber-Physical Programming
TinyOS Sandeep Gupta. TinyOS basics TinyOS is  Single tasking OS  Interrupt driven Written using a Component based language A set of components put.
TinyOS and nesC. Outline ● Wireless sensor networks and TinyOS ● Networked embedded system C (nesC) – Components – Interfaces – Concurrency model – Tool.
Simulation of Distributed Application and Protocols using TOSSIM
WSN Training: XMesh Enabled Sensor App
Ad Hoc Networking using Flooding protocol
SOWN Code Review Top-level Control.
An Introduction to nesC
Temperature and Humidity Lab.
WSN Training: TinyOS/nesC Basic Concepts TinyOS and nesC
SenseToRfm SenseToInt.Timer -> TimerC; configuration SenseToRfm {
Presentation transcript:

TinyOS Tutorial Lesson 8 Data logging application

Outline Introduction The SenseLightToLog Application Logger component, interfaces, usage, and limitations The Sensing interface SenseLightToLogM.nc

Introduction SenseLightToLog Sensor EEPROM

Introduction SenseLightToLog Sensor EEPROM

SenseLightToLog SimpleCmd START_SENSINGREAD_LOG

SenseLightToLog (cont.) Logger Main StdControl SenseLightToLogM StdControl ADC Leds TimerC Timer SubControl Photo SubControl LoggerWriteADC LoggerWrite Comm SubControl Timer LedsC Leds Sensing

Logger About the EEPROM on Mica/Mica/Mica2Dot:  512 kbyte  may be read and written in 16-byte blocks, called lines  split-phase operations treating the EEPROM as a circular buffer - by maintaining an internal pointer to the next EEPROM line does not read or write data at the beginning of the EEPROM

Logger - LoggerRead readNext(buffer) - Read the next line from the log read(line, buffer) - Read an arbitrary line from the log resetPointer() - Set the current line pointer to the beginning of the log setPointer(line) - Set the current line pointer to the given line

Logger - LoggerWrite append(buffer) - Append data to the log write(line, buffer) - Write data to the log at the given line resetPointer() - Set the current line pointer to the beginning of the log setPointer(line) - Set the current line pointer to the given line

Logging performance high-frequency sampling - ByteEEPROM

SenseLightToLogM data[ maxdata * 2 ] (maxdata = 8) head bufferPtr[0] bufferPtr[1] buffer0 buffer1 currentBuffer = 0 head = 0 currentBuffer = 0 head = 7 currentBuffer = 1 head = 0

SenseLightToLogM.nc(1/8) module SenseLightToLogM { provides interface StdControl; provides interface Sensing; uses { interface ADC; interface StdControl as SubControl; interface Leds; interface Timer as Timer; interface LoggerWrite; interface ProcessCmd as CmdExecute; }

SenseLightToLogM.nc(2/8) implementation { enum { maxdata = 8 }; char head; uint8_t currentBuffer; int data[maxdata*2]; int *bufferPtr[2]; short nsamples;

SenseLightToLogM.nc(3/8) command result_t StdControl.init() { atomic { head = 0; currentBuffer = 0; bufferPtr[0] = &(data[0]); bufferPtr[1] = &(data[8]); } return rcombine(call SubControl.init(), call Leds.init()); }

SenseLightToLogM.nc(4/8) command result_t StdControl.start() { return call SubControl.start(); } command result_t StdControl.stop() { return call SubControl.stop(); } command result_t Sensing.start(int samples, int interval_ms) { nsamples = samples; call Timer.start(TIMER_REPEAT, interval_ms); return SUCCESS; }

SenseLightToLogM.nc(5/8) event result_t Timer.fired() { nsamples--; if (nsamples== 0) { call Timer.stop(); signal Sensing.done(); } call Leds.redToggle(); call ADC.getData(); return SUCCESS; }

SenseLightToLogM.nc(6/8) default event result_t Sensing.done() { return SUCCESS; } task void writeTask() { char* ptr; atomic { ptr = (char*)bufferPtr[currentBuffer]; currentBuffer ^= 0x01; } call LoggerWrite.append(ptr); }

SenseLightToLogM.nc(7/8) async event result_t ADC.dataReady(uint16_t this_data){ atomic { int p = head; bufferPtr[currentBuffer][p] = this_data; head = (p+1); if (head == maxdata) head = 0; if (head == 0) { post writeTask(); } return SUCCESS; }

SenseLightToLogM.nc(8/8) event result_t LoggerWrite.writeDone( result_t status ) { //if (status) call Leds.yellowOn(); return SUCCESS; } event result_t CmdExecute.done(TOS_MsgPtr pmsg, result_t status ) { return SUCCESS; }