Skip to main content

Temperature Sensor Raw Data Value Calculation Logic

This article explains how to convert raw data values received from temperature sensors (and other Signed int parameters) into human-readable readings such as degrees Celsius.

Updated this week

1 Understanding Signed Integers

Before diving into the calculation, it helps to understand how devices store numbers internally. Computers represent all data as binary digits (bits), where each bit is either a 0 or a 1.

1.1 What Is a 16-Bit Integer?

A 16-bit integer uses 16 binary digits to represent a number. With 16 bits you can represent 65,536 unique values (2^16 = 65,536). The range of those values depends on whether the integer is unsigned or signed.

1.2 Unsigned vs. Signed Integers

An unsigned integer only represents zero and positive numbers. A 16-bit unsigned integer ranges from 0 to 65535.

A signed integer can represent both negative and positive numbers. It uses the highest bit (the "sign bit") to indicate whether the number is positive or negative. A 16-bit signed integer ranges from -32768 to +32767.

1.3 Why Does This Matter for Sensor Data?

Temperature sensors need to report negative values (e.g., -9.00 °C). The device transmits the raw value as a 16-bit number, but communication protocols often deliver it as an unsigned value between 0 and 65535. You must convert that unsigned value back into a signed value before applying the multiplier to get the real temperature.

For more background, see the Wikipedia articles on 16-bit computing and Signed number representations.


2 How Positive and Negative Values Are Represented

2.1 Positive Values

Values from 0x0000 to 0x7FFF (decimal 0 to 32767) represent positive numbers. No conversion is needed - use the value directly with the multiplier.

2.2 Negative Values

Values from 0x8000 to 0xFFFF (decimal 32768 to 65535) represent negative numbers. To get the actual signed value, subtract 65535 from the received value.


3 Calculation Steps

Follow these steps to convert a raw sensor value into a real reading:

  1. Read the raw value received from the sensor.

  2. Check if the value is greater than 32767.

    • If yes → subtract 65535 from the value to get the signed result.

    • If no → use the value as-is (it is already positive).

  3. Multiply the result by the parameter's Multiplier (found in the FMIO list under the "Multiplier" column).

3.1 Formula

For negative raw values (greater than 32767):

([Received value] - 65535) × [Multiplier]

For positive raw values (0 to 32767):

[Received value] × [Multiplier]

3.2 Example

A BT temperature sensor returns a raw value of 64635.

  1. 64635 is greater than 32767, so it represents a negative number.

  2. Subtract: 64635 - 65535 = -900

  3. The multiplier for the BT temperature sensor is 0.01 (check the FMIO list to confirm the multiplier for your parameter).

  4. Apply the multiplier: -900 × 0.01 = -9.00 °C


4 Applicability

This conversion logic applies to every parameter with a data type of "Signed int" listed in the FMIO list. The multiplier value may differ per parameter - always check the "Multiplier" column for the specific parameter you are working with.

⚠ Important: Do not assume the multiplier is always 0.01. Each parameter may have a different multiplier. Always verify the correct value in the FMIO list before performing the calculation.


5 Additional Resources

Did this answer your question?