tutorial how to use sensors reporter : jensen vinson

43
Tutorial How to use sensors Reporter Jensen Vinson

Post on 20-Dec-2015

223 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Tutorial How to use sensors Reporter : Jensen Vinson

Tutorial

How to use sensors

Reporter: Jensen Vinson

Page 2: Tutorial How to use sensors Reporter : Jensen Vinson

2/42

Outline Equipment Install TinyOS Programming Concept Install Sensor Create A Sensor Network Example--Light Example--Accelerometer

Page 3: Tutorial How to use sensors Reporter : Jensen Vinson

3/42

Equipment OS: Linux/Windows (cygwin), TinyOS 2.x PC: USB serial port Sensor: TAROKO

Page 4: Tutorial How to use sensors Reporter : Jensen Vinson

4/42

Install TinyOS http://tinyos.net/Step1: Install a Java 1.5 (Java 5) JDK

Page 5: Tutorial How to use sensors Reporter : Jensen Vinson

5/42

Install TinyOSStep2:Windows only. Install Cygwin --download cygwin-files.zip and unzip it under

some local folder say c:/cygwin-files and start the setup

http://www.cygwin.com/

Page 6: Tutorial How to use sensors Reporter : Jensen Vinson

6/42

Install TinyOSStep2:Windows only. Install Cygwin

Page 7: Tutorial How to use sensors Reporter : Jensen Vinson

7/42

Install TinyOSStep2:Windows only. Install Cygwin

then, complete the rest of installation process

Page 8: Tutorial How to use sensors Reporter : Jensen Vinson

8/42

Install TinyOSStep3: Install native compilers

Command: rpm –ivh –ignoress <file name>

Page 9: Tutorial How to use sensors Reporter : Jensen Vinson

9/42

Install TinyOSStep4: Install the nesC compiler & TinyOS toolch

ain

Page 10: Tutorial How to use sensors Reporter : Jensen Vinson

10/42

Install TinyOSStep5: Install the TinyOS source tree

Page 11: Tutorial How to use sensors Reporter : Jensen Vinson

11/42

Install TinyOSStep5: Install the TinyOS source tree --Configure the environment in the end of the fil

e C:\cygwin\home\Administrator\.bash_profile

Page 12: Tutorial How to use sensors Reporter : Jensen Vinson

12/42

Install TinyOSStep6: Install the Graphviz visualization tool--download and install from the website below : http://webs.cs.berkeley.edu/tos/dist-1.1.0/tools/windows/graphviz-1.10.ex

e

Page 13: Tutorial How to use sensors Reporter : Jensen Vinson

13/42

Install TinyOS Check if setup is correct using this command

# tos-check-env

Page 14: Tutorial How to use sensors Reporter : Jensen Vinson

14/42

Programming Concept xx.h

Header file xxAppC.nc

Configuration file xxC.nc

Module file

Page 15: Tutorial How to use sensors Reporter : Jensen Vinson

15/42

Install SensorStep1: motelist

Page 16: Tutorial How to use sensors Reporter : Jensen Vinson

16/42

Install SensorStep2: install sensor● go to the directory of the file you want to instal

l● # make telosb install,<logic_ID> bsl,<COM port-1>PS: In linux, the COM port needn’t minus 1

Page 17: Tutorial How to use sensors Reporter : Jensen Vinson

17/42

Create a sensor network One is the BaseStation (logic_ID=0) which co

llects data and transmits to PC Others are for sensing data with IEEE 802.15.

4

BaseStation

Sensor node

Sensor node

USB serial

PC

data

data data

N_1

N_2

N_0

Page 18: Tutorial How to use sensors Reporter : Jensen Vinson

18/42

Example– Sensing lightStep1:Base on Oscilloscope in tinyos2.xStep2:Some main files below

Oscilloscope.h

Page 19: Tutorial How to use sensors Reporter : Jensen Vinson

19/42

Example (Cont.)OscilloscopeAppC.nc

// configure components

// creates connection between components and modules

Page 20: Tutorial How to use sensors Reporter : Jensen Vinson

20/42

Example (Cont.)OscilloscopeC.nc

// define the interfaces it needs

Page 21: Tutorial How to use sensors Reporter : Jensen Vinson

21/42

// green light// yellow light// red light

Page 22: Tutorial How to use sensors Reporter : Jensen Vinson

22/42

Page 23: Tutorial How to use sensors Reporter : Jensen Vinson

23/42

Page 24: Tutorial How to use sensors Reporter : Jensen Vinson

24/42

Page 25: Tutorial How to use sensors Reporter : Jensen Vinson

25/42

Page 26: Tutorial How to use sensors Reporter : Jensen Vinson

26/42

Sensing data collection

