• First, I'd say it looks like you might have an out of date Puck.js firmware? It'd be worth updating to 1v92

    But I don't think that is your problem. Error 9 is 'invalid length' (which is reported as text on 1v92 firmware). It's actually saying that the data you're trying to send has the length field set wrong.

    Try changing: 0x13, // Length of Service Data

    to: 0x14, // Length of Service Data

    It should be the number of bytes that are after that byte.

    Also, do you know that if you want to use eddystone, there's a library which will do it all for you? http://www.espruino.com/Puck.js+Eddystone

  • Hi, you are correct that my Puck is now still on 1v88. I didn't update it because I have some other projects in progress and I don't want to potentially affect them through updating.

    I changed 0x13 to 0x14 then add one more character to the message and it worked! Now I found that the maximum value is 0x1A and the entire message is now 31 bytes just as you mentioned.

    Working: (31 bytes total)

    NRF.setAdvertising([0x03,  // Length of Service List
      0x03,  // Param: Service List
      0xAA, 0xFE,  // Eddystone ID
      0x1A,  // Length of Service Data
      0x16,  // Service Data
      0xAA, 0xFE, // Eddystone ID
      0x10,  // Frame type: URL
      0xF8, // Power
      0x03, // https://
      '1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K'],
        {interval:100});
    

    Any further extension will result in BLE Error Code 9 but that is to be expected, I think.

    I am aware that the Eddystone library exists, but I am using this manual way to verify if the message can be maximum 31 bytes long.

    Now I am able to use NRF.findDevices on the receiving beacon to read the information from other Bluetooth beacons nearby. I am looking into a way to filter out everything except the Puck's broadcast. One way I suspect this can be done is using the services key in the devices object as the broadcasting message has the feaa value. Though I have zero experience in js so I think this will take a while.

    BluetoothDevice {
      "id": "e3:55:93:0b:72:1d random",
      "rssi": -66,
      "services": [
        "feaa"
       ],
      "data": new ArrayBuffer([3, 3, 170, 254, 26, 22, 170, 254, 16, 248, 3, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75])
     }
    

    Many thanks for you help.

About

Avatar for Gordon @Gordon started