Ruuvitag

Ruuvitag

The Ruuvitag is a Bluetooth LE beacon with an environment sensor and accelerometer built in.

NOTE: Espruino for Ruuvitag is no longer officially supported. The last available build is 2v06

Full details on flashing Ruuvitag can be found at https://ruu.vi/setup

Binaries can be found in:

Contents

Using

Ruuvitag can be used like any other Espruino Bluetooth LE device, with full access to the NRF class for BLE Functionality.

Check out the Getting Started Guide

However to use the built-in sensors you will need to use the Ruuvitag library. For instance to get data, use:

var Ruuvitag = require("Ruuvitag");
Ruuvitag.setEnvOn(true);
Ruuvitag.setAccelOn(true);
console.log(Ruuvitag.getEnvData());
// prints { "temp": 23.70573815741, "pressure": 1017.27733597036, "humidity": 42.0771484375 }
console.log(Ruuvitag.getAccelData());
// prints { "x": 3.90625, "y": -7.8125, "z": 984.375 }

You can also call a function whenever acceleration data is received:

var Ruuvitag = require("Ruuvitag");
Ruuvitag.setAccelOn(true, function(xyz) {
  console.log(xyz);
});

By default Espruino uses the low power accelerometer mode, however the peripherals can be accessed directly:

Saving Code

Normally, uploading code to Espruino will put everything in RAM and it will be lost when power is removed. You can type save() on the left-hand side of the IDE to save to Flash memory though (more information).

When you do that, the sensors will require initialising at power on (so may not work if you 'just' save your code). You'll need to create an onInit function like this, where you turn the sensors' power on at boot time:

var Ruuvitag = require("Ruuvitag");

function onInit() {
  Ruuvitag.setAccelOn(true, function(xyz) {
    console.log(xyz);
  });
}

Tutorials

First, it's best to check out the Getting Started Guide

Tutorials using Bluetooth LE:

Tutorials using Bluetooth LE and functionality that may not be part of Ruuvitag:

Reference

// Set whether the environmental sensor is on or off
exports.setEnvOn = function (on) { ... }

/* Set whether the accelerometer is on or off. A callback can be supplied
  which will be called with an {x,y,z} argument
*/
exports.setAccelOn = function (on, callback) { ... }

// Get the last received environment data { temp: degrees_c, pressure: kPa, humidity: % }
exports.getEnvData = function () { ... }

// Get the last received accelerometer data, or undefined
exports.getAccelData = function () { ... }

Firmware Updates

Check out Ruuvi's DFU instructions

This page is auto-generated from GitHub. If you see any mistakes or have suggestions, please let us know.