INPUT_CHANNEL_A4 LightINPUT_CHANNEL_A5 Temperature/Humidity

C:\cygwin\opt\tinyos-2.x\tos\chips\msp430\sensors

Page 27: Tutorial How to use sensors Reporter : Jensen Vinson

27/42

Example—Light (Cont.)Step3:Install BaseStation (N_0)

# cd /opt/tinyos-2.x/apps/BaseStation # make telosb install,0 bsl,<COM port-1>

Step4: Enable forwarder on BaseStation # java net.tinyos.sf.SerialForwarder –comm serial

@<COM port>:telosb&

Page 28: Tutorial How to use sensors Reporter : Jensen Vinson

28/42

Example—Light (Cont.)Step5:Install Oscilloscope (N_1, N_2)

# cd /opt/tinyos-2.x/apps/Oscilloscope # make telosb install,<logic_ID> bsl,<COM port-1>

Step6: Sensing data with GUI on BaseStation # cd /opt/tinyos-2.x/apps/Oscilloscope/java # make # ./run

Page 29: Tutorial How to use sensors Reporter : Jensen Vinson

29/42

how to interpret the sensor readings

Page 30: Tutorial How to use sensors Reporter : Jensen Vinson

30/42

Example--AccelerometerStep1:Base on Oscilloscope in tinyos2.xStep2:Enable X,Y,Z axes

Create TarokoAccel0C.nc、 TarokoAccel0P.nc for X axis Create TarokoAccel1C.nc、 TarokoAccel1P.nc for Y axis Create TarokoAccel2C.nc、 TarokoAccel2P.nc for Z axis

INPUT_CHANNEL_A0 X axisINPUT_CHANNEL_A1 Y axisINPUT_CHANNEL_A2 Z axis

Page 31: Tutorial How to use sensors Reporter : Jensen Vinson

31/42

Example--AccelerometerStep3: Modify the critical codes

Page 32: Tutorial How to use sensors Reporter : Jensen Vinson

32/42

Example--AccelerometerStep3: Modify the critical codes

Page 33: Tutorial How to use sensors Reporter : Jensen Vinson

33/42

Example--AccelerometerStep3: Modify the critical codes

Page 34: Tutorial How to use sensors Reporter : Jensen Vinson

34/42

Example—Accelerometer (Cont.)

Step4:Design GUIStep5: Install BaseStation

# cd /opt/tinyos-2.x/apps/BaseStation # make telosb install,0 bsl,<COM port-1>

Step6:Open the SerialForwarder function # java net.tinyos.sf.SerialForwarder –comm serial@<

COM port>:telosb&

Page 35: Tutorial How to use sensors Reporter : Jensen Vinson

35/42

Example—Accelerometer (Cont.)

Step7:Install Oscilloscope # cd /opt/tinyos-2.x/apps/Oscilloscope # make telosb install,<logic_ID> bsl,<COM port-1>

Step8: Sensing data with GUI # cd /opt/tinyos-2.x/apps/Oscilloscope/java # make # ./run

Page 36: Tutorial How to use sensors Reporter : Jensen Vinson

36/42

Example—Accelerometer (Cont.)

Step9: Physical meaning of sensor reading ● The output depends on value g (-1~1)

when g=-1, the output is around 1,650 when g=0, the output is around 2,048 when g=1, the output is around 2,500

● There are 6 main orientations (more details as following pages)

Page 37: Tutorial How to use sensors Reporter : Jensen Vinson

37/42

(1) X-out(red)=1g Y-out(white)=0g Z-out(green)=0g

Physical meaning of sensor reading(cont.)

Page 38: Tutorial How to use sensors Reporter : Jensen Vinson

38/42

(2) X-out(red)=0g Y-out(white)=1g Z-out(green)=0g

Physical meaning of sensor reading(cont.)

Page 39: Tutorial How to use sensors Reporter : Jensen Vinson

39/42

(3) X-out(red)=-1g Y-out(white)=0g Z-out(green)=0g

Physical meaning of sensor reading(cont.)

Page 40: Tutorial How to use sensors Reporter : Jensen Vinson

40/42

(4) X-out(red)=0g Y-out(white)=-1g Z-out(green)=0g

Physical meaning of sensor reading(cont.)

Page 41: Tutorial How to use sensors Reporter : Jensen Vinson

41/42

(5) X-out(red)=0g Y-out(white)=0g Z-out(green)=1g

Physical meaning of sensor reading(cont.)

Page 42: Tutorial How to use sensors Reporter : Jensen Vinson

42/42

(6) X-out(red)=0g Y-out(white)=0g Z-out(green)=-1g

Physical meaning of sensor reading(cont.)

Page 43: Tutorial How to use sensors Reporter : Jensen Vinson

43/42

Q & A