Avatar for titaniumwhite

titaniumwhite

Member since Dec 2020 • Last active Dec 2020
  • 1 conversations
  • 7 comments

Most recent activity

    • 16 comments
    • 2,296 views
  • in Other Boards
    Avatar for titaniumwhite

    @Robin thanks for the links, they're very useful to me, the one about UUID particularly.

    @Gordon thanks for the correction.
    After some days trying on it, I could make it work just deleting the advertising.
    setServices is now

    NRF.setServices({
        '6e400001b5a3f393e0a9e50e24dcca9e' : {
          '6e400003b5a3f393e0a9e50e24dcca9e' : {
            value : 0,
            readable : true,
            notify : true
          }
        }
    });
    

    Just removing the advertise, the Ruuvi doesn't crash anymore and now my webapp can see and connect to it.
    Altought I read the documentation and other forum posts about the same topic, I couldn't really understand what advertise does. Is it necessary for my purpose?

  • in Other Boards
    Avatar for titaniumwhite

    I'm sorry they stopped supporting Espruino, they both are great projects with great potential.
    I think I figured out where the bug was. After some debugging, this error was thrown by the web IDE

    Uncaught Error: Invalid Service UUID: UUID string should only contain hex characters and dashes
    at line 25 col 2
    });

    I found the related following issue on github https://github.com/espruino/Espruino/iss­ues/1723.
    Do you think I could solve my problem using 4 integers UUID instead of a 128 bit UUID?
    I tried to look on the web how to convert it but I couldn't find an answer. How does UUID work? How do I convert from "ABCDABCD-ABCD-ABCD-ABCD-ABCDABCDABCD" to 0xABCD?

  • in Other Boards
    Avatar for titaniumwhite

    Sorry for insisting, but I tried again in the second Ruuvi I have and now it's not working anymore, as the former.
    Here the steps I've taken:

    • I flash the Ruuvi with Espruino, everything works and the webapp I wrote can detect it
    • I disconnect the Ruuvi from everything
    • I connect the Ruuvi through the Espruino Web IDE and I flash the following script

      const serviceUUID = '6e400001b5a3f393e0a9e50e24dcca9e';
      const characteristicUUID = '6e400003b5a3f393e0a9e50e24dcca9e';
      var Ruuvitag = require("Ruuvitag");
      
      NRF.setServices({
      serviceUUID : {
        characteristicUUID : {
          value : 0,
          readable : true,
          notify : true
        }
      }
      }, { advertise : [serviceUUID] });
      
      
      function startAdv(){
      var idInterval = setInterval(function(){
      var val = Math.random();
      console.log(val);
      
      NRF.updateServices({
      serviceUUID : {
        characteristicUUID : {
          value : val,
          notify : true
        }
      }
      });
      
      }, 200);
      
      setWatch(function() {
      clearInterval(idInterval);
      }, BTN1, {repeat: true});
      }
      
      • The console of the Web IDE says "BLE Connected, queueing BLE restart for later"
      • I disconnect the Ruuvi from the Web IDE (I read on another topic it's necessary if I read "queueing BLE restart for later")
      • I try to connect from the webapp I wrote, but now the app can't detect the Ruuvi anymore

    The Ruuvi is not visible on Bluetooth anymore, nRF Connect can see it only in bootloader mode.
    I noticed that if I pull the battery and re-insert it, both webapp and nRF Connect can see the Ruuvi, but if I scan again, then the Ruuvi is not visible anymore. I can't connect to it.

    Tomorrow I'll flash the Ruuvi through the Ruuvitag DevKit, but I'd like to understand how to make it works.

    Thanks a lot for helping, I really appreciate that.

  • in Other Boards
    Avatar for titaniumwhite

    So, to change data on the notify characteristics of the UART service do I have to write something like that?

    const serviceUUID = '6e400001b5a3f393e0a9e50e24dcca9e';
    const characteristicUUID = '6e400003b5a3f393e0a9e50e24dcca9e';
    
    NRF.updateServices({
        serviceUUID : {
          characteristicUUID : {
            value : 12345,
            notify : true
          }
        }
      });
    

    And then, from the script on the laptop, I have to read the data value of the notify descriptor, isn't that right?

  • in Other Boards
    Avatar for titaniumwhite

    Have you tried just reflashing using the firmware update mode (maybe to a Ruuvitag firmware) and then flashing back to Espruino?

    Yes, I tried flashing both Ruuvitag firmware and Espruino but it fails in both cases.
    I also have the Ruuvi DevKit but I can't use that because a pin is missing because of some soldering... the only way to flash it is through Bluetooth.

    Have you tried turning bluetooth off and on on your PC? GATT ERROR might be due to the computer itself getting confused.

    I tried, but my laptop can't see the Ruuvi. I get the same error when I try to connect with the nRF app and when I try to flash in bootloader mode. Seems like something's broken in the GATT protocol because the Ruuvi Bluetooth is not working anymore.

  • in Other Boards
    Avatar for titaniumwhite

    You're right, it was power up in DFU mode.
    I tried re-inserting the battery with the button held down, but it's not working. The behavior is extremely strange: when I insert the battery nRF connect can see the Ruuvi, if I press to connect it tries to connect but it fails. After that, if I scan again, the app can't see the Ruuvi. The log says "Error 133 (0x85): GATT ERROR".
    However, do you confirm I have to use the Nordic UART Service to communicate with the laptop? I'm a bit scared it can happen again and in that case, I'd run out of Ruuvitag.
    Plus, I've read that using 128 bit UUIDs to advertise could lead to some connection problems via Bluetooth. Could it be the cause of the problem?

  • in Other Boards
    Avatar for titaniumwhite

    Hi guys,
    I'm trying to connect a Ruuvitag supporting Espruino to my laptop through Noble.js. I need to collect some data through a sensor soldered on the Ruuvitag and to send them to the laptop.
    I flashed this code through the Espruino Web IDE to make the Ruuvi notify the central module as soon as it collects data, but I guess I have misunderstood something since the Ruuvi is not connecting nor Bluetooth flashing anymore. There is the screenshot of nRF Connect connected to the Ruuvi in bootloading below, it seems there is no more the Nordic UART Service... oops.

    const serviceUUID = '6e400001b5a3f393e0a9e50e24dcca9e';
    const characteristicUUID = '6e400003b5a3f393e0a9e50e24dcca9e';
    
    NRF.setServices({
        serviceUUID : {
          characteristicUUID : {
            value : 0,
            readable : true,
            notify : true
          }
        }
      }, { advertise : [serviceUUID] });
    
    

    Luckily I have one more Ruuvi and I really need to make it communicate with the laptop.
    How can I make it?
    Do I have to create my own service and my own notify characteristic?
    Or do I have to use the UART characteristic for notification as above?

Actions