• Tessel + Keen.io

    Thursday, October 16, 2014

    10/16/2014 – Jia Huang

    Keen.io is a cloud analytics platform that’s extremely easy to use. It gives an endpoint to hit and logs all data sent to that endpoint as part of an event stream.

    We’re excited to finally get it working with Tessel. In the early Tessel firmware/runtime releases we had bugs on our runtime (specifically about zlib decoding/encoding) that prevented their library from working properly.

    Those bugs have since been fixed and working with Keen has been a breeze!

    In order to use Tessel with Keen first create an account.

    Then go on to the projects page and find the project ID & API keys

    Keen has an NPM library that takes in these keys. In order to configure Keen:

    var Keen = require('keen.io');
    var keen = Keen.configure({
        projectId: "####", // swap these out with your own keys
        writeKey: "####",
        readKey: "####"

    As a test script I’ve sent over some data from the Accelerometer up to Keen. This script sets up the Accelerometer on port A of Tessel and sends data up to Keen every second:

    var Keen = require('keen.io');
    var tessel = require('tessel');
    // attach the accelerometer to port A
    var accel = require('accel-mma84').use(tessel.port['A']);
    var count = 0;
    console.log("setting up keen...");
    var keen = Keen.configure({
        projectId: "####", // swap these out with your own keys
        writeKey: "####",
        readKey: "####"
    var dataArray = [];
    accel.on('ready', function () {
      console.log("Accelerometer is ready!");
      // as we get data push it into an array
      accel.on('data', function (xyz) {
    // every second send up all the accelerometer data
    setTimeout(function sendData(){
      keen.addEvent("accel", {data: dataArray}, function(err){
        if (err) throw err;
        console.log("Added event #"+count, "data: ", dataArray);
        dataArray = [];
        setTimeout(sendData, 1000);
    }, 1000);

    Before running this make sure Tessel is connected to the internet:

    tessel wifi -n <your_network_ssid> -p <your_network_pw> -s <wpa2|wep>

    The security (-s) flag defaults to wpa2.

    If the network is unsecure, the password and security flags can be omitted:

    tessel wifi -n <your_network_ssid>

    Tessel should go through the wifi connection process and the yellow LED should be lit after it successfully connects to the internet.

    After connecting Tessel to wifi, just do a tessel run index.js to run the test script

    And we can see the data as it gets pushed to Keen along with a timestamp.

    The full code is here: https://github.com/jiahuang/tessel-keen

    Let us know what you do with Tessel + Keen!

    See Keen’s blog on our integration here

    #jia huang #tessel #keen #keenio #technical machine #integration #cloud #analytics

August 2018

January 2018

July 2017

February 2017

November 2016

October 2016

September 2016

August 2016

July 2016

June 2016

April 2016

March 2016

February 2016

November 2015

September 2015

August 2015

July 2015

June 2015

May 2015

March 2015

February 2015

January 2015

December 2014

November 2014

October 2014

September 2014

August 2014

July 2014

June 2014

May 2014

April 2014

March 2014

February 2014

January 2014

December 2013

November 2013

October 2013

September 2013

August 2013

July 2013