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

Questions on the temperature sensor tutorial (temp conversion and decimal numbers)

Hi all, i followed the tutorial "devzone.nordicsemi.com/.../" and did the challanges, however there is a detail i don't understand (totally newbie here!): the value of temperature that i read on the master control panel (phone app) is in hexadecimal and Fahrenheit (this is a supposion, it's right?), i tried to implement the conversion in Celsius by subtracting 32 and dividing 1.8, but what i read on the master control panel is " (0x) 00-00-51-07 ". Can you explain me why, and how to get the correct Celsius value and receive it in decimal (so a conversion from hex to decimal i guess?) on my control panel? Thanks in advance!

Parents
  • Hi

    The result of the sd_temp_get() function is the nRF5 die temperature in 0.25 degrees celsius as documented here. So to get the real temperature you would have to divide the value by 4. Then you can convert it to fahrenheit by multiplying the temperature by 1.8 and finally add 32.

    Bluetooth SIG has also defined a Temperature Measurement Characteristic with a standard way of representing the temperature. However, to make it simple and to show how to use vendor specific UUIDs I chose to do it differently and leave it up to the user to handle the conversion and representation.

    I should probably have made this clearer in the tutorial and I will try to get it updated.

  • Thank you very much, you can close the question! I'll be asking soon for other applications!

    Edit: just to know for my future application, if i want to transmit the values of a sensor connected to the ADC (i convert the analog signal in digital, then send it bi BLE to a pc), there is a particular protocol to represent it on the pc or i just have to transimt for example the values returned in the ADC register?

Reply
  • Thank you very much, you can close the question! I'll be asking soon for other applications!

    Edit: just to know for my future application, if i want to transmit the values of a sensor connected to the ADC (i convert the analog signal in digital, then send it bi BLE to a pc), there is a particular protocol to represent it on the pc or i just have to transimt for example the values returned in the ADC register?

Children
No Data
Related