1 / 43

Tutorial How to use sensors

Tutorial How to use sensors. Reporter : Jensen Vinson. Outline. Equipment Install TinyOS Programming Concept Install Sensor Create A Sensor Network Example--Light Example--Accelerometer. Equipment. OS : Linux/Windows (cygwin), TinyOS 2.x PC : USB serial port

udell
Télécharger la présentation

Tutorial How to use sensors

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. TutorialHow to use sensors Reporter:Jensen Vinson

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

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

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

  5. Install TinyOS Step2: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/

  6. Install TinyOS Step2:Windows only. Install Cygwin

  7. Install TinyOS Step2:Windows only. Install Cygwin then, complete the rest of installation process

  8. Install TinyOS Step3:Install native compilers Command: rpm –ivh –ignoress <file name>

  9. Install TinyOS Step4:Install the nesC compiler & TinyOS toolchain

  10. Install TinyOS Step5:Install the TinyOS source tree

  11. Install TinyOS Step5:Install the TinyOS source tree --Configure the environment in the end of the file C:\cygwin\home\Administrator\.bash_profile

  12. Install TinyOS Step6: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.exe

  13. Install TinyOS • Check if setup is correct using this command • # tos-check-env

  14. Programming Concept • xx.h • Header file • xxAppC.nc • Configuration file • xxC.nc • Module file

  15. Install Sensor Step1: motelist

  16. Install Sensor Step2: install sensor ● go to the directory of the file you want to install ● # make telosb install,<logic_ID> bsl,<COM port-1> PS: In linux, the COM port needn’t minus 1

  17. Create a sensor network • One is the BaseStation (logic_ID=0) which collects data and transmits to PC • Others are for sensing data with IEEE 802.15.4 N_2 N_1 data data data N_0

  18. Example– Sensing light Step1:Base on Oscilloscope in tinyos2.x Step2:Some main files below Oscilloscope.h

  19. Example (Cont.) OscilloscopeAppC.nc // configure components // creates connection between components and modules

  20. Example (Cont.) OscilloscopeC.nc // define the interfaces it needs

  21. // red light // yellow light // green light

  22. Sensing data collection C:\cygwin\opt\tinyos-2.x\tos\chips\msp430\sensors

  23. 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&

  24. 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

  25. how to interpret the sensor readings

  26. 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

  27. Example--Accelerometer Step3: Modify the critical codes

  28. Example--Accelerometer Step3: Modify the critical codes

  29. Example--Accelerometer Step3: Modify the critical codes

  30. Example—Accelerometer (Cont.) Step4:Design GUI Step5: 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&

  31. 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

  32. 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)

  33. Physical meaning of sensor reading(cont.) (1) X-out(red)=1g Y-out(white)=0g Z-out(green)=0g

  34. Physical meaning of sensor reading(cont.) (2) X-out(red)=0g Y-out(white)=1g Z-out(green)=0g

  35. Physical meaning of sensor reading(cont.) (3) X-out(red)=-1g Y-out(white)=0g Z-out(green)=0g

  36. Physical meaning of sensor reading(cont.) (4) X-out(red)=0g Y-out(white)=-1g Z-out(green)=0g

  37. Physical meaning of sensor reading(cont.) (5) X-out(red)=0g Y-out(white)=0g Z-out(green)=1g

  38. Physical meaning of sensor reading(cont.) (6) X-out(red)=0g Y-out(white)=0g Z-out(green)=-1g

  39. Q & A

More Related