Thursday, 29 October 2015

Setup Fusion Table as Database: Customize Your Table by Adding More Column to Store Data

To get more smartphones able to pushing sensor data to the same table, make sure to add more credential API KEY, different phone with different API KEY. 

Query that are use by the Fusion Table are 

INSERT INTO (TABLE ID)(,,...)VALUES(,,...)

The words in CAPS are part of the query's syntax. The words in parentheses are values that need to plug in. First there is a (column names) followed by VALUES followed by a list of (value names). The order of the column names and value must be in the same order so they match up. An example of what this might look like is shown below. Notice that the values must be enclosed in single quotes:

INSERT INTO 191GJakyqWHsan(Name,Date)VALUES('Sam','10/10/2012')

Gateway apps will push this query, and with the help of TABLE ID and API KEY. Those data will arrive to your table, and when arriving, a new ROW will be added to the existing column. Your columns name need to be similar between the name you assign at your query and table. To get that you need to.....

..... customize your table by:

  1. Give a name to your table, by click the current name "New Table" and change table name at it setting
  2. Add more or edit existing columns by going to Edit > Change Columns. You'll rename all the columns and select suitable data type for each of the column. 
  3. Since you using this SensorGate app. You need to add 4 extra columns at the end of your table. Column for Date, Time, Latitude and Longitude. If you don't do that, there will be an error and failure in pushing data to the cloud. So please add it. This is to make your life easy as you know exactly where and when those data are collected and generate. 


Setup Fusion Table as Database: Table ID

To get Fusion Table ID, is by browsing to your table, then select the File > About this table in the menu.

Tuesday, 27 October 2015

Setup Fusion Table as Database: Getting an API Key

For the SensorGate app to work and able to push connected sensor data to your Fusion Table it require 2 things; API KEY and TABLE ID.

First is to get an API key, follow these instructions:
  1. Go to your Google Developers Console and log in with your Google account if necessary.
  2. Click Create Project, and give a name to your project. 
  3. On the left-hand menu, under APIs & auth select the APIs item.
  4. In the list of APIs, scroll down to find the Fusion Tables API and click the toggle button "Enable API" (if it already says "Disable API" and its color is not blue then leave it as is, because API is already enable.)
  5. On the menu on the left of the screen select the Credentials item under "APIs & auth".
  6. Click "Add Credential" and select API key > Android key > Create > OK
  7. Your API key will show up under "Public API Access". You will need this API key for the "API Key" property of the FusiontablesControl component in any app that you make that uses Fusion Tables. (More info on the future post)
  8. If you are using difference or more than one smartphone as a gateway to push data to the same Fusion Table please feel free to add more API keys, to be used at each phone. 

Monday, 26 October 2015

Setup Fusion Table as Database: Creating Your Own Fusion Table

Creating your own Fusion Tables is as easy as creating a Google document in Google Drive, if you are familiar with that process. 
1. On the web, login to Google Drive account or any Google service (e.g., Gmail, Youtube).  
2. Select the New >  More > Connect More Apps menu, on the pop-up page go to the search apps box and type Fusion Table, click connect > OK




3. Again select the New > More > Google Fusion Table, it will open a new tab with show three selection to create Fusion Table, you can explore each of the method later and as for now click Create empty table, another tab open "New Table". 

4. You will see that the new table automatically comes with four columns. Change the column names by going to Edit > Change columns.Based upon the application that you want to create, it can be a table of sensor reading or a table of food order. Make sure their is no space at the name of the column, as well as the type of the data that will be stored. 
5. Click on the Share button (top right) to modify the table;s permissions. For this tutorial, you can specify a few friends who will use the app. Only people who are explicitly given permission will be able to push content into your table. 
NOTE about Sharing Fusion Tables: To share a FusionTable with others, you must share it with each person individually, you can share with a Google Group, or you may share it with a service account the same way you would share a private Google Doc.  There is no way to share write privileges to a FusionTable with the public. Public access is restricted to read-only. Please see the Setting up a Service Account section at the bottom of the page for how to set up a service account to authenticate all end-user access to your Fusion Table.
6. Make sure your android phone account that will be used as a gateway is added, as the list of account that can upload content into your table. 

Setup Fusion Table as Database

A Fusion Table is a Google service to support the gathering, managing, sharing, and visualizing of data. Data are stored in multiple tables on Google's cloud. Individual tables can be merged (or fused) if they contain a common column, and they can be easily visualized on maps and in various kinds of charts and graphs. 

This setup is to create a Fusion Table in Google Drive, and to get the 2 components required by the SensorGate apps that will be used at the next step on "Setup Smartphone as Gateway", which are API KEY, and TABLE ID.


Introduction

This blog is build in conjunction with the research paper on "Repurposing Smartphone as a Gateway for Wireless Sensor Node" that is published at the ACCS 2015 Conference.

This blog is regarding on the setup needed to develop a ready-to-play wireless sensor node with the capability to push their data to the cloud storage via smartphone as a gateway. This method is using Fusion Table from Google company as a storage location to store WSN data, safely and securely in the user Google Drive.  

This setup is divided into 4 parts; which are:

        1. Setup Fusion Table as Database.
        2. Setup Wireless Sensor Node with Bluetooth Connectivity
        3. Establish Connection between Sensor Node and Smartphone
        4. Start pushing data


This whole system is made up for a non-technical people to learn about a method to save their distributed sensor data to the cloud storage using the most simplest method that I know.

The First Step is to download SensorGate apps and install it.


SensorGate

Then you need to create your table, and setup your wireless sensor node with Bluetooth connectivity.