This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Does Web Bluetooth allow for reading and writing of all characteristics/features of a Thingy52?

I've been looking at ways of implementing Web Bluetooth to connect to a Thingy52 using Bluetooth Low Energy.

https://github.com/NordicPlayground/Nordic-Thingy52-Thingyjs

This git repository mentions that connecting through Web Bluetooth allows you to access every possible feature on the Thingy52 except for MTU.

However, later in the readme it says not all features are accessible and some only have read or write permissions.

These two statements conflict eachother so what I would like to know is:

Is it possible to read out every single sensor using Web Bluetooth connecting via Bluetooth Low Energy?

Parents
  • In the meantime I've found this:

    https://www.espruino.com/Quick+Start+BLE?print

    I'm a software engineer myself so I'm not very familiar with flashing boards and all that. The website says if I put their firmware on the

    Thingy it will start advertising itself using BLE. Does this mean it will allow me to read all of the sensors using it?

  • After some more research it turns out you guys dont support Espruino anymore. I would still like to get an answer to my original question Slight smile

  • That is correct. That is, it may be that Espruino works, but it was never supported/maintained by us. You can look this up in a forum that supports Espruino. 

    My guess is that Web Bluetooth doesn't support higher MTU than the standard. Please note that MTU is the packet length used in a connection, and not a sensor or something. 

    The features that only have read or write permission is not whether it is supported or not, but what this Bluetooth Characteristic allows. E.g. it doesn't make sense to write to the "Absolute orientation" characteristic, because this field hold the data from the sensor. I see that it doesn't support reading from it either. I believe this is because of the MTU limit. It requires more bytes to transfer all the sensor data.

    If you are new to bluetooth, I suggest that you get hold of an extra DK/dongle, and try nRF Connect for Desktop (or you can use the mobile version if you don't have an extra piece of HW). Try to connect to your thingy, and look at how the services are set up, how you enable notifications, and what characteristics that does what. 

    Best regards,

    Edvin

Reply
  • That is correct. That is, it may be that Espruino works, but it was never supported/maintained by us. You can look this up in a forum that supports Espruino. 

    My guess is that Web Bluetooth doesn't support higher MTU than the standard. Please note that MTU is the packet length used in a connection, and not a sensor or something. 

    The features that only have read or write permission is not whether it is supported or not, but what this Bluetooth Characteristic allows. E.g. it doesn't make sense to write to the "Absolute orientation" characteristic, because this field hold the data from the sensor. I see that it doesn't support reading from it either. I believe this is because of the MTU limit. It requires more bytes to transfer all the sensor data.

    If you are new to bluetooth, I suggest that you get hold of an extra DK/dongle, and try nRF Connect for Desktop (or you can use the mobile version if you don't have an extra piece of HW). Try to connect to your thingy, and look at how the services are set up, how you enable notifications, and what characteristics that does what. 

    Best regards,

    Edvin

Children
  • Thanks Edvin,

    I've looked at the nrf Connect for desktop and generated the tool that uses Bluetooth Low Energy. The tool seems to be written in Javascript to I'm guessing it uses Web Bluetooth to connect to the devices.

    The problem is I can't test what is and isn't readable since I don't have a Thingy yet. I'm doing research to see if it is possible to use the Thingy in my project before buying one. Could you possibly try and test out for me to see what is and isn't possible using the Bluetooth LE app in nrf connect for desktop?

    I would like to know what is readable and which sensors I can turn on/off using the Low Energy app in nrf connect.

    Best regards

  • Hello,

     

    svansomeren said:
    The tool seems to be written in Javascript to I'm guessing it uses Web Bluetooth to connect to the devices.

     That is correct.

    The limitations that are listed in "Supported Operations" are from the thingy FW. In Bluetooth Low Energy there are Services and Characteristics. Each service contains one or more characteristics. Each characteristic has 3 ways of communicating. Read, Write and Notification/indication (Let's not worry about indications for now). 

    So many of the characteristics in the Thingy supports read or write, such as the battery service. As I mentioned, it doesn't make any sense to be able to write to the battery measurement characteristic, so that is disabled in the thingy FW, but you are able to read it.

    Let's take the Absolute orientation as another example:

    Start/Stop is supported, but read and write is not. Again, it wouldn't make sense to write to the absolute orientation characteristic, because it is a measurement from the sensors on the thingy, but you can't read it either. However, you can start/stop the stream of this data. This means that it uses notifications to stream the absolute orientation. 

    Basically, all the characteristics that are supported in the Thingy app for Mobile is supported in this tool as well, except MTU, as you pointed out initially. The reason for this is that Web Bluetooth doesn't allow for connection parameter change requests, so it is not possible to do this from the Nordic Thingy:52 Web Bluetooth FW. 

    It is, however, possible to increase this from the thingy, but that means that you must re-program the thingy with an external programmer. 

    If your concern is that you can't use some of the sensors on the thingy, I can assure you that they will all be supported by the features in the GitHub repo that you linked to. The MTU change is not necessary.

    Best regards,

    Edvin

Related