360 likes | 513 Views
Tutorial How to use sensors. Reporter : Jensen Vinson. Create a sensor network—sensing light. 1. Install TinyOS into Windows/Linux 2. Write the program called Oscilloscope 3. Install ‘BaseStation’ into N_0 and ‘Oscilloscope’ into N_1 and N_2
E N D
TutorialHow to use sensors Reporter:Jensen Vinson
Create a sensor network—sensing light 1. Install TinyOS into Windows/Linux 2. Write the program called Oscilloscope 3. Install ‘BaseStation’ into N_0 and ‘Oscilloscope’ into N_1 and N_2 4. N_1, N_2 sense data and N_0 collects data from N_1, N_2 and then transmits to PC N_2 N_1 data data data N_0
Key words ● Component: • Two types of components:module and configuration • Define two scopes: ”the interfaces it contains” and “implementation” • A component provides and uses interfaces • if a component uses an interface, it can call the interface's commands and must implement handlers for its events ● configuration & module: • configurations are implemented in terms of other components, which they wire, while modules are executable code
Key words ● Interface:bidirectional • Include commands and events • Provided interface: represent the functionality that the component provides to its user in its specification • Used interface: represent the functionality that the component needs to perform its job in its implementation
● Oscilloscope step1. Enable “Makefile”→ step2. Enable “OscilloscopeAppC” step3. Enable “OscilloscopeC”
OscilloscopeC.nc // red light // yellow light // green light
Step4:Sensing data channel Link:DemoSensorC→VoltageC→Msp430InternalVoltageC→Msp430InternalVoltageP C:\cygwin\opt\tinyos-2.x\tos\chips\msp430\sensors
3. Install into Sensors step1. Install BaseStation (N_0) # cd /opt/tinyos-2.x/apps/BaseStation # make telosb install,<logic_ID> bsl,<COM port-1>
step2. Install Oscilloscope (N_1) # cd /opt/tinyos-2.x/apps/Oscilloscope # make telosb install,<logic_ID> bsl,<COM port-1>
step3. Enable forwarder on BaseStation # java net.tinyos.sf.SerialForwarder –comm serial@<COM port>:telosb&
step4. Sensing data with GUI on BaseStation # cd /opt/tinyos-2.x/apps/Oscilloscope/java # make # ./run
Example--Accelerometer Step1:Base on Oscilloscope in tinyos2.x Step2: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 Like “Msp430InternalVoltageP” Like “Msp430InternalVoltageC”
compare Step3: Modify the critical codes
compare OscilloscopeC.nc
Step4:Install BaseStation # cd /opt/tinyos-2.x/apps/BaseStation # make telosb install, <logic_ID> bsl,<COM port-1> Step5: Enable forwarder on BaseStation # java net.tinyos.sf.SerialForwarder –comm serial@<COM port>:telosb& Step6:Install Oscilloscope • # cd /opt/tinyos-2.x/apps/Oscilloscope • # make telosb install,<logic_ID> bsl,<COM port-1>
Step7: Sensing data with GUI • # cd /opt/tinyos-2.x/apps/Oscilloscope/java • # make • # ./run
Step8: 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)
Physical meaning of sensor reading(cont.) (1) X-out(red)=1g Y-out(white)=0g Z-out(green)=0g
Physical meaning of sensor reading(cont.) (2) X-out(red)=0g Y-out(white)=1g Z-out(green)=0g
Physical meaning of sensor reading(cont.) (3) X-out(red)=-1g Y-out(white)=0g Z-out(green)=0g
Physical meaning of sensor reading(cont.) (4) X-out(red)=0g Y-out(white)=-1g Z-out(green)=0g
Physical meaning of sensor reading(cont.) (5) X-out(red)=0g Y-out(white)=0g Z-out(green)=1g
Physical meaning of sensor reading(cont.) (6) X-out(red)=0g Y-out(white)=0g Z-out(green)=-1g