tutorial how to use sensors reporter : jensen vinson
Post on 20-Dec-2015
232 views
TRANSCRIPT
![Page 1: Tutorial How to use sensors Reporter : Jensen Vinson](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/1.jpg)
Tutorial
How to use sensors
Reporter: Jensen Vinson
![Page 2: Tutorial How to use sensors Reporter : Jensen Vinson](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/2.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/3.jpg)
3/42
Equipment OS: Linux/Windows (cygwin), TinyOS 2.x PC: USB serial port Sensor: TAROKO
![Page 5: Tutorial How to use sensors Reporter : Jensen Vinson](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/5.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/6.jpg)
6/42
Install TinyOSStep2:Windows only. Install Cygwin
![Page 7: Tutorial How to use sensors Reporter : Jensen Vinson](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/7.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/8.jpg)
8/42
Install TinyOSStep3: Install native compilers
Command: rpm –ivh –ignoress <file name>
![Page 9: Tutorial How to use sensors Reporter : Jensen Vinson](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/9.jpg)
9/42
Install TinyOSStep4: Install the nesC compiler & TinyOS toolch
ain
![Page 10: Tutorial How to use sensors Reporter : Jensen Vinson](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/10.jpg)
10/42
Install TinyOSStep5: Install the TinyOS source tree
![Page 11: Tutorial How to use sensors Reporter : Jensen Vinson](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/11.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/12.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/13.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/14.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/15.jpg)
15/42
Install SensorStep1: motelist
![Page 16: Tutorial How to use sensors Reporter : Jensen Vinson](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/16.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/17.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/18.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/19.jpg)
19/42
Example (Cont.)OscilloscopeAppC.nc
// configure components
// creates connection between components and modules
![Page 20: Tutorial How to use sensors Reporter : Jensen Vinson](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/20.jpg)
20/42
Example (Cont.)OscilloscopeC.nc
// define the interfaces it needs
![Page 21: Tutorial How to use sensors Reporter : Jensen Vinson](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/21.jpg)
21/42
// green light// yellow light// red light
![Page 22: Tutorial How to use sensors Reporter : Jensen Vinson](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/22.jpg)
22/42
![Page 23: Tutorial How to use sensors Reporter : Jensen Vinson](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/23.jpg)
23/42
![Page 24: Tutorial How to use sensors Reporter : Jensen Vinson](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/24.jpg)
24/42
![Page 25: Tutorial How to use sensors Reporter : Jensen Vinson](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/25.jpg)
25/42
![Page 26: Tutorial How to use sensors Reporter : Jensen Vinson](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/26.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/27.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/28.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/29.jpg)
29/42
how to interpret the sensor readings
![Page 30: Tutorial How to use sensors Reporter : Jensen Vinson](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/30.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/31.jpg)
31/42
Example--AccelerometerStep3: Modify the critical codes
![Page 32: Tutorial How to use sensors Reporter : Jensen Vinson](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/32.jpg)
32/42
Example--AccelerometerStep3: Modify the critical codes
![Page 33: Tutorial How to use sensors Reporter : Jensen Vinson](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/33.jpg)
33/42
Example--AccelerometerStep3: Modify the critical codes
![Page 34: Tutorial How to use sensors Reporter : Jensen Vinson](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/34.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/35.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/36.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/37.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/38.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/39.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/40.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/41.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/42.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032309/56649d485503460f94a24337/html5/thumbnails/43.jpg)
43/42
Q & A