Creating CSV file for Ruvvi data using Espruino

Posted on
  • I just wanted to know if it is possible to log data from RuvviTag into a CSV file using Espruino. If any code is available it would help a lot.

    This is the code I'm using to print values on the console

    const period = 30*60*1000; // milliseconds (every 30 minutes)
    const length = 200; // number of records (for 100 hours / 4 days)
    
    var ruuvi = require("Ruuvitag");
    var records = [];
    
    function log() {
      ruuvi.setEnvOn(true);
      if (records.unshift({time:getTime(),temp:ru­uvi.getEnvData().temp}) > length){
        records.pop();
      }
      ruuvi.setEnvOn(false);
    }
    
    function getData() {
      records.forEach( function(d,i) {
        console.log(i+"\t"+ d.temp +"\t"+ (getTime()-d.time));
      });
    }
    
    ruuvi.setAccelOn(true);
    setInterval(log, period);
    
  • So you're storing the data on the tag - you just want a way to get the data out of it into a CSV file? Effectively calling getData() and writing that to a file?

  • Ok - the easiest thing would be to make a Web Bluetooth website. I'll add a very specific code example for this tomorrow.

  • Ok, it's now at http://www.espruino.com/Data+Collection#­automatically-recovering-data

    You can even try it right away by clicking the 'Try Me' button.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Creating CSV file for Ruvvi data using Espruino

Posted by Avatar for user115800 @user115800

Actions