Tessel is a Node-compatible microcontroller with WiFi built in. Tessel offers many modules with sensors attached to give you the knowledge you need from the physical world. 

Following this guide you will be able to POST data to Ubidots using Tessel Board in just a couple of minutes!



  1. Setting up Hardware

  2. Sending (POST) Data to Ubidots

  3. Summary

1. Setting up Hardware

1. To start working with the Tessel board you will need to install the Tessel Command Line. Based on your computers operating system (OS) the links below will allow you to download the correct command line:

2. After installing the Tessel Command Line, connect the board to the computer and begin the WiFi Network setup. To setup the network enter and execute the command below with the correct parameters of your WiFi network in your computers terminal:

 tessel wifi -n "ssid_name_here" -p "password_here" -s "security_here"

Where "security" can be ‘wpa’,'wep’, 'unsecured

IMPORTANT NOTE: Tessel can only connect to 802.11b/g networks. Make sure your router has b/g mode enabled.

2. Sending (POST) Data to Ubidots

1. Let’s create a js script using your favorite text-editor. We’ll use “nano” given its popularity and simplicity. 

nano send_values.js

2. Then, copy and paste the below code in the text editor. Once you've pasted the code, you will need to assign the following parameters:

  • Your Ubidots TOKEN as X-Auth-Token

  • The Variable ID of the variables you will be updating in Ubidots. If you do not have the variable IDs, simply create a shell variables and then update your firmware to contain the correct Variable IDs. To locate the variable IDs, simply click here. 

  • SSID and Password of the WiFi network will be connecting to. 

   var http = require('http');
   var tessel = require('tessel');
   var ambientlib = require('ambient-attx4');
   var ambient = ambientlib.use(tessel.port['A']);
   var req = null;
   var variable_id ='xxxxxxxxxx';
   var sound = {
             value: 0.00000000
   var wifi = require('wifi-cc3000');

   function ubidots(){
       ambient.on('ready', function () {    
           setInterval( function () {
               ambient.getSoundLevel( function(err, sdata) {

                           var valueString = JSON.stringify(sound);
                           var headers = {
                                 'Content-Type': 'application/json',
                                 'Content-Length': valueString.length,
                                 'X-Auth-Token': 'xxxxxxxxxxxxxxxxxxxxxx',
                                 'Connection': 'keep-alive'
                           var options = {
                                 host: 'industrial.api.ubidots.com',
                                 port: 80,
                                 path: '/api/v1.6/variables/'+ variable_id +'/values', //Variable Id
                                 method: 'POST',
                                 headers: headers

                           req = http.request(options, function(res) {
                                   var responseString = '';
                                   res.on('data', function(data) {
                                     responseString += data;
                                   res.on('end', function() {
                                     console.log("Sending value to ubidots");
                                     var resultObject = JSON.parse(responseString);
                                   req.on('error', function(e) {
                                     console.log('problem with request: ' + e.message);
                           var dbs= parseFloat(sdata.toFixed(8), 10);// it divide by 20^10-6 or or multiplied by 50000
                           dbs = 20*Math.log10(dbs*50000);
                           console.log("Sound Level:",sdata.toFixed(8));
                           sound.value = dbs;

   wifi.on('disconnect', function(err, data){
                     if (!wifi.isBusy()) {
                       }else {
                         console.log("is busy, trying again");
                   console.log("disconnect emitted", err, data);

   function connect(){
           security: 'wpa2'//or wpa,unsecured,wep
           , ssid: 'xxxxxx'
           , password: 'xxxxxx'
           , timeout: 30 // in seconds

3. Then, save the changes and execute the send_values.js  script in your computers terminal by running the command below:

tessel run send_values.js

Now you should begin seeing the variable assigned updating data in your Ubidots Account!

3. Summary

With this simple tutorial you are able to POST data to Ubidots with the ease of the Tessel board.

Now its time to create Ubidots Dashboards to visualize your data and deploy your IoT solution!  :) 

Other readers have also found useful...

Did this answer your question?