Sampl-sensor-andrew

Version 10 (Anthony Rowe, 08/11/2009 10:18 pm)

1 1 Anthony Rowe
2 1 Anthony Rowe
== SAMPL Sensor Andrew ==
3 9 Anthony Rowe
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.  
4 9 Anthony Rowe
5 9 Anthony Rowe
To compile SAMPL with Sensor Andrew support, you must include the SOX (Sensor Over XMPP) library.  This can be found here:
6 1 Anthony Rowe
svn checkout svn://sensor.andrew.cmu.edu:/srv/svn/repos/sensor-andrew
7 1 Anthony Rowe
8 1 Anthony Rowe
'''Step 1: Install Loudmouth'''
9 5 Anthony Rowe
 * Install: glib2, expat, gnutls 
10 1 Anthony Rowe
{{{
11 1 Anthony Rowe
   cd sensor-andrew/sox/libs/loudmouth
12 1 Anthony Rowe
    ./configure
13 1 Anthony Rowe
    make
14 1 Anthony Rowe
    sudo make install
15 1 Anthony Rowe
}}}
16 1 Anthony Rowe
17 1 Anthony Rowe
18 1 Anthony Rowe
'''Step 2: Install C Sox Library'''
19 1 Anthony Rowe
 * Double check the path of GLIB, GNUTLS, LOUDMOUTH etc in vars.mk
20 1 Anthony Rowe
  * This may work fine with the default values
21 1 Anthony Rowe
{{{
22 1 Anthony Rowe
    cd sensor-andrew/sox/libs/lib_c
23 1 Anthony Rowe
    make
24 1 Anthony Rowe
    sudo make install
25 1 Anthony Rowe
}}}
26 1 Anthony Rowe
27 1 Anthony Rowe
28 1 Anthony Rowe
'''Step 3: Build FireFly sox-gateway'''
29 1 Anthony Rowe
 * 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
30 1 Anthony Rowe
 * edit makefile to correctly set XMPP_LIBRARY_PATH to sox/libs/lib_c
31 1 Anthony Rowe
{{{
32 1 Anthony Rowe
    cd nano-RK/projects/SAMPL/slip-clients/sox-gateway
33 1 Anthony Rowe
    make
34 1 Anthony Rowe
}}}
35 1 Anthony Rowe
36 1 Anthony Rowe
37 4 Anthony Rowe
'''Step 4: Flash FireFly nodes'''
38 2 Anthony Rowe
 * First Program the nodes
39 2 Anthony Rowe
{{{
40 1 Anthony Rowe
    cd nano-RK/projects/SAMPL/clients/FF-basic-sensors
41 1 Anthony Rowe
    make clean
42 1 Anthony Rowe
    make program
43 2 Anthony Rowe
}}}
44 2 Anthony Rowe
 * You will see a red blinking led and the following messages from the serial port:
45 2 Anthony Rowe
{{{
46 2 Anthony Rowe
* ERROR reading MAC address from EEPROM run eeprom-config utility
47 2 Anthony Rowe
* ERROR reading MAC address from EEPROM run eeprom-config utility
48 2 Anthony Rowe
* ERROR reading MAC address from EEPROM run eeprom-config utility
49 2 Anthony Rowe
}}}
50 2 Anthony Rowe
 * Next, set the EEPROM values
51 2 Anthony Rowe
  * MAC Address
52 2 Anthony Rowe
  * Subnet MAC
53 2 Anthony Rowe
  * Encryption Key (optional)
54 2 Anthony Rowe
  * Wireless Update image file (optional)
55 2 Anthony Rowe
 * Note the following with respect to the MAC address:
56 2 Anthony Rowe
  * The first six hex digits in the MAC address denote the subnet 
57 2 Anthony Rowe
  * All nodes must be part of the same subnet to communicate
58 2 Anthony Rowe
  * The gateway node must be set to 0 inside a subnet
59 2 Anthony Rowe
  * No other node besides the gateway can be 0
60 3 Anthony Rowe
 * Use the config-eeprom tool to set the EEPROM
