Tessel is a Node-compatible microcontroller with WiFi built in. Tessel offers many modules with sensors attached to it, so you can log physical variables in the web. This tutorial provides the basic functions to push data from one variable to Ubidots, but it could be extended to support more modules and sensors. This tutorial teaches you how to read a noise variable from Tessel’s Ambient Module and send its value to Ubidots.



1.- The Tessel needs a few steps to be setup, you can find some instructions here

After installing tessel we need to setup our wifi network. Type the following command in your console (security can be ‘wpa’,'wep’, 'unsecured’):

 tessel wifi -n "ssid name here" -p "password" -s "security"

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

After connecting to your Wi-Fi network, follow the next three steps of Tessel’s tutorial to install the ambient module library

2.- Hardware Setup:

  • Connect the ambient module to Tessel’s Port A, making sure the hexagon faces down.
  • Make sure you Tessel is plugged to your computer through a micro-USB cable.

Send one value to Ubidots

In your computer, create a new file called “noiseLevel.js” and copy the following code. Don’t forget to replace the variables “X-Auth-Token” with your TOKEN and “id_sound” with the ID of the Ubidots variable you just created in your Ubidots account:

   var http = require('http');
   var tessel = require('tessel');
   var ambientlib = require('ambient-attx4');
   var ambient = ambientlib.use(tessel.port['A']);
   var req = null;
   var id_sound ='53fcde277625426ad675f96f';
   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': 'cfaI5R1bcr7wlwf58hAnNZNNvfSoUk',
                                 'Connection': 'keep-alive'
                           var options = {
                                 host: 'things.ubidots.com',
                                 port: 80,
                                 path: '/api/v1.6/variables/'+id_sound+'/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: 'Atom House Medellin'
           , password: 'atommed2014'
           , timeout: 30 // in seconds

Finally run noiseLevel.js:

tessel run noiseLevel.js

Now you should begin seeing the Noise level data in your Ubidots Account!

Did this answer your question?