Binary Sensor Raw Value Decoder
Decode raw binary sensor data into a usable engineering value. Interpret the binary word as unsigned or signed two’s-complement data, then apply the sensor’s scale factor and offset.
What Is a Binary Sensor Raw Value?
Digital sensors often return measurements as raw integer data rather than immediately providing a human-readable temperature, pressure, acceleration or other physical measurement. That raw sensor value may be stored in a register, transmitted through a digital interface or embedded inside a packet.
The raw value frequently needs to be interpreted as an unsigned or signed binary integer and then transformed using a scale factor, sensitivity or offset documented by the sensor manufacturer.
How the Binary Sensor Raw Value Decoder Works
The decoder performs the process in two stages. First, the entered binary word is converted into its numerical raw value. Second, the supplied scale factor and offset are applied.
Step 2: Engineering Value = Raw Decimal × Scale + Offset
This separation is important because the same binary bits can represent different numerical values depending on whether the sensor uses unsigned or signed two’s-complement coding.
Binary Sensor Decoding Formula
Many sensor datasheets use a linear conversion equation that can be represented in the following general form:
For example, suppose a sensor returns raw decimal value 250 and specifies a scale of 0.1 °C per count.
If the datasheet also specifies an offset, that value is added after the scale multiplication.
Signed Binary Sensor Data
Sensors that measure quantities capable of becoming negative commonly use signed numerical formats. Temperature, acceleration, angular velocity and magnetic-field sensors are common examples.
A very common representation is two’s complement. In an N-bit two’s-complement word, the highest bit indicates the negative range when it is set.
16-bit signed range: -32768 through +32767
Unsigned Binary Sensor Data
Unsigned sensor data uses every available bit for magnitude and cannot directly represent negative raw values.
| Bit Width | Unsigned Range | Signed Two’s-Complement Range |
|---|---|---|
| 8-bit | 0 to 255 | -128 to 127 |
| 12-bit | 0 to 4095 | -2048 to 2047 |
| 16-bit | 0 to 65535 | -32768 to 32767 |
| 24-bit | 0 to 16777215 | -8388608 to 8388607 |
Signed Sensor Raw Value Example
Consider this 8-bit binary sensor word:
As an unsigned value it equals decimal 246. As an 8-bit two’s-complement value it represents -10.
Signed interpretation: 246 – 256 = -10
If the scale factor is 0.5 °C per count:
Unsigned Sensor Raw Value Example
Suppose an unsigned 12-bit pressure sensor returns:
This binary number is decimal 2500.
If the documented scale is 0.02 kPa per count:
No signed conversion is applied because the raw sensor format is unsigned.
Sensor Scale Factor
A sensor scale factor describes how much physical quantity corresponds to one raw digital count. It may also be called sensitivity, gain, resolution or conversion factor depending on the manufacturer and sensor type.
Raw: 2534
Decoded: 25.34 °C
The correct scale must come from the sensor documentation. This calculator cannot infer it automatically from the binary bits.
Sensor Offset
Some linear sensor conversions require an offset in addition to multiplication.
For example:
Scale: 0.1
Offset: -40
Result: 500 × 0.1 – 40 = 10
The offset can be positive, negative or zero depending on the sensor’s documented transfer equation.
Binary Sensor Data to Hexadecimal
Sensor registers and datasheets commonly display raw values in hexadecimal notation. The decoder therefore also reports the hexadecimal representation of the entered binary word.
Hex: 0xF6
Binary and hexadecimal are simply different ways of displaying the same raw bit pattern.
8-Bit Sensor Raw Values
An 8-bit sensor word contains 256 possible binary patterns.
Signed: -128 to +127
The interpretation depends entirely on the data format specified in the sensor datasheet.
16-Bit Sensor Raw Values
Sixteen-bit sensor output is very common because it offers 65,536 possible raw bit patterns and fits naturally into two-byte registers.
Signed: -32768 to 32767
Accelerometers, gyroscopes, magnetic sensors, ADC measurements and industrial instruments frequently expose 16-bit measurement values.
Temperature Sensor Raw Value Example
Assume a signed 16-bit temperature register returns a decimal raw value of -300 and the datasheet specifies 0.01 °C per count.
= -3 °C
The binary decoder first determines that the raw register represents -300 before applying the temperature scale.
Accelerometer Raw Data Example
An accelerometer might return signed raw acceleration counts. If one raw count represents 0.001 g, then:
Scale: 0.001 g/count
Acceleration: -0.75 g
The negative result represents direction relative to the sensor axis rather than an invalid measurement.
Pressure Sensor Raw Data Example
Pressure sensors commonly use unsigned measurements because the raw pressure quantity is usually non-negative across the supported range.
Scale: 0.01 kPa/count
Pressure: 125 kPa
The exact relationship varies by sensor; some pressure sensors instead use a minimum/maximum calibration mapping rather than a simple scale and offset.
Binary Sensor Data from I2C and SPI
Many digital sensors send raw measurements through I2C or SPI. Those communication protocols transport bytes, but the sensor datasheet defines how the bytes combine into the final measurement word.
This calculator assumes that the user already has the correctly assembled binary sensor value. It does not reorder I2C or SPI bytes automatically.
That keeps the page focused on raw sensor-value interpretation instead of repeating the separate byte-order and data-frame tools already available on BinaryCon.
Sensor Raw Value vs Register Scaling
The Binary Sensor Raw Value Decoder and Binary Register Scaling Calculator serve related but different purposes.
| Tool | Main Input | Main Purpose |
|---|---|---|
| Binary Sensor Raw Value Decoder | Actual binary sensor word | Interpret signed/unsigned sensor bits and decode physical value |
| Binary Register Scaling Calculator | Register/scaling parameters | Apply register-value scaling relationship |
This sensor decoder explicitly performs the binary and signed-number interpretation before scaling.
Sensor Raw Value vs ADC Binary Code
The ADC Binary Code Calculator predicts the digital code produced by an ideal ADC from a known input voltage. A sensor raw-value decoder starts from an already available digital sensor word and interprets what that word means.
Sensor Raw Value Decoder: Binary Sensor Code → Engineering Measurement
Why Sensor Datasheets Matter
Raw binary data does not contain enough information by itself to determine the correct physical units, scaling formula or signedness. Those properties are defined by the device manufacturer.
Before decoding real sensor measurements, confirm the bit width, signed or unsigned encoding, scale factor, offset, byte order and measurement units in the sensor datasheet.
Important Binary Sensor Raw Value Notes
The number of entered bits determines the raw word width.
Unsigned mode interprets the binary sequence as a normal positive base-2 integer.
Signed mode uses two’s-complement interpretation.
In signed mode, a most-significant bit of 1 indicates a negative two’s-complement value.
Decoded sensor value equals raw decimal value multiplied by the scale factor, then plus the offset.
The scale factor and offset must come from the sensor specification or calibration data.
The engineering-unit field changes only the displayed unit label; it does not modify the calculation.
This calculator does not reorder bytes, decode floating-point sensor registers, determine sensor calibration automatically or identify the sensor model.
Always confirm signedness, byte order, scale and units from the manufacturer’s datasheet before using a decoded value in an engineering application.