Sampl-sensor-andrew

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

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