SAMPL Sensor Andrew

Before you begin, make sure that you have a Sensor Andrew JID and password that the gateway client can login as and use to run the subnet. Make sure that the subnet part of the MAC addresses you are using are unique. The gateway JID will automatically create event nodes if they don't already exist and publish data to them. If these nodes already exist, make sure that the gateway JID has publish permissions for them. In order for Sensor Andrew to log data, you must obtain a unique registry ID from the Sensor Andrew database registry.

To compile SAMPL with Sensor Andrew support, you must include the SOX (Sensor Over XMPP) library. This can be found here:
svn checkout svn://sensor.andrew.cmu.edu:/srv/svn/repos/sensor-andrew

Step 1: Install Loudmouth
  • Install: glib2, expat, gnutls
       cd sensor-andrew/sox/libs/loudmouth
        ./configure
        make
        sudo make install
    
Step 2: Install C Sox Library
  • Double check the path of GLIB, GNUTLS, LOUDMOUTH etc in vars.mk
    • This may work fine with the default values
          cd sensor-andrew/sox/libs/lib_c
          make
          sudo make install
      
Step 3: Build FireFly sox-gateway
  • In this step build "gateway_client" which will be used to communicate to the SLIPstream server and then in turn to the FireFly gateway node
  • edit makefile to correctly set XMPP_LIBRARY_PATH to sox/libs/lib_c
        cd nano-RK/projects/SAMPL/slip-clients/sox-gateway
        make
    
Step 4: Flash FireFly nodes
  • First Program the nodes
        cd nano-RK/projects/SAMPL/clients/FF-basic-sensors
        make clean
        make program
    
  • You will see a red blinking led and the following messages from the serial port:
    * ERROR reading MAC address from EEPROM run eeprom-config utility
    * ERROR reading MAC address from EEPROM run eeprom-config utility
    * ERROR reading MAC address from EEPROM run eeprom-config utility
    
  • Next, set the EEPROM values
    • MAC Address
    • Subnet MAC
    • Encryption Key (optional)
    • Wireless Update image file (optional)
  • Note the following with respect to the MAC address:
    • The first six hex digits in the MAC address denote the subnet
    • All nodes must be part of the same subnet to communicate
    • The gateway node must be set to 0 inside a subnet
    • No other node besides the gateway can be 0
  • Use the config-eeprom tool to set the EEPROM
    cd nano-RK/tools/EEPROM_mac_set
    make (if not already built)
    ./config-eeprom /dev/ttyUSB1 00000001 26 00112233445566778899AABBCCDDEEFF
    
Step 5: Flash FireFly gateway
  • Flash the gateway node that will be connected to the gateway computer
    cd nano-RK/projects/SAMPL/gateway
    make clean
    make program
    
  • Set the EEPROM like any other FireFly client except with the last two hex digits being '00'
    cd nano-RK/tools/EEPROM_mac_set
    ./config-eeprom /dev/ttyUSB1 00000000 26 00112233445566778899AABBCCDDEEFF
    
Step 6: Run the SLIPstream Server
  • The SLIPstream server forwards messages from the gateway_client to and from the gateway firefly node
  • Connect the gateway node and run the server as follows
    cd /nano-RK/tools/SLIPstream/SLIPstream-server
    make
    ./SLIPstream /dev/ttyUSB0 5000 
    
  • Reset the gateway node and you should see something similar to the following on the SLIPstream server
    Netmask = 0x0 0 0
    MAC = 0x0
    Channel = 26
    slip_init()
    bmac_started()
    Waiting for SLIP data...
    
Step 7: Run the sox-gateway
  • The sox-gateway will handle requests to the sensor network and arbitrate communication with sensor andrew
  • Edit the following files in "configs" directory before starting
    • pkt-script.xml
      • This is an XML file describing the default operation of the network. Sensor polling times and scripts can be configured here.
    • ff_basic_sensor_cal.txt
      • This file contains sensor calibration information for each FireFly environmental node in the subnet
    • jiga_watt_cal.txt
      • This file contains JigaWatt calibration information for each JigaWatt FireFly sensor board
    • xmpp-config.txt
      • This file contains the XMPP configuration used to set the gateway's Sensor Andrew JID and password. This is not required unless XMPP support is enabled.
    • registry.txt
      • This file contains the Sensor Andrew registry ID values that should be sent with each XMPP message for database logging. This is not required unless XMPP support is enabled. This is only required for XMPP support.
    • subscribe-nodes.txt
      • This file should contain the event-nodes of any devices that require external actuation. The gateway will subscribe to these nodes so that it receives any incoming actuation commands or configuration messages.
  • To test the new subnet, run the gateway_client without connecting to Sensor Andrew follows
    cd nano-RK/projects/SAMPL/slip-clients/sox-gateway
    ./gateway_client localhost 5000 -verbose -no_xmpp
    
  • After running the gateway, you should see data coming back from each node.
  • Now try running the node so that it publishes this data to Sensor Andrew. This requires that you configure the XMPP specific files
    ./gateway_client localhost 5000 -slipstream_mirror 5001 localhost