Pubnub demo for AT&T IoT Starter Kit. Functionally similar to the Flow demo.

Dependencies:   FXOS8700CQ MODSERIAL mbed

http://pubnub.github.io/slides/workshop/pictures/broadcast.png

Pubnub demo for AT&T IoT Starter Kit

This demo is functionally similar to the Flow demo, so you can find general information here: https://developer.mbed.org/users/JMF/code/Avnet_ATT_Cellular_IOT/.

The only difference is that we use Pubnub to publish the measurements and subscribe to receiving the instructions to set the LED.

Settings

Pubnub related settings are:

Pubnub settings in `config_me.h`

PUBNUB_SUBSCRIBE_KEY
PUBNUB_PUBLISH_KEY
PUBNUB_CHANNEL

All are documented in their respective comments.

Pubnub context class

Similar to Pubnub SDKs, we provide a Pubnub context class. It is defined in pubnub.h header file and implemented in pubnub.cpp.

It provides only the fundamental "publish" and "subscribe" methods. They are documented in the header file.

This class is reusable in other code (it is not specific to this demo), it has a very narrow interface to the AT&T IoT cellular modem code. For example of use, you can look at the main() (in main.c).

Sample of published data

Published message w/measurement data

{"serial":"vstarterkit001","temp":89.61,"humidity":35,"accelX":0.97,"accelY":0.013,"accelZ":-0.038}

Don't worry, nobody got burnt, the temperature is in degrees Fahrenheit. :)

Publish a message (from, say, the Pubnub console http://pubnub.com/console) of the form {"LED":<name-of-the-color>} on the channel that this demo listens to (default is hello_world) to turn the LED to that color on the Starter Kit:

Turn LED to red

{"LED":"Red"}

Turn LED to green

{"LED":"Green"}

Turn LED to blue

{"LED":"Blue"}

History

First version that works, forked from official AT&T IoT starter kit repository. default tip

2016-09-02, by sveljko [Fri, 02 Sep 2016 17:44:55 +0000] rev 81

First version that works, forked from official AT&T IoT starter kit repository.


If WNC returns more than 1 IP address, fixed control software to pick just 1 of them instread of all of them. Found a pc.printf replaced with PRINTF.

2016-08-16, by fkellermavnet [Tue, 16 Aug 2016 13:55:59 +0000] rev 80

If WNC returns more than 1 IP address, fixed control software to pick just 1 of them instread of all of them. Found a pc.printf replaced with PRINTF.


Been timing the URL resolve, it can take a long time sometime for the WNC to reply back with an IP or sometimes an error.; ; I increased the timeout for the dns resolve from 15 to 60 seconds. This is one more step toward better.

2016-08-15, by fkellermavnet [Mon, 15 Aug 2016 22:40:14 +0000] rev 79

Been timing the URL resolve, it can take a long time sometime for the WNC to reply back with an IP or sometimes an error.; ; I increased the timeout for the dns resolve from 15 to 60 seconds. This is one more step toward better.


Fixed 2 minor things: 1 more missing .c_str() from cell_modem.cpp and a missing \r\n from some debug output.

2016-08-15, by fkellermavnet [Mon, 15 Aug 2016 21:46:21 +0000] rev 78

Fixed 2 minor things: 1 more missing .c_str() from cell_modem.cpp and a missing \r\n from some debug output.


Fixed some missing \r.; Added report of app version.; Added report of WNC firmware version.;

2016-08-15, by fkellermavnet [Mon, 15 Aug 2016 19:31:14 +0000] rev 77

Fixed some missing \r.; Added report of app version.; Added report of WNC firmware version.;


No change.

2016-08-13, by fkellermavnet [Sat, 13 Aug 2016 18:29:56 +0000] rev 76

No change.


Re-merged in Stefan's branch with Eaddy branch.

2016-08-13, by fkellermavnet [Sat, 13 Aug 2016 17:46:30 +0000] rev 75

Re-merged in Stefan's branch with Eaddy branch.


Merged in latest code from Eaddy. This adds in more checks if the socket disconnects and attempts to reconnect it and also to search for the +CME error condition.

2016-08-13, by fkellermavnet [Sat, 13 Aug 2016 15:08:11 +0000] rev 74

Merged in latest code from Eaddy. This adds in more checks if the socket disconnects and attempts to reconnect it and also to search for the +CME error condition.


Merged in WNC suggestions for: Check for EXTERR and close and reopen the socket if it occurs. If sockopen fails send command to close the socket. Don't use find() on empty strings.

2016-08-12, by fkellermavnet [Fri, 12 Aug 2016 19:47:29 +0000] rev 73

Merged in WNC suggestions for: Check for EXTERR and close and reopen the socket if it occurs. If sockopen fails send command to close the socket. Don't use find() on empty strings.


Add 4s startup delay and changed GPS_valid to number of satellites.

2016-08-11, by stefanrousseau [Thu, 11 Aug 2016 21:14:32 +0000] rev 72

Add 4s startup delay and changed GPS_valid to number of satellites.