Week 11 & 12 Sprint 5 (10/12 - 23/12) - Putting Stuff Together

1.Product

  • Setup PubNub 
  • Send data from device to cloud

 

2.Process

Setup PubNub

I've created a PubNub account in the first week of the sprint. In PubNub, I create a new module for the API key set to log JSON data that was published from my device to the database and create an OnAfter event handler on the related channel. Before creating the module, I need to have my channel and keys setup to make the device able to publish JSON data to the channel in PubNub.

keys.jpg

figure 1. Keys

pubnub_function.jpg

figure 2. Module to log JSON data to the database

 

Publish data from device to PubNub

The API structure to publish data to the PubNub channel is as following:

arduinoHTTPGETREQUEST.jpg.2

After gathering all the data needed I convert them into a series of Strings call dataInput. Besides, for dataInput I need to convert the JSON data into URL-encoded JSON to be able to publish it to the channel in PubNub.