Sending WiSense sensor node data to the cloud (ThingSpeak.com)
This week we sent data from bunch of WiSense sensor nodes to the thingSpeak cloud platform. The wireless sensor nodes were registered to a WiSense network coordinator (WSN1120CL) which in turn was connected to a Windows laptop running our gateway application (a C program running under Cygwin).
“ThingSpeak” is an IOT analytics platform that allows the collection,storage, visualization and analysis of sensor data in the cloud. You can create a free “ThingSpeak” account which limits the per channel data streaming (upload) rate of once every 15 seconds.
The WiSense gateway app (which can be run a Linux system or under Cygwin on a Windows machine) sends data to the “Thingspeak” platform when run with the “mon_ts” command line argument instead of the usual “mon” command.
prompt> ./gw.exe / dev/ttyS9 mon_ts
Note that each WiSense sensor node is permanently identified by it’s 64 bit extended address which looks like “0xfc:0xc2:0x3d:0x00:0x00:0x1e:0xd0:0x40”. This is an IEEE assigned globally unique id.
We decided to create a separate “ThingSpeak” channel for each WiSense sensor node.
“Channels store all the data that a ThingSpeak application collects. Each channel includes eight fields that can hold any type of data, plus three fields for location data and one for status data. Once you collect data in a channel, you can use “ThingSpeak” apps to analyze and visualize it.”
Each “Thingspeak” channel can have up to 8 sensor data fields. We map each sensor (on a WiSense sensor node) to a separate field. A free “Thingspeak” account accepts channel data once every 15 seconds only.
We use a text file named “ts.txt” to associate a WiSense sensor output (each having a unique 8 byte extended address) to its corresponding field in a “Thingspeak” channel. The WiSense gateway app reads and parses the “ts.txt” file when run with the “mon_ts” argument. When this app receives sensor data from any sensor node in the attached WiSense LPMWN (low power wireless mesh network), it looks up this table for a matching row and if found, sends the sensor data to the ThingSpeak cloud using the HTTP “POST” method specifying the channel API key and field.
The mapping table below is the actual “ts.txt” used in our setup.
<$< fc:c2:3d:00:00:00:db:40 NCT4JOQR1ZI5DEHB 013 field1 >$>
<$< fc:c2:3d:00:00:02:b9:9b 4WZBK65FZNTO6JWS 013 field1 >$>
<$< fc:c2:3d:00:00:10:82:97 XXTNNZSMAZQKMIL5 009 field1 >$>
<$< fc:c2:3d:00:00:11:1a:ea ZBT7N4IKJKCND80L 120 field1 >$>
<$< fc:c2:3d:00:00:11:1a:ea ZBT7N4IKJKCND80L 009 field2 >$>
<$< fc:c2:3d:00:00:11:1a:ea ZBT7N4IKJKCND80L 176 field3 >$>
<$< fc:c2:3d:00:00:11:1a:ea ZBT7N4IKJKCND80L 177 field4 >$>
For each unique sensor data stream produced by a WiSense sensor node, there is one row in the mapping table.
- The first column is the 8 byte IEEE assigned globally unique address of a WiSense sensor node.
- The second column is the Write API Key of the associated “ThingSpeak” channel. Note that one “ThingSpeak” channel needs to be created per WiSense sensor node.
- The third column is the 1 byte device-id of the Sensor output (example – ambient temperature) sent by the WiSense node. Note that if a single sensor has multiple outputs (such as both temperature and relative humidity), then each output will be assigned a separate device id.
- The fourth column indicates the channel field assigned to this particular sensor output.
The mapping table shows four different Write API Keys each corresponding to a unique “ThingSpeak” channel. The last four rows have the same Write API Key and correspond to the 4 different sensor outputs received from the associated WiSense sensor node. Note that each of these four rows has a unique field column.
In the table above, the different sensor output ids are –
- 013 : NTC thermistor data (NXFT15XH103 from Murata).
- 009: LM75B temperature data (NXP)
- 120: MSP430 On chip supply voltage data (TI)
- 176: RH data from a CC2D33S sensor (Amphenol advanced sensors)
- 177: Temperature data from a CC2D33S sensor (Amphenol advanced sensors)
Here is a snapshot of the sensor data visualized by ThingSpeak for one of the sensor nodes with four sensor outputs (the last four rows in the mapping table at the top).
Here’s a pic of the setup showing a windows laptop running the WiSense gateway app under Cygwin, a WiSense coordinator node connected to the laptop and a WiSense sensor node generating 4 sensor output streams corresponding to the last 4 rows in the mapping table shown above. The laptop is sending data to the ThingSpeak cloud over a WiFi/broadband connection.
For more information on our products, please visit wisense.in.