Home

VirtualSense User Guide 2

image

Contents

1. TI CC2520 Radio 24 GHz IEEE 802 15 4 compliant EN RST CS GPIO SPI FTDI FT232R USB UART IC S P10 P 123567 SPI M9 orl P57 UcBi Temp sensor ADc ts P3 6 P2 12 1 TI MSP430F54xxa P4 0 7 digital WO JTAG programmer NXP PCF2123 Real time clock calendar SPI INT CS Od ain asy 8r3szovvvc duo zl 3i Wod33 leues ZLSYYYZ SHOW Figure 1 The functional block diagram VS UG 1 Environment Installation v1 0 www virtualsense it University of Urbino amp NeuNet www virtualsense it 5 Hardware and software stacks Applications b b Commands ni l Commands N VirtualSense Libs VirtualSense Runtime Sensors Network Applications A Applications Actuators Storage Core Libs Power Manager Utils Darjeeling VM Figure 2 Hardware and software staks At the lowest stack level there is VirtualSesnse hardware that provides to higher levels an net work interface an ultra low power microcontroller and a set of sensors In addition to ensuring low power consumption the 20 bit processor on the VirtualSense allows hight performance so that at the base of software stack of VirtualSense can be an operative system like CONTIKI The great versatility of CONTIKI permit to run on a processor with 16k RAM and 128k Flash a real virtual machines like the JVM that allow usage an hight level programming language like Java The Vir
2. e 48 13 Installation by BSL compiling with ant builder on Eclipse 49 14 Installation by BSL compiling and installation on Eclipse done 50 15 Installation by BSL app installed cutecom serial debug rss 51 VS UG 1 Environment Installation v1 0 4 University of Urbino amp NeuNet www virtualsense it 1 Introduction The availability of off the shelf micro controller units based on energy efficient 16 bit RISC proces sors which provide a wide range of low power inactive modes with average current in the range of micro Watts and wake up times in the range of micro seconds makes it possible to develop ultra low power sensor nodes able to run a virtual machine to speedup the development and the deployment of sensing monitoring applications VirtualSense is an open hardware open source project which aims at the development of IEEE 802 15 4 compliant low cost ultra low power wireless sensor nodes providing a Java compatible runtime environment which grants to the programmer full control of the low power states of the hardware VS UG 1 Environment Installation v1 0 University of Urbino amp NeuNet www virtualsense it 2 General description and Key Features VirtualSense is an ultra low power wireless node for use in wireless sensor networks WSNs subject to tight power constraints Thanks to the on board Java compatible virtual machine VM it allows programmers to rapidly develop monit
3. 42 University of Urbino amp NeuNet www virtualsense it Otherwise open the same path using the Terminal virtualsense ubuntu cd git virtual sense VirtualSense DJ VirtualMachine 1 0 6 elias db db virtualsense ubuntu git virtual sense VirtualSense DJ VirtualMachine 1 0 darjeeling 1 1 1s build xml cant darjeeling properties lib macrodefs xml src taskdefs xml virtualsense ubuntu git virtual sense VirtualSense DJ VirtualMachine 1 0 darjeeling 1 1 Connect JTAG connector to Virtualsense ProgDebug layer and JTAG USB cable to PC Make sure that it is mounted on port yACMO using the command dmesg virtualsenseQubuntu dmesg 1504 442315 usb 2 2 1 Product Texas Instruments MSP430 JTAG 1504 442317 usb 2 2 1 Manufacturer Texas Instruments 1504 442319 usb 2 2 1 SerialNumber 49FF6053A7D53D23 50144511741 cecdcmacmet2 2c dir hhase device cannot do colitis ons vesmowne It is not a modem 1504 445206 cdc_acm 2 2 1 1 0 ttyACMO USB ACM device virtualsenseQubuntu Note If FTDI 3V3 Jumper on VirtualSense ProgDebug layer is placed you must plug into the PC even the programmer USB cable to provide power to the node VS UG 1 Environment Installation v1 0 43 University of Urbino amp NeuNet www virtualsense it Now to compile and install the application using Eclipse open Outline tab Search run virtualsense blink target right click on it and select Run As gt 1 Ant Buil
4. In detail using this interface you can e Set the working frequency of a mote e Put mote in Standby e Put mote in DeepSleep e Put mote in SystemHibernation static final short MCU 4MHZ static final short MCU 8MHZ static final short MCU 12MHZ static final short MCU 16MHZ static final short MCU_20MHZ static final short MCU 25MHZ native void setrMCUFrequency short freq native void setSystemClockMillis millis native void slowDownClockByFactor factor native void standbyO native void deepSleepQ native void systemHibernation native void scheduleRTCInterruptAfter int minutes void systemHibernation int minutes void deepSleep nt minutes VS UG 1 Environment Installation v1 0 21 University of Urbino amp NeuNet www virtualsense it Class PowerManager define a set of constant attributes to set the working frequency of MCU in a VirtualSense mote The operating frequencies of VirtualSense s MCU are 4MHZ 8MHZ 12MHZ 16MHZ 20MHZ 25MHZ For set a working frequency you must invoke method setMCUFrequency passing as parameter a frequency constant For example to set working frequency to 16MHz you must invoke PowerManager setMCUFrequency PowerManager MCU_16MHZ The rest of methods define by PowerManager are use for manage power consumption setSystemClockMillis millis Sets the system clock at the specified millisecond When you try to set the system clock the MCU is put in LPM3 mode slowDownClo
5. Light Light getValue Writes system time in second on serial port In Time VirtualSense getSecond System out print Thread sleep 1000 Sense application senses every second the levels of all on board sensors external temp internal temp pressure and brightness level and writes the values on serial port VS UG 1 Environment Installation v1 0 28 University of Urbino amp NeuNet www virtualsense it 9 4 Vscaling example Frequency scaling application Scale MCU frequency every seconds at all supported levels Listing 5 VScaling java o rates import javax virtual import javax virtualsense actuators Leds public o elass Vscaling public static void motemain Slow down the system clock lsense powermanagement PowerManager normally it is configured at 10 ms to reduce power consumption leaves the CPU in the LPM3 state x PowerManager setSystemClockMillis 1000 while true Sets MCU frequency 25MHZ PowerManager setMCUFrequency PowerManager System out Sinn 2 META SIS ur CPUBurst Thread sleep 1000 Sets MCU frequency 20MHZ PowerManager setMCUFrequency PowerManager System out println 20MHZ CPUBurst Thread sleep 1000 Sets MCU frequency 16MHZ PowerManager setMCUFrequency PowerManager System out PEL NETA I GMES NE CPUBurst Thread sleep 1000 Sets MCU frequency 12MHZ PowerManager setMCUFrequen
6. runvirtualsensetestsute ro a x Otherwise open the same path using the Terminal Figure 12 Installation by BSL file build xml on Eclipse virtualsense ubuntu cd git virtual sense VirtualSense DJ VirtualMachine nm darjee Hing diss dl virtualsense ubuntu git virtual sense VirtualSense DJ_VirtualMachine 1 0 lousislicizesmals xml cant darjeeling 1 1 1s darjeeling properties lib macrodefs xml src taskdefs virtualsense ubuntu git virtual sense VirtualSense DJ VirtualMachine 1 0 darjeeling 1 1 VS UG 1 Environment Installation v1 0 48 University of Urbino amp NeuNet www virtualsense it Connect the USB cable of the Virtualsense ProgDebug and check using the dmesg command that USB serial interface is connected on ttyUSBO virtualsense ubuntu 7 S dmesg ESAT CLES lo eZ Ae Product tls SIE AT 292 72 0965861 Wise 222 MU MS aa Bale PIE CTS IDE 2324 076182 usb 2 2 2 SerialNumber AE01908B 2 92 470 8 9 019 91 tz CI S ON Zi Zeile bibl USB Seriell Devace converter detected 21394 MASAS 13 2324 083240 usb 2324 083247 usb 2304 IBI SIS 292 Am0 SAA usb 2192 4 90 85 31 sus ttyUSBO GILG virtualsenseQubuntu Detected FT232RL Number of endpoints 2 Endpoint 1 MaxPacketSize 64 Endpoint 2 MaxPacketSize 64 Setting MaxPacketSize 64 FTDI USB Serial Device converter now attached to B SRO ba BI KI D No NO NO BO NN At this time to compile
7. 1 1 0 In target apps add an application dir named with new directory name Listing 13 build xml lt project name VirtualSense_SDK gt import flle S basedir macrodefs xml gt L build all applications gt lt target name build all apps depends gt application dir blink target hexdump gt application dir sense target hexdump gt application dir radioTest target hexdump gt application dir multiThreadBlink target hexdump gt application dir vscaling target hexdump gt application dir new_app1 target hexdump gt lt target gt I clean gt target name clean gt delete dir 5 build gt lt target gt lt target name run virtualsense blink depends build all apps gt distro distro virtualsense Infuslons base darjeeling virtualsense nativeinfusions base darjeeling virtualsense run virtualsense apps blink running blink target run gt lt target gt target name run virtualsense multithread blink depends build all apps gt distro distro virtualsense Infuslons base darjeeling virtualsense nativeinfusions base darjeeling virtualsense run virtualsense apps multiThreadBlink running multiThreadBlink target run gt lt target gt target name run virtualsense radio test depends build all apps gt distro distro virtualsense Infuslons base darjeeling virtualsense nativeinfusio
8. Help sal lala Je e gt ee gt 5 F R Project Explorer 23 app build xml build xml 2N Bs outline 5 _ Sia Virtualsense virtual sense moka coffee lt project name base gt 2 BARR 5 gt Gyapps import file macrodefs xml gt gt O runtinux B gt Gycore gt O runwirtualsense radio test node lt tools targets gt gt Eycpu e target name tools gt 9 runwirtualsense radio test sink Y Gy DJ VirtualMachine 1 0 i ant antfile src tools tools build xml target package gt runwirtualsense collegio node ES lt target gt gt Gy darjeeling 1 1 Esso incas gt runwirtualsense collegio sink NAN eant antfile erc tonle tonle huild vml tarnet clean gt iii g ES xx ER e E o 0 0 erminated gt VirtualSense build xml Ant Build usr lib jvm java 7 openjdk i386 bin java Apr 3 2014 10 39 54 AM exec Writing 4096 bytes at a800 o exec Writing 4058 bytes at b800 exec Writing 4096 bytes at c7dc exec Writing 4096 bytes at d7dc exec Writing 4096 bytes at exec Writing 1830 bytes at exec Writing 4096 bytes at exec Writing 4096 bytes at exec Writing 4096 bytes at exec Writing 4096 bytes at exec writing 4096 bytes at exec Writing 4096 bytes at exec Writing 4096 bytes at exec Writing 4096 bytes at exec writing 1740 bytes at exec Writing 239 bytes at exec writing 16 bytes at exec Done 65227 bytes total exec MSP430 Run
9. Loader 11 1 If you prefer using Eclipse open it and open build xml situated on Installation by JTAG serial interface VirtualSense DJ VirtualMachine 1 0 darjeeling 1 1 e Team Synchronizing VirtualSense DJ_VirtualMachine 1 0 darjeeling 1 1 build xml Eclipse Platform x File Edit Navigate Search Project Run Window Help ra gt gla Ja lje kali Project Explorer pd BS o E Blinkmultiuser java 22 app build xml e build xml 23 N EXE Y VirtualSense virtual sense moka coffee lt project name base gt LARR gt Gyapps import file macrodefs xml v base gt Gycore ai Ey lts import macrodefs xml gt Gycpu target name tools 9 tools ant antfile src tools tools build xml target package lt target gt lt target name tools clean gt Y y DJ_VirtualMachine 1 0 Y gy darjeeling 1 1 e 9 tools clean O libs b Gs build ant antfile src tools tools build xml target clean O apps s lt target gt b Ey gt lib O flash apps gt Gysre lt build all libraries gt clean 3 e target name libs depends tools DUE library dir base eroe B cant library dir darjeeling gt 9 linux trace x am library dir virtualsense gt RB darjeeling properties lt lt library dir motorcar gt gt linux F macrodefs xml lt target gt 9 run linux y taskdefs xml I build all applications gt 9 runwirtualsense radio t
10. and install the application using Eclipse open Outline tab Search run virtualsense blink target right click on it and select Run As gt 1 Ant Build e Team Synchronizing VirtualSense DJ VirtualMachine 1 0 darjeeling 1 1 build xml Eclipse Platform x File Edit Navigate Search Project Run Window Help LE ge le js ie oo 5 8 Its Project Explorer ES E amp 7 0 9 Blinkmultiuserjava app build xml build xml 3 Dl8 amp o Virtualsense virtual sense moka coffee library d irtualsense E lt library d rtualsense gt Gyapps e distro distro virtualsense infusions base darjee 9 runtinux gt ycore nativeinfusions base darjeeling virtualser gt O runvirtualsense radio test node apps testsuite multi user s 5 gt ycpu running testsuite multi user target run gt runwirtualsense radio testsink amp y DJ VirtualMachine 1 0 lt target gt gt runvirtualsense collegio node 7 Gy darjeeling 1 1 e name run virtualsense blink depends tools apps gt gt runwirtualsense collegio sink gt Gs build lt library dir base gt gt runwirtualsense digitalio library dir darjeeling gt gt Gy gt lib dl or Hn gt O runwirtualsensei2c gt Qysrc distro distro virtualsense infusions base darjec Ng NE NG SEAN E AF a bulid emi nativeinfusions base darjeeling virtualser uH i apps blink multi user 9 ru
11. exec MSP430 Close BUILD SUCCESSFUL Total time 52 seconds Jr a amp jo 5 Figure 10 Installation by JTAG compiling and installation on Eclipse done VS UG 1 Environment Installation v1 0 44 University of Urbino amp NeuNet www virtualsense it Instead using the Terminal run the command ant run virtualsense blink virtualsense ubuntu git virtual sense VirtualSense DJ VirtualMachine 1 0 darjeeling 1 1 ant run virtualsense blink exec Writing lew bytes Ene 2000078 Done 65227 bytes total MSP430_Run MSP430_Close exec exec exec BUTED SUCCESS HUME Total time 23 seconds The application is installed and you only have to reset the node to start the execution You can debug the app using a serial client like Cutecom e Team Synchronizing VirtualSense DJ_VirtualMachine 1 0 darjeeling 1 1 build xml Eclipse Platform je ar NE cess OVS B r Cutecom x RE 3 me nm 2 sn E Open device Device dev ttyUSBO Parity None v NG bro ad ety T0 D 8 outline 2 o gt 557 Close device Baud rate 57600 Y Handshake MB software E Hardware E LARRI B2 Eee E b gt al About Data bits a E open for Reading S writing Onan E tar Quit Stop bits 1 A Apply settings when opening gt runwirtualsense radio test node g E gt O runwirtualsense radio test sink v g NOx00 UART In
12. import javax virtualsense powermanagement PowerManager public class MultiThreadBlink public static void motemain Creates shared buffer and threads Buffer b new Buffer Th threadl News cule oa OOO sica e Th thread2 new TAD OO E CSI E2 Starts threads area cis tanto PhreadZes tastes O while true Leds setLed 1 false Leds setLed 2 false b temp 4 Thread sleep 2000 System out print tmp b temp The motemain method creates a shared buffer and two threads that control led 1 and 2 Sleep period of two thread is half seconf for once and second for another so that the leds blinking one at double speed respect to the first In execution time motemain every two seconds turn off all led and decrease share buffer of 4 VS UG 1 Environment Installation v1 0 3 University of Urbino amp NeuNet www virtualsense it Listing 7 Th java ora ries import javax virtualsense actuators Leds public class Th extends Thread Buffer myTemp Shared buffer between all threads int myTime Sleep periode short myLed Led controlled public Th Buffer temp int time short led this myTemp temp this myTime time this myLed led p blic vord run boolean state true while true Leds setLed this myLed state this myTemp temp Thread sleep this myTime state state System out pie nial My led ass ce AE rak sim ya Eed Every thr
13. in witch we find the motemain definition Motemain method is based on while true cycle because this method define the complete behavior of mote and if it return the execution ends and mote will be restarted so if you want create an application that run indefinitely or in base at the value of a condition you must insert a cycle VS UG 1 Environment Installation v1 0 University of Urbino amp NeuNet www virtualsense it 8 VirtualSense API When develop an application for a wireless sensors network is most important have a set of tool that provide to use all functionalities made available from the node VirtualSense lib define a set of APIs that give you a full control of all functionality provided by VirtualSense mote The following table explain a overview of all APIs contained of VirtualSense lib java io Java input and output classes java lang Java support java util Java utilities javax virtualsense actuators Provides management of actuators on the board javax virtualsnese concurrent Provides management of synchronized and race condition javax virtualsnese network Provides management of network functionality javax virtualsense powermanagment Provides management of power consumption of mote javax virtualsense sensors Provides management of sensors on mote VS UG 1 Environment Installation v1 0 15 University of Urbino amp NeuNet www virtualsense it 8 1 Actuators Interfaces The only act
14. static final Byte CHNL3 static final Byte CHNL4 static final Byte CHNL5 static final Byte CHNL6 static final Byte CHNL7 static final Byte CHNL8 native short initcchannels native short getNrADCsQ native short read channel VirtualSense motes has a set of NADCs mapped on pins which can be used as several function For enable one ADC you must invoke method init passing a byte value witch refer to ADC to select VS UG 1 Environment Installation v1 0 17 University of Urbino amp NeuNet www virtualsense it All various ADC channels are down when not use because consume more power then in order to save power enable only you use For example if you want enable the channels 2 and 3 of ADC you must use follow commana ADC init CHNL1 CHNL2 All available channel is masked with an constant attribute provided by class ADC refer to schematic for get pin out configuration To read level of an ADC channel class ADC provide method read that return level read from ADC making an average of several samples For read value of channels 1 and 2 short levell ADC read CHNL1 ADC read CHNL2 short level2 VS UG 1 Environment Installation v1 0 18 University of Urbino amp NeuNet www virtualsense it 8 2 2 Light The class that manages brightness sensor is Light java int getValueO The Light class provide the method getValue for read the current brightness level this level is mapped on an intege
15. VirtualSense User Guide 2 Application Programming Interface University of Urbino amp NeuNet www virtualsense it Revision 1 0 April 3 2014 This guide applies to VirtualSense hardware platform 1 1 0 open source yd University of Urbino amp NeuNet Contents 1 Introduction 2 General description and Key Features 3 Key components and features 4 Architecture 5 Hardware and software stacks 6 Install VirtualSense Development Kit 6 1 System Requirements ss 6 2 Installation 0 o o 6 2 1 Install Requirements 6 22 Install VSDK ee 6 2 3 Install VirtualSense BSL 7 Basic Application Structure 8 VirtualSense API 8 1 Actuators Interfaces Gill VOCS PTT TP 82 Sensors Interfaces oon 8 2 1 ADC uuu smash a dnas heh SR P aca 8 22 LONE usu mido Ron PR RR Re A A 823 Temperature o 8 2 4 Pressure cs oso es Y Y wo 3S ode 8 3 PowerManagement Interfaces 8 4 Network Interfaces 0 0 8 4 1 Networking example 9 VirtualSense Example 9 1 Hello World example rens 9 2 Blinkexample een 9 3 Sense example 9 4 Vscalingexample 9 5 Multi Thread example 9 6 Radio Test example 10 Create a new application VS UG 1 Environment Installation v1 0
16. acket import javax virtualsense actuators Leds import javax virtualsense powermanagement PowerManager import javax virtualsense VirtualSense public class RadioTest public static void motemain short nodeId VirtualSense getNodeId if nodeld 1 I am the sink init a null protocol Network init sink else I am the sender Networki imit new MinPathProtocol sender nodeId Buble static yord sink Syot em out rain ST NERIS VS UG 1 Environment Installation v1 0 34 University of Urbino amp NeuNet www virtualsense it new Thread The interest sender thread publie vord run System out println Starting interest thread byte i 126 while true Thread sleep 15000 byte d new byte 3 d 0 0 MinPathProtocol INTEREST Glial c We 7 7 cis loja AA A cp abro Packet p new Packet d Network send p VirtualSense printTime System out println INTEREST starti or Thread yield System out println Receiver thread while true Packet p Network receive VirtualSense printTime System out println Packet received from p getSender System out println javax virtualsense radio Radio getSenderId byte data p getData for ne eis OA lt Kalak a lengths Leds setLed 1 true System out PEINE DE System out prine data i Leds setLed 1 false SV SIESMRO Ue ouste
17. alSenseBSL make WITHOUT READLINE 1 After compiling install the binary by running as root make install VS UG 1 Environment Installation v1 0 12 University of Urbino amp NeuNet www virtualsense it 7 Basic Application Structure In order to develop an a general application the first step is write the source code which is then compiled and finally executed When we are going to write an application for VirtualSense de signed to work with Java source the first step is define the Class that contains the motemain method The method motemain is the first method executed on startup of VirtualSense applica tions define the behavior of mote in question and must be define as public static void motemain TODO code application logic here So the generally structure of a VirtualSense application named FirstApp must be as Listing 1 FirstApp java Libraries import lt libraries gt Import libraries to use here KK KE ES Ea pili c ates oT author virtualsense publie telase T FITS CAPE KK Definition of motemain method x public static void motemain M Statments tor aniztalize device Behavior of application while true TODO code application logic here VS UG 1 Environment Installation v1 0 13 University of Urbino amp NeuNet www virtualsense it The structure is similar as a normal java application at the top are the libraries used after there is the definition of class
18. art thread protocol using class passed as a parameter If you don t want extend class Protocol you can use a NullProtocol but in this way all incoming packet are froward at application threads which are responsible for the management Network class provide for exchange packets with others mote two methods send and receive Send method sends a Packet type message follow rules required by the Protocol Receive method blocking the invoker to wait a message and when one is coming return an Packet type object All packets exchanged on a VirtualSense network are of following type Packet byte datan Packet byte data short s short r byte getDataO short getSenderO short getReceiverQ void setSender short sender void setReceiver short receiver Packet type contains sender information receiver information and the content of the packet expressed as byte array VS UG 1 Environment Installation v1 0 24 University of Urbino amp NeuNet www virtualsense it 8 4 1 Networking example Every time is created an network application on VirtualSense there are almost two thread running on every mote Main thread and Protocol thread M EO F VSnetwork S VS2 gr Y ES D VS E c IA e s S VS3 B D VSI m D VS2 pas N iit D Protocol Y J Network P Network Moin 4 Figure 5 VirualSense networking Main thread performs processing and interchanges
19. ary dir virtualsense gt lt lt library dir motorcar gt gt lt target gt RB darjeeling properties 9 linux O run linux 9 run virtualsense radio testnode 3j macrodefs xml 3 taskdefs xml b ydoc b Gy gt examples b gy platform lt build all applications gt target name apps depends tools libs application dir blink multi user target hexdump application dir sense multi user target hexdump application dir radio test node target hexdump 9 runvirtualsense radio test sink run virtualsense collegio node 9 run virtualsense collegio sink E gt Extools lt application dir radio test sink target hexdump run virtualsense digitalio A an application dir collegio node target hexdump Ex Makefile include lt application dir collegio sink target hexdump gt 9 run virtualsense izc Ej README application dir multiThreadBlink multi user target hex O run virtualsense noiseMeter application dir testsuite multi user target hexdump is Ey README BUILDING application dir vscaling multi user target hexdump runwirtualsense sense Ey README EXAMPLES application dir energyBenchmarks multi user target hexi run virtualsense peopleCounter application dir ctp multi user target hexdump E application dir digitalio multi user target hexdump 9 run virtualsense co2meter eS eram PERI
20. ax virtualsense actuators Leds import javax virtualsense radio Radio import javax virtualsense VirtualSense public class MinPathProtocol extends Protocol private byte minHops byte 127 private byte epoch byte 127 short nodeId VirtualSense getNodeId private static byte data new byte 10 to fix a GC problem protected void packetHandler Packet received data received getData if data 0 0 INTEREST MESSAGE Leds setLed 2 true if data 2 epoch new epoch start reset routing table epoch data 2 super bestPath 1 minHops byte 127 f data 1 lt this minHops VirtualSense printTime System out println Routing updated this minHops data 1 super bestPath Radio getSenderId in this case we need to forward the interest and increment the hop counter data 1 1 Packet forward new Packet data Thread sleep 50 super sendBroadcast forward VS UG 1 Environment Installation v1 0 37 University of Urbino amp NeuNet www virtualsense it Leds setLed 2 false if data 0 1 DATA if data 1 1 the packet should be forwarded to the sink 1 we ane EN moule Leds setLed 4 true VirtualSense printTime System out println Forward packet to the sink Thread sleep 50 super send received to paper filtering Leds setLed 4 false else data i
21. bles distro virtualsense txt lt arg l lt exec gt END of programming command under Linux OS using BSL Programmer lt target gt lt project gt VS UG 1 Environment Installation v1 0 47 University of Urbino amp NeuNet www virtualsense it Now if you prefer using Eclipse open it and open build xml situated on VirtualSense DJ_VirtualMachine 1 0 darjeeling 1 1 e Team Synchronizing VirtualSense DJ_VirtualMachine 1 0 darjeeling 1 1 build xml Eclipse Platform x File Edit Navigate Search Project Run Window Help RE Ima Je ee S Es Project Explorer 53 m BlinkMultiUser java e app build xml 2 build xml A Y VirtualSense virtual sense moka coffee lt project name base gt JL QR ORI gt Gyapps import file macrodefs xml Y Y base b ycore Maa Ex i todls targets gt import macrodefs xml gt ycpu e target name tools gt tools ant antfile src tools tools build xml target package lt target gt lt target name tools clean gt Ey gt DJ_VirtualMachine 1 0 Y y darjeeling 1 1 e 9 tools clean 9 libs b gt build ant antfile src tools tools build xml target clean gt apps gt 2 lt target gt Gy lib 9 flash apps gt esre build all libraries 9 clean e target name libs depends tools gt bunda library dir base 9 doc Ey cant lt library dir darjeeling gt linux trace lt libr
22. ckByFactor factor standby Puts the MCU in LPM3 where consume approximatively 2 1 uA In this mode wakeup is possible through all enabled interrupts deepSleepO Puts the MCU in LPM4 where consume approximatively 1 3 uA In this mode wakeup is possible through all enabled interrupts systemHibernationQ Puts the MCU in LPM4 5 where consume approximatively 0 1 uA To wake up from this mode the system need to restart by an interrupt over P1 or P2 port Before is put to LPM4 5 MCU write machine state on non volatile memory When resume MCU check if exist an hibernation state and if exist the execution of the VM will restart from the subsequent statement Otherwise the execution will restart from main scheduleRTCInterruptAfter minutes systemHibernation minutes Hibernates the system for the specified time The MCU can be woke up by un interrupt over P1 or P2 port or at the end of specified time deepSleep minutes Puts the MCU in LPM4 for the specified time MCU can be woke up through all enabled interrupts or at the end of specified time VS UG 1 Environment Installation v1 0 22 University of Urbino amp NeuNet www virtualsense it 8 4 Network Interfaces The Network interface manage the communication between nodes in a VirtualSense sensor net work Precisely manges the radio layer on VirtualSense for create a network between notes exchange some information within the network route packet into the network using a given pro tocol T
23. cts az Select a directory to search for existing Eclipse projects AM O Select root directory Browse Select archive file home virtualsense Downloads VirtualSense_SDK 1 1 0 zip Browse e Select archive containing the projects to import x Projects f F za BUDE pene x DeselectAll Places Name y Size Modified El bel adores A Search 7 VirtualSense SDK 1 1 0 zip Dant ense Refresh D Recently Used blink vscali REUS I HR 3 h ng virtualsense lib lib est sktop E File system amp Copy projects into workspace B Floppy Disk Working sets a Documents Music Add project to working sets la pis m ictures Working sets Select B Videos EH JE jar zip tar tar gz tgz v 0 lt Back GWEN cancel Einish X cancel Figure 4 Import VSDK on Eclipse step2 VS UG 1 Environment Installation v1 0 11 University of Urbino amp NeuNet www virtualsense it 6 2 3 Install VirtualSense BSL The last step is install BSL Boot Strap Loader Programmer Download virtualsense bsl from http virtual sense googlecode com files VirtualSenseBSL tgz Ensure that you have the necessary packages to compile programs that use libusb On Debian or Ubuntu systems you might need to do apt get install libusb dev After that unpack and compile the source code with tar xvfz VirtualSenseBSL tar gz cd Virtu
24. cy PowerManager System Da aene EMEN ENDE CPUBurst Thread sleep 1000 Sets MCU frequency 8MHZ PowerManager setMCUFrequency PowerManager System out printen aM MCU_25MHZ MCU_20MHZ MCU_16MHZ MCU_12MHZ MCU_8MHZ VS UG 1 Environment Installation v1 0 29 University of Urbino amp NeuNet www virtualsense it CPUBurst Thread sleep 1000 Sets MCU frequency 4MHZ PowerManager setMCUFrequency PowerManager MCU_4MHZ Swisiteemesoutepr ntn AMA Zs ms CPUBurst Thread sleep 1000 public static void CPUBurst for int i 0 2 lt 10000 i VScaling application perform the sum of 10000 integers implemented by the function CPUBurst at all supported MCU frequency level Supported frequencies 25MHz 20MHz 16MHz 12MHz 8MHz 4MHz adding a delay of one second between each change This application is useful for estimate the power consumption at ever frequency level VS UG 1 Environment Installation v1 0 30 University of Urbino amp NeuNet www virtualsense it 9 5 Multi Thread example Blink example using Multiple Threads This application is formed by 3 class e MultiThreadBlink java Containing motemain method main thread e Th java Defines the behavior of all thread running concurrent of main motemain e Buffer java Defines an shared object between all thread Listing 6 MultiThreadBlink java Libraries import javax virtualsense actuators Leds
25. d e Team Synchronizing VirtualSense DJ VirtualMachine 1 0 darjeeling 1 1 build xml Eclipse Platform x File Edit Navigate Search Project Run Window Help Jles lella ee g 9 e e E baled R Project Explorer 235 E 5 78 BlinkMultiserjava lapp build xml build xml 3 E I a ibrary dirs virtusti EH v VirtualSense virtual sense moka coffe library dir virtualsense i 3 N gt hee moka coffee library dir virtualsense E NES A Seo gt amp yapps e distro distro virtualsense infusions base darjee gt O runtinux gt Qycore nativeinfusions base darjeeling virtualser gt O runvirtualsense radio test node apps testsuite multi user a i gt Qycpu running testsuite multi user target run gt runvirtualsense radio test sink Y y gt DJ_VirtualMachine 1 0 lt target gt gt 9 runwirtualsense collegio node Y Gy darjeeling 1 1 QYPE name run virtualsense blink depends tools apps gt 9 runwirtualsense collegio sink gt Gs build library dir base gt gt 9 runvirtualsense digitalio lib library dir darjeeling gt A i Gell library dir virtualsense gt gt O runvirtualsensej2c gt Eysre e distro distro virtualsense infusions base darjec gt 9 run virtualsense noiseMeter 7 build xml nativeinfusions base darjeeling virtualser 9 gt wild ym apps blink multi
26. d pu SIS TS Owie ajoe ae in OMA VS UG 1 Environment Installation v1 0 35 University of Urbino amp NeuNet www virtualsense it public static void sender short nodeId byte i 127 boolean state true while true Thread sleep 1200 byte data new byte 90 data 0 1 MinPathProtocol DATA data 1 1 packet should be forwarded to the sink data ap ME b ehe Kala ea data 3 byte nodeId gt gt 8 this is node id data 4 byte nodeId amp Oxff this node id for byte h 5 h lt data length h data h h HESS Leds setLed 0 state Packet p new Packet data Network send p VirtualSense printTime System out println SENDER packet sent state state On sink node there are two concurrent threads once that writes on serial port incoming packets from receivers nodes and the other that defines the epochs within the network The threads on sink node are both generated by class RadioTest Also on sender nodes there are two threads once that sends packet to Sink and the others that route packets The thread that manage packets routing is generated by class MinPathProtocol that sends broadcast packets to find the minpath between nodes VS UG 1 Environment Installation v1 0 36 University of Urbino amp NeuNet www virtualsense it Listing 10 MinPathProtocol java alo re les import javax virtualsense network import jav
27. dio test sink v Q 0x00 UART Initialized i2c enabled Ickage run virtualsense collegio node Rime address 4 0 4 pi 7 startea 9 run virtualsense collegio sink Contiki 2 5up cc2520 process started jean gt 9 run virtualsense digitalio MAC 2 3b 9f fe ff a3 04 00 6 riialasi Node id 4 E pa Installed applications 1 9 run virtualsense noiseMeter Load a new app id 1 9 run virtualsense sense Starting a task Free mem 4800 nad run virtualsense peopleCounter Free mem 4716 9 run virtualsense co2meter PR aa run virtualsense testsuite gt O run virtualsense blink Hex output Log to h home virtualsense cutecom log m 9 run virtualsense storage E E 9 run virtualsense vscaling G fat gt 9 run virtualsense hblink El ar ES run virtualsense energyBench 8 poseo b O run virtualsense Mblink B ot O runwirtualsense ctp E Input p gt t file darjeeling properties from impc gt library from import macrodefs xml gt application from import macrodefs E gt distro from import macrodefs xml d ICES je B05 DO Bron seron NNNM ames DO n 159 0 Figure 15 Installation by BSL app installed cutecom serial debug VS UG 1 Environment Installation v1 0 51
28. ead in addition to flash the controlled led at frequency specified increase the buffer of an unity every execution cycle Listing 8 Buffer java public class Buffer Shared object is an integer modified by all threads Public anes temp VS UG 1 Environment Installation v1 0 32 University of Urbino amp NeuNet www virtualsense it Buffer class composed of a single integer is shared from all thread which change its value at all cycle The content of buffer class is prints of serial port by motmain thread Is useful control its convergence to a constant value to ensure the effective execution of all threads VS UG 1 Environment Installation v1 0 33 University of Urbino amp NeuNet www virtualsense it 9 6 Radio Test example Example application that use radio functionality for exchange information between a sink and more node sender Communications is regulated by a minpath protocol that manage routing functionality Application is formed by 2 class e MultiThreadBlink java Defines the behavior of sink and sender nodes e MinPathProtocol java Extends class Protocol to implement minpath routing algorithm The RadioTest class define the behavior of all node The task of sink or sender on the network is define by a nodeld of mote if a mote has nodeld like 1 will behave as sink otherwise as sender Listing 9 RadioTest java Libraries import javax virtualsense network Network import javax virtualsense network P
29. eam Synchronizing VirtualSense DJ VirtualMachine 1 0 darjeeling 1 1 build xml Eclipse Platform x File Edit Navigate Search Project Run Window Help EE lela e l pre Ej 3s R Project Explorer 3 E 17 7 Cfi build xml amp A app build xml iivmontik mspa3o bu BIS outline 25 D E library dir darjeeling gt E a Ed gt Excpu library dir virtualsense gt 3 saure Be Y gy gt DJ_VirtualMachine 1 0 e distro distro virtualsense infusions base gt O tools clean B Es m nativeinfusions base darjeeling vir y darjeeling 1 1 apps cozmeter multi user gt libs gt Qs build running co2meter multi user target gt O apps I gt Gy lib ucc gt O flashapps X gy src e target name run virtualsense testsuite depends tools apps gt O clean gt lt lihrary dir hace _ gt E Console X x kl a sie e E o 5 20 terminated VirtualSense build xml Ant Build usr lib jvm java 7 openjdk i386 bin java Apr 3 2014 3 59 35 PM exec Writing 252 bytes to 1 5ag 0 exec Writing 252 bytes to 1769c exec Writing 252 bytes to 17798 exec Writing 252 bytes to 17894 exec Writing 252 bytes to 17990 exec Writing 252 bytes to 17a8c exec Writing 252 bytes to 17b88 exec Writing 252 bytes to 17c84 exec Writing 252 bytes to 17d80 exec Writing 252 bytes to 17e7c exec Writing 252 bytes to 17178 exec Writing 252 bytes to 18074 exec Wri
30. est node b ydoc 9 target name apps depends tools libs 9 run virtualsense radio test sink application dir blink multi user target hexdump application dir sense multi user target hexdump application dir radio test node target hexdump b Qy examples gt gy platform run virtualsense collegio node run virtualsense collegio sink Eg README EXAMPLES application dir energyBenchmarks multi user target hexi application dir ctp multi user target hexdump application dir digitalio multi user target hexdump application dir i2c multi user target hexdump annnliostion dim Nasanana multi mang gpi ua NAN ia a JD Bl b application dir radio test sink target hexdump iaitali aloes A lt application dir collegio node target hexdump gt papan agak ai Ex Makefile include application dir collegio sink target hexdump 9 runwirtualsense i2c Ej README application dir multiThreadBlink multi user target hex O runvirtualsense noiseMeter s application dir testsuite multi user target hexdump s Ey README BUILDING application dir vscaling multi user target hexdump runvirtualsense sense 9 run virtualsense peopleCounter 9 run virtualsense co2meter 9 run virtualsense testsuite ro a x Figure 8 Installation by JTAG file build xml on Eclipse VS UG 1 Environment Installation v1 0
31. he classes that provide that functionality are Network Protocol Packet and NullProtocol For add network functionality to an application you must include follow library import javax virtualsense network To create a VirtualSense network the first step is extends abstract class Protocol that permits to define the system management of packets exchanged between nodes Class Protocol can not be used directly within an application because on running is represented by a separate thread that listens on radio channel and manages all incoming packets void send Packet void sendBroadcast Packet Packet receiveO void notifyReceiver O void packetHandler Packet void start void stopO The method that must be define when creates a Protocol for VirtualSense is packetHandler This method is invoke by Protocol thread whenever there is an incoming packet If the incoming packet must be forwarded to application you must invoke the method notifyRecever which will indicate to the application that there is a packet for her The class to be used directly in the application for manage network functionality Network VS UG 1 Environment Installation v1 0 23 University of Urbino amp NeuNet www virtualsense it Protocol protocol static void initO static void init Protocol static void send Packet static Packet receiveO Network class which should not be instantiated once initialized with method init creates and st
32. icense for more details You should have received a copy of the GNU General Public License along with VirtualSense If not see lt http ww gnu org licenses gt ek New application author virtualsense import Libraries public class NewAppl t Definition of motemain public static void motemain while true TODO code application logic here ih File app build xml Listing 12 app build xml project basedir default compile gt lt Ii application directory relative to src app gt property name app dir valuez new appi gt lt application nome and version gt property name app name value new_app1 gt property name app majorversion value 0 gt property name app minorversion value 1 gt lt the rest is included from apps build xml gt import filez app build xml gt I includes gt patternset id app includes gt include name base dih gt include name darjeeling dih gt include name virtualsense dih gt lt patternset gt lt project gt In file app build xm is important set properties app name and app dir with the name of app direc tory in this case new appT VS UG 1 Environment Installation v1 0 40 University of Urbino amp NeuNet www virtualsense it After created application file last step is uodate file build xml located in VirtualSense_SDK
33. information on network through Protocol thread Protocol thread manage all packet incoming on mote passing to main thread those destined to it and forward those intended for other nodes Two threads communicate by Network type object that provide method for send and receive packets VS UG 1 Environment Installation v1 0 25 University of Urbino amp NeuNet www virtualsense it 9 VirtualSense Example VSDK provide various sample applications useful for getting started to develop application The example are contained in VirtualSense SDK 1 1 0 src 9 1 Hello World example Example of Hello world on VirtualSense Listing 2 HelloWorld java Libraries import javax virtualsense VirtualSense public class HelloWorld public static void motemain while true Write the String Hello World on serial port System out println Hello World Thread sleep 1000 Write string Hello World on serial port every second VS UG 1 Environment Installation v1 0 26 University of Urbino amp NeuNet www virtualsense it 9 2 Blink example Simple example of blink VirtualSense application Listing 3 Blink java a Rates import javax virtualsense actuators Leds import javax virtualsense powermanagement PowerManager import java lang Runtime public class Eine public static void motemain boolean state true State of leds x Slow down the system clock normally it
34. irtualsense it 11 2 Installation by Boot Strap Loader BSL To install an app with BSL Programmer you must modify an project configuration file named vm contiki msp430 build xml located in VirtualSense DJ VirtualMachine 1 0 darjeeling 1 1 src vm Once opened the file at the end of it you can found the instruction used for install the app on the node Listing 14 vm contiki msp430 build xml target name run depends compile applicationflasher property name msp430 port value dev ttyACMO this is the programming command under Linux OS using mspdebug exec executable mspdebug gt lt a gine MEA P sarg line lt arg Line d msp130 port gt arg line prog S vm executables S distro virtualsense txt gt lt exec gt END of programming command under Linux OS using mspdebug gt target project VS UG 1 Environment Installation v1 0 46 University of Urbino amp NeuNet www virtualsense it To use BSL Programmer change it as following Listing 15 vm contiki msp430 build xml lt target name run depends compile applicationflasher gt lt property name msp430 port value dev ttyUSBO gt this is the programming command under Linux OS using BSL Programmeri z exec executable virtualsense bsl gt arg line d msp430 port arg line flash bsl15 gt arg line long password gt line prog vm executa
35. is configured at 10 ms to reduce power consumption leaves the CPU in the LPM3 state x PowerManager setSystemClockMillis 500 while true Toggles sequentially leds state every second hor shore r n0 ELE Leds setLed i state Thread sleep 1000 state state Blink application after sets clock at 500 millisecond update every second the state of all leds on mote sequentially starting from first to last VS UG 1 Environment Installation v1 0 27 University of Urbino amp NeuNet www virtualsense it 9 3 Sense example Sensing application on Virtualsense on board sensors Listing 4 Sense java Libraries import javax import javax import javax import Javas pu ublic class virtualsense actuators Leds virtualsense sensors x virtualsense VirtualSense darjeeling Darjeeling Sense public static void motemain while true Turn on a led Leds setLed 0 true Reads actu System out print Reads actu System out pr Reads actu SV SECM OU pir aimi Reads actu System out print al external temperature and writes it on serial port intln Temp Temperature getValue al internal temperature and writes it on serial port intln TempBoard Temperature getBoardValue al external pressure and writes it on serial port intin Pressure Pressure getValue al brightness level and writes it on serial port In
36. itialized i2c enabled ckage gt 9 runwirtualsense collegio node Rime address 4 0 bil ad n gt 9 runwirtualsense collegio sink Contiki 2 5up c jean gt 9 runwirtualsense digitalio MAC 2 3b 9f fe gt 9 runwirtualsense i2c Node id 4 mm Installed applications 1 gt 9 runwirtualsense noiseMeter Load a new app id 1 b 9 run virtualsense sense TA task Eres mem 8000 gt 9 run virtualsense peopleCounter gt 9 runwirtualsense co2meter gt O runwirtualsense testsuite b g O run virtualsense blink gt a Hex output Log to y home virtualsense cutecom log gt O runwirtualsense storage da i ja gt 9 runwirtualsense vscaling gt el Tat dE gt 9 runwirtualsense hblink El ar H E gt 9 runwirtualsense energyBench j NAMEVirtualsense b gt 9 runwirtualsense Mblink A AT BAUD7 E t hi E E Gao A gt runvirtualsense ctp E Input J jump to file darjeeling properties from impc i E Send file Script 7 Nolineend Chardelay 1ms pa nen gt library from import macrodefs xml y Nc gt application from import macrodefs gt distro from import macrodefs xml 3 E E I oo KC uE a Brem synchroniz Ecutecom Wi ivirtuatsenseeu Bos MMM Y 1159 O Figure 11 Installation by JTAG app installed cutecom serial debug VS UG 1 Environment Installation v1 0 45 University of Urbino amp NeuNet www v
37. n virtualsense sense B cant running blink multi user target run gt runvirtualsense peopleCounter B darjeeling properties targets gt O runwirtualsense co2meter dij macrodefs xml lt target name run virtualsense storage depends tools apps gt runvirtualsense testsuite 4 library dir base gt taskdefs xml lt Library dir dar wake Targets gt runvirtualsense blink gt amp ydoc library d no run virtualsense storage gt Gs examples MEA uatsensevcing gt ga platform 2Ant Build DebugAs gt run virtualsense hblink rofile As b gt ytools pm P HN run virtualsense energyBench Makefile include Clean Selected File s run virtualsense Mblink README e lt target name run virtual Build Selected File s e H run virtualsense ctp a library dir bas Open Javadoc Wizard Ey README BUILDING library dir dar deum Ey README EXAMPLES library dir vir E 7 e distro distro v Compare With d 1 nativeinf Replace With gt application from import macrodefs gt file darjeeling properties from impc library From import macrodefs xml C 38 Run C C Code Analysis distro from import macrodefs xml F 7 E ET Tr p Remove from Context Shift Ctrl Alt Down Tw aX 1 ls Bas Figure 13 Installation by BSL compiling with ant builder on Eclipse VS UG 1 Environment Installation v1 0 49 University of Urbino amp NeuNet www virtualsense it e T
38. ns base darjeeling virtualsense run virtualsense apps radioTest running radioTest target run gt lt target gt target name run virtualsense sense depends build all apps gt distro distro virtualsense Infuslons base darjeeling virtualsense nativeinfusions base darjeeling virtualsense run virtualsense apps sense running sense target run gt lt target gt target name run virtualsense vscaling depends build all apps gt distro distro virtualsense Infuslons base darjeeling virtualsense nativeinfusions base darjeeling virtualsense run virtualsense apps vscaling running vscaling target run f gt lt target gt Add a new target named run virtualsense newapp1 for compile and instal the application on motes target name run virtualsense newapp1 depends build all apps gt distro distro virtualsense Infuslons base darjeeling virtualsense nativeinfusions base darjeeling virtualsense run virtualsense apps new_app1 running new_app1 target run gt lt target gt lt project gt VS UG 1 Environment Installation v1 0 41 University of Urbino amp NeuNet www virtualsense it 11 Next we will explain how to install a sample application for example the blink sample application There are two methods to install an application on a VirtualSense node Install an application e Using the JTAG serial Interface e Using the Boot Strap
39. oring applications and communication protocols Virtu alSense makes use of IEEE 802 15 4 wireless transceivers in order to standardize communication and to inter operate with other existing devices The set of on board sensors including pressure temperature and light together with the possibility to easily connect any external sensor actua tor allows VirtualSense to be used in a wide range of application fields In order to promote research and development VirtualSense adopts an open hardware open source model In particular it mounts widely available off the shelf components and it makes publicly available all PCB schematics The open source software stack is based on a modified version of Darjeeling java compatible VM running on top of Contiki operating system VS UG 1 Environment Installation v1 0 6 University of Urbino amp NeuNet www virtualsense it 3 Key components and features The key components of VirtualSense 1 0 are listed below 250kbps 2 4GHz IEEE 802 15 4 Texas Instruments cc2520 Wireless Transceiver 25MHz Texas Instruments MSP430f54xxa microcontroller unit MCU with 16k RAM and 128k Flash Integrated Humidity Temperature and Light sensors 512K I2C M Serial EEPROM On board 48 bit I2C Extended Unique Identifier EUI 48 On board programmable ultra low power RTC The distinguishing features include Ultra low power consumption 10W in hibernation 100W in sleep mode 50 60mW in send re ceive modes res
40. pectively with state of the art energy harvesting modules Fast wakeup from sleep mode 5s Programmable timed wake up from any low power mode Sensitivity to asynchronous external events Integrated 12 bit ADC DAC Integrated Supply Voltage Supervisor SVS Integrated DMA Controller USB 2 0 RS232 UART communication with a PC Interoperability with other IEEE 802 15 4 devices Open source software stack Contiki MAC layer compatibility Java compatible run time environment Easy Over the Air OTA programming VS UG 1 Environment Installation v1 0 7 University of Urbino amp NeuNet 4 Architecture VirtualSense is made of ultra low power components in order to keep the average consump tion compatible with state of the art energy harvesters Figure 2 shows the functional block di agram representing the node architecture The core is a MCU belonging to the Texas Instrument MSP430F54xxa family It communicates through I2C M bus with a Microchip 24AA025E48 Extended Unique Identifier and with a Microchip 24AA512 serial 512K EEPROM Using the SPI bus the MCU manages the Texas Instruments CC2520 2 4GHz IEEE 802 15 4 RF transceiver and communicates with the NXP PCF2123 ultra low power real time clock calendar BH1620FVC 1 Light sensor and ADC 14 ADC 13 2 5 HIH5030 31 OUT Humidity sensor jo 8HEADER 7 ADC 0 7 CONNECTOR P8 0 7 8HEADER 8 UART 0 CONNECTOR UCAO 8 LEDs 8 BANK TXRX
41. pp java but build file must be called app build xml File Edit Navigate Search Project Run Window Help DE Ja i E Project Explorer 3 SETH gt 5DK 1 1 0 a new_app1 x File Edit Go Bookmarks View Tools Help Fl gt yirtualsense SDK 1 1 0 src new app1l y Y Places a ste TM CS lt b multiThreadBlink P 5 1j 7 new_appt Bil Desktop app bul xm NewApp jav Depp build xml E trash Em i NNI NENNEN M vicios gt sa E Floppy Disk ra lll Documents ll Music Pictures roperties lil videos il Downloads 7 4 2 NewApptjava VirtualSense SDK 1 1 0 src new_app1 Zitems Free space 1 8 GiB Total 7 9 GiB Figure 7 Create java file and build file VS UG 1 Environment Installation v1 0 39 University of Urbino amp NeuNet www virtualsense it File NewAppl java Listing 11 NewApp1 java NewAppl java Copyright c 2013 DiSBeF University of Urbino This file is part of VirtualSense VirtualSense is free software you can redistribute it and or modify it under the terms of the GNU General Public License as published by the Free Software Foundation either version 3 of the License or at your option any later version VirtualSense is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public L
42. r value where 2147483647 is assumed as full light and 2147483648 is full darkness For read the current brightness level you must use int lightLevel Light getValue 8 2 3 Temperature The class that manages a Temperature sensor is Temperature java int getValueO int getBoardValueO The class Temperature read two different level of temperature cpu temp using an internal ADC and external temperature using the on board sensor both temperature levels are mapped on an integer value than For read current temperature level on both sensors the commands are int boardTemp Temperature getValue int extTemp Temperature getValue VS UG 1 Environment Installation v1 0 19 University of Urbino amp NeuNet www virtualsense it 8 2 4 Pressure The class that manages a Pressure sensor is Presure java int getValueO The Light class provide the method getValue for read current pressure level measured whit barometer sensor Pressure value is mapped on an integer than For read current pressure level command is int pressure Pressure getValue VS UG 1 Environment Installation v1 0 20 University of Urbino amp NeuNet www virtualsense it 8 3 PowerManagement Interfaces The power management interface provide a set of functionality for manage the power consump tion of VirtualSense motes For use PowerManagment functionality you must import the library import javax virtualsense powermanagement
43. s for the node We are the receiver Leds setled 5 true VirtualSense printTime System out Prine In Data ISA ror usii super notifyReceiver Leds setLed 5 false VS UG 1 Environment Installation v1 0 38 University of Urbino amp NeuNet www virtualsense it 10 Create a new application For create a new VirtualSense application named for example new_app1 you must take the following steps On VirtualSense SDK Directory Tree create a new folder named new_app1 that will contain all file of new application VirtualSense SDK 1 1 0 src File Edit Navigate search Projet Run Window Help rt Ja 114 m project Explorer 5 ga v u ial jense SDK 1 1 0 SERI a sre xx File Edit Go Bookmarks View Tools Help fl lt gt A Virtualense SDK 1 1 0 srd D Places O virtualsense ul I Bil Desktop blink mutifivasd radioTest E trash ded ES Applications Blapp bulldxmt E Floppy Disk sense wscaling app build xm lis lll Documents I ih Music Pictures BB Videos Ii Downloads Jel amp new app1 Virtualsense SDK 1 1 0 src new app1 folder Free space 1 8 GiB Total 7 9 GiB Figure 6 Create a new application folder In the new directory named new appl creates a new java file that will be contain the main method and a xml buil file to use for compile application The name of java file should not respect few rules and for example can call NewA
44. ting 252 bytes to 18170 exec Writing 252 bytes to 1826c exec Writing 252 bytes to 18368 exec wW exec riting 252 bytes to 18464 exec Writing 236 bytes to 18560 exec Writing 239 bytes to 5c00 exec Writing 16 bytes to 20000 BUILD SUCCESSFUL Total time 24 seconds oi r amp ls Bo Figure 14 Installation by BSL compiling and installation on Eclipse done Instead using the Terminal run the command ant run virtualsense blink virtualsense ubuntu git virtual sense VirtualSense DJ VirtualMachine 1 0 darjeeling 1 1 ant run virtualsense blink exec Writing 239 bytes to 5c00 exec Writing I waters Om 000 0 a BUTTIZDESUCGBSSEBEUE Total time 23 seconds VS UG 1 Environment Installation v1 0 50 University of Urbino amp NeuNet www virtualsense it Now the application is installed You can debug the app using a serial client like Cutecom e Team Synchronizing VirtualSense DJ VirtualMachine 1 0 darjeeling 1 1 build xml Eclipse Platform x 1 Eile f CuteCom taoci C WA Mens E E i D Outline 1 Close devce Sauda 0 Handshake Software Hardware d amp QARR D E Ir rd About Databits poene Mae M RS gt rumin g Quit Stop bits Mi Apply settings when opening i run virtualsense radio testnode g r1 9 run virtualsense ra
45. tion using an integrated programming environ ment 6 2 Installation 6 2 1 Install Requirements In a linux OS open Terminal Alt Ctrl T and insert the following commands sudo apt get install openjdk 7 jre ant srecord If you want work with IDE insert also sudo apt get install eclipse 6 2 2 Install VSDK Download package VirtualSense SDK 1 1 0 zip from http www virtualsense it download If you don t wont use Eclipse IDE unpack the downloaded package and skip next step Otherwise don t unpack the package and perform next step hnome virtualsense Downloads unzip VirtualSense_SDK 1 1 0 zip d home virtualsense VS UG 1 Environment Installation v1 0 10 University of Urbino amp NeuNet www virtualsense it Open Eclipse and go on File gt Import select Existing Projects into Workspace and click Next e Import Select M Create new projects from an archive file or directory E Select an import source a gt amp General Iz Archive File Existing Projects into Workspace C3 File System E Preferences amp cvs amp install IL Plug in Development P Run Debug i P Team i Q lt Back Next gt cancel Enish Figure 3 Import VSDK on Eclipse step 1 Check Select archive file browse VSDK package previous downloaded uncheck all projects de tect on Projects section except VirtualSense SDK 1 1 0 and click Finish e Import Import Proje
46. tualSenese Runtime represents the most important stack level because provide to powered application leaving the approach near hardware to using a simple set of API described in Virtu alSense Libs that give access to all hardware functionality The high abstraction of VirtualSense runtime architecture provide to create multi threading applications that can run concurrently on a single node increasing the use cases of VirtualSense Because the apps running on Virtualsense are not on the firmware but in a higher level them can be removed updated or added by remote only sending some special package and commands on the network The hight performance and great versatility of VirtualSense not affect the power consumption thanks to hight optimization of VirtualSense runtime architecture that takes full advantage of the low power state of MSP430 microcontrollers VS UG 1 Environment Installation v1 0 9 University of Urbino amp NeuNet www virtualsense it 6 Install VirtualSense Development Kit 6 1 System Requirements On the development of VSDK VirtualSense Development Kit we tried to make it lightest as pos sible to be portable on any machines VSDK is tested on Linux OS that the follow requirements referring to Linux based environments Therefore the only requirements for use VSDK are e JDK Java Development Kit e Ant compiler e srecord package used for manipulating EPROM load files e Eclipse IDE Only if you want develop applica
47. uators available on Virtualsense motes are leds More precisely on Radio Layer Vir tualSense motes are equipped with 3 leds so actuator interfaces consists of once class named Led java that provide leds management 8 1 1 Leds The class Led java is a native interface that defines only the method setLed static final short LED1 static final short LED2 static final short LED3 native void setLed int led boolean state This class should not be instantiated but for control one led is simply import library actuators Leds and invoke Led setLed for change the state of every led import javax virtualsense actuators Leds For control the state of every led the class provide also 3 constant attributes one for each Led For example if you wont turn on led 2 you must use follow command Leds setLed Led LED2 true VS UG 1 Environment Installation v1 0 16 University of Urbino amp NeuNet www virtualsense it 8 2 Sensors Interfaces The sensors interface manage all device that interfaces VirtualSense with outside Precisely Virtu alSense has e set of Analog Digital Converter e brightness sensor e pressure sensor e temperature sensor For use one of them is sufficient import library Sensors with commana import javax virtualsense sensors and use a corresponding class 8 2 1 ADC The class that manages the set of analog to digital converters is ADC java static final Byte CHNL1 static final Byte CHNL2
48. user run virtualsense sense R cant running blink multi user target run gt b 9 runwirtualsense peopleCounter B darjeeling properties Han gata b runwirtualsense co2meter F macrodefs xml e target name run virtualsense storage depends tools apps gt 9 runvirtualsense testsuite library dir base dij taskdefs xml lt library dir dar make targets gt run virtualsense blink gt Eydoc library dir vir run virtualsense storage Gy examples MAA cvrvirvalsense vscaling gt gyplatform 3 2Ant Bu DebugAs gt gt run virtualsense hblink gt gytools Pee ee Profile As f D runwirtualsense energyBench B Makefile include eho O runwirtualsense Mblink README Mila c asc run virtualsense ctp library dir bas yen Javadoc Wizard Ey README BUILDING library dir dar bain pt gt gt File darjeeling properties from impc 3j README EXAMPLES lt library dir vir lil i amp 1 slibrary dire vi gt library from import macrodefs xml nativeinf Replace with y application from import macrodefs Verl 3 Run C C Code Analysis distro from import macrodefs xml a Es W HI Remove from Context Shift ctri Alt Down loe a E 03 Figure 9 Installation by JTAG compiling with ant builder on Eclipse e Team Synchronizing VirtualSense DJ VirtualMachine 1 0 darjeeling 1 1 build xml Eclipse Platform x File Edit Navigate Search Project Run Window
49. www virtualsense it 10 E a a 10 TII 10 ea Dhan ee o 10 E aa ch te A 10 T 12 13 15 peg ead alae o Bip agg 16 O E 16 ii a 17 E A a aia o Sou 17 ia amp rana o ee eo Be 19 EE abe de te A 19 ee a eee 20 Mp Gea awe Ba Rura eo 2S 21 eg rd Soon d ee ede oe UR and 23 Pup puro uH ees tata rt 25 26 TL 26 coa eee eee eS 27 mm 28 ee ee St 29 E ON 31 TI 34 39 University of Urbino amp NeuNet www virtualsense it 11 Install an application 42 11 1 Installation by JTAG serial interface aoaaa aaa a 42 11 2 Installation by Boot Strap Loader BSL eei a o e 46 VS UG 1 Environment Installation v1 0 3 University of Urbino amp NeuNet www virtualsense it List of Figures The functional block diagram ww nn 8 2 Hardware and software staks es 9 3 Import VSDK on Eclipse step ns 11 4 Import VSDK on Eclipse step2 we 11 5 VirualSense networking o o e ens 25 6 Create a new application folder ns 39 7 Create java file and build file n 39 8 Installation by JTAG file build xml on Eclipse ee 42 9 Installation by JTAG compiling with ant builder on Eclipse 44 10 Installation by JTAG compiling and installation on Eclipse done 44 11 Installation by JTAG app installed cutecom serial debug rss 45 12 Installation by BSL file build xml on Eclipse 0 o

Download Pdf Manuals

image

Related Search

Related Contents

page 5. Volt - GM Service Insights  ACCELGUARD® 90 - Euclid Chemical  ゲームレコーダー - Amazon S3  StyleView® SV42 Electronic Medical Records (EMR) Cart  GarrettCom Quad User's Manual  Philips DVP5980K/93 User's Manual  Holset HE341Ve - Cummins Turbo Technologies  Use and Care Manual  Velleman PIR416 motion detector  Software User Manual  

Copyright © All rights reserved.
Failed to retrieve file