61 2 Anthony Rowe
{{{
62 3 Anthony Rowe
cd nano-RK/tools/EEPROM_mac_set
63 3 Anthony Rowe
make (if not already built)
64 3 Anthony Rowe
./config-eeprom /dev/ttyUSB1 00000001 26 00112233445566778899AABBCCDDEEFF
65 1 Anthony Rowe
}}}
66 1 Anthony Rowe
67 4 Anthony Rowe
'''Step 5: Flash FireFly gateway'''
68 3 Anthony Rowe
 * Flash the gateway node that will be connected to the gateway computer
69 1 Anthony Rowe
{{{
70 1 Anthony Rowe
cd nano-RK/projects/SAMPL/gateway
71 1 Anthony Rowe
make clean
72 1 Anthony Rowe
make program
73 3 Anthony Rowe
}}}
74 3 Anthony Rowe
 * Set the EEPROM like any other FireFly client except with the last two hex digits being '00'
75 5 Anthony Rowe
{{{
76 5 Anthony Rowe
cd nano-RK/tools/EEPROM_mac_set
77 5 Anthony Rowe
./config-eeprom /dev/ttyUSB1 00000000 26 00112233445566778899AABBCCDDEEFF
78 5 Anthony Rowe
}}}
79 2 Anthony Rowe
80 6 Anthony Rowe
'''Step 6: Run the SLIPstream Server'''
81 6 Anthony Rowe
 * The SLIPstream server forwards messages from the gateway_client to and from the gateway firefly node
82 6 Anthony Rowe
 * Connect the gateway node and run the server as follows
83 6 Anthony Rowe
{{{
84 6 Anthony Rowe
cd /nano-RK/tools/SLIPstream/SLIPstream-server
85 6 Anthony Rowe
make
86 6 Anthony Rowe
./SLIPstream /dev/ttyUSB0 5000 
87 6 Anthony Rowe
}}}
88 6 Anthony Rowe
 * Reset the gateway node and you should see something similar to the following on the SLIPstream server
89 6 Anthony Rowe
{{{
90 6 Anthony Rowe
Netmask = 0x0 0 0
91 6 Anthony Rowe
MAC = 0x0
92 6 Anthony Rowe
Channel = 26
93 6 Anthony Rowe
slip_init()
94 6 Anthony Rowe
bmac_started()
95 6 Anthony Rowe
Waiting for SLIP data...
96 6 Anthony Rowe
}}}
97 6 Anthony Rowe
98 6 Anthony Rowe
'''Step 7: Run the sox-gateway'''
99 6 Anthony Rowe
 * The sox-gateway will handle requests to the sensor network and arbitrate communication with sensor andrew
100 6 Anthony Rowe
 * Edit the following files in "configs" directory before starting
101 6 Anthony Rowe
  * pkt-script.xml
102 6 Anthony Rowe
   * This is an XML file describing the default operation of the network.  Sensor polling times and scripts can be configured here.
103 6 Anthony Rowe
  * ff_basic_sensor_cal.txt
104 6 Anthony Rowe
   * This file contains sensor calibration information for each FireFly environmental node in the subnet
105 6 Anthony Rowe
  * jiga_watt_cal.txt
106 6 Anthony Rowe
   * This file contains JigaWatt calibration information for each JigaWatt FireFly sensor board
107 6 Anthony Rowe
  * xmpp-config.txt
108 6 Anthony Rowe
   * 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.
109 6 Anthony Rowe
  * registry.txt
110 10 Anthony Rowe
   * 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.
111 6 Anthony Rowe
  * subscribe-nodes.txt
112 6 Anthony Rowe
   * 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.
113 6 Anthony Rowe
 * To test the new subnet, run the gateway_client without connecting to Sensor Andrew follows
114 6 Anthony Rowe
{{{
115 6 Anthony Rowe
cd nano-RK/projects/SAMPL/slip-clients/sox-gateway
116 6 Anthony Rowe
./gateway_client localhost 5000 -verbose -no_xmpp
117 6 Anthony Rowe
}}}
118 7 Anthony Rowe
 * After running the gateway, you should see data coming back from each node.
119 7 Anthony Rowe
 * Now try running the node so that it publishes this data to Sensor Andrew.  This requires that you configure the XMPP specific files
120 6 Anthony Rowe
{{{
121 6 Anthony Rowe
./gateway_client localhost 5000 -slipstream_mirror 5001 localhost
122 6 Anthony Rowe
}}}
123 6 Anthony Rowe
124 6 Anthony Rowe
125 2 Anthony Rowe