Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

GATT Characteristic Presentation Format: UNITS

Good day,

I again have an interesting question).
There is a useful descriptor to better understand the purpose of the characteristic. This is a 0x2904 handle (GATT Characteristic Presentation Format).
This question is related to the "unit" field. As part of SDK, I did not find a description of the units themselves, in connection with which I wrote a specific listing (I did not look well in SDK?).

However, there is one moment. How to specify the units for the data from the accelerometer? Accelerometer gives data in free fall units (aka g = 9.81 m/s^2) that are not standard and are missing from the list (GATT units).

Now I indicated units as acceleration. but it is confusing. So, if I give 1000 mg, then the receiving side can perceive them as 1.000 m/s^2. although it should like 9.800 m/s^2 ...

What to do in this case correctly?

Thank.

Parents
  • The below will not be perceived as weight, it will be perceived as acceleration. Seems like a good fit for your accelaration data.

    For weight (mg) you have different unit value that goes into this one.

    to get to milligram from this, you need to use the exponent of -3 in this table.

  • ,

    I khow about exponent, we use this.

    Here the question is a little different. I give the device to the user, He reads the descriptors of the characteristics and sees:
    - data type: signed, 16 bits (SINT16)
    - unit of measurement: acceleration, m/s^2
    - exponent: -3

    Now, the user receives the data (notification) and sees the number 1000.

    He should perceive it as 1000mg = 1g, But this does not correspond to the description in the descriptor. And the user thinks it is 1000 mm/s^2. I had to give an explanation in the letter.

    Your application on android (NrfConnect) behaves the same way.

  • Pardon me if, I am not understanding this right.

    1000mm/s^2 is same as 1 m/s^2 which is same as 1g, which is what you want to convey right? 

  • Not certainly in that way.

    I want to show that the transmitted values are units of acceleration of free fall - g (9,8 м\с2) (or milig = 0.001g). i.e value 1000 = 1000mg ≠ 1000 mm/c2. 

    but using the standard descriptor, I cannot do it (or I don’t know how), since for this field — units — there is no provision for setting user values.

    The essence of my question is: can I install custom units through a standard descriptor?

    so far as an exit from this situation, I see two options:
    1. convert data to m \ s2 and transfer it with a standard descriptor
    2. to get own set of descriptors.

    I apologize for perhaps the incorrect wording of the question. it's all a language barrier (

  • Hmm, I understand now what you mean. I do not think you can set custom units through the standard descriptor. So like you said

    1. Either convert them to units in standard descriptor and both, peer and your device understands to convert them back to your units or
    2. create your own custom descriptors.
Reply Children
Related