/ iot

Initial State as fast UI

At sometimes you just need to view your data and analyze if it's up and running as programmed by your code. For those who just doesn't want to worry about web server, real time or some complex setup to stream data into Internet, I highly recommend to study a little about Initial State platform.

Initial State and how it works

Stream data from your devices and applications to beautiful visualizations in your web browser

As the phrase above promises, it is not hard to streaming data to initial state, the platform offers a lot of ways to connect and share information. In the integration page you could see a lot of ways to create an instance and integrate to your environment, in the core of the platform, I imagine that all converts to a RESTfull API where the user connects and streaming data, my guess is based on the parser error lib in node.js that is based on HTTP fragmentation return messages .

The way the data flows from the sensor to the Internet is very simple, basic you need to parse the information of your sensor and use one of the connectors below (js, python, C....) to stream to initial state. I'm used to work with node.js nowadays then I'll make a simple example to you start with this in just five minutes, but if you're a more enthusiastic hobbyist, I recommend you to visit this to make something more complex or interconnected.

5 minutes example

Initial State uses an abstraction concept called "bucket" where all information is concentrated in the name of the bucket that you've created in your streamer code (let's call this way that's better). The initial step to use IS is to create an free account, after created go to upper left menu where is your e-mail registered, click on this and select my account, after click on +Create A new key as above:

This key is the bind to your streamer code and your account, does not share with anyone unless you want your friend share data into your account. Just to inform, today (12/06/17) Initial State limits a free account to 25.000 messages by month and one-time per second requisition in the platform independently the number of buckets (yes, you can have many) that're using. Following, clone the example code and paste you key created before in the local "YOUR_ACCESS_KEY_GOES_HERE" in the code.

git clone https://github.com/aignacio/5_minInitialState example-is
cd example-is
npm install
sudo nano example.js #edit the bind key
node example.js

Open your Initial State account and see the magic, the two pseudo-sensors are streaming data in the web. Focus on the name of the bucket "Dark Side example" and the name of the two sensors (Sensor A and B), if you read the code, is the correspondent name. I put the times 2 and 3,5 seconds to send data to the IS because as node runs both at the "same" time, maybe the API (npm initial-state) could present some error HTTP 429 because the limit of one-message per second.
The code is very simple like a promisse and you must have all working as expected. Click with the right button in some data to configure the tile in the different ways offered by the platform and have fun with this.

'use strict';
let libIS = require('initial-state');
let bucket = libIS.bucket('Dark Side example', 'ibnJuQMFPlKjCxOmIep82kLhMlCO2kld');
let sensorA = true,
    sensorB = 1;

setInterval(function() {
  bucket.push('Sensor A - Temperature of the bacon', !sensorA);
}, 2000);

setInterval(function() {
  sensorB = sensorB+1;
  bucket.push('Sensor B - Voltage of the ESD', sensorB);
}, 3500);

To see an application with this for real, I'm using Initial State with my 6LoWPAN sensors that monitors a temperature in a collect of clean rooms for manufacture of semiconductors. It works very good and gives me a much less pain to construct an simple UI for my client.

*Just for warn, another limitation of free account is the retentive of 1-day of the data in the IS.

Initial State as fast UI
Share this

Subscribe to @aignacio's