GATT service with Ruuvitag

Posted on
  • Hi there!

    I'm trying to set up a GATT service on my ruuvitag. I have successfully installed the firmware following https://www.espruino.com/Ruuvitag and I can talk with the device and upload code 🎉

    I've got the following code running:

    var Ruuvitag = require("Ruuvitag");
    
    NRF.setServices({
      0xff20: {
        0xff21: {
          value: Math.round(Ruuvitag.getEnvData().temp),
          readable: true,
          notify: true
        }
      }
    });
    setInterval(function () {
      NRF.updateServices({
        0xff20: {
          0xff21: {
            value: Math.round(Ruuvitag.getEnvData().temp),
            notify: true
          }
        }
      });
    }, 1000);
    

    What I am wondering however, is how I can connect to this service using a node.js application. I've been trying the espurino module but can't figure out how to use it to "scan" for GATT services. Using the bleat module I can find other BLE devices, but not my ruuvitag running espurino.

    Any ideas what I might be getting wrong?

    NB! I'm new to this whole BLE and GATT stuff, so I might be confused about a few things 😝

  • I'm also a beginner, so you might get better responses from other users.

    Gordon mentioned a change for the upcomming release (v92), see http://forum.espruino.com/comments/13525­853/

    you might need to add

    0xff20
    

    to the advertised services.

  • Thanks @AntiCat !! I'll give that a try 😁

    Turns out it was a rookie mistake of not disconnecting form the IDE 🙈😝 Working now! Using bleat.webbluetooth I am able to connect to the GATT service and pull characteristics and descriptor 🎉

    Now I need to decode the data... Any ideas there? 😝

  • Great! Glad you got it sorted!

    In terms of decoding, given what you're doing you should hopefully just be receiving a 1-element array, where the single element is an integer value which is the temperature.

    Not sure if it helps, but I've tended to use noble for interfacing via BLE. I think it's a bit more common so you might find documentation better.

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

GATT service with Ruuvitag

Posted by Avatar for user75772 @user75772

Actions