Pylontech / LV BMS CAN Frame Decoder & C99 Unpacker

Decode 8-byte little-endian Pylontech-style BMS telemetry (pack voltage, signed current, SOC and temperature) with bit map and C99 code.

Jump to results

Inputs

Captured payload
Classic CAN 8 bytes or CAN FD 16 bytes. Spaces are optional.
DBC signals
Signal 1
Signal 2
Signal 3
Signal 4

Results

Estimates
Decoded signals4
Pack voltage
52.8 V
Pack current
25 A
State of charge
85 %
Module temperature
25 °C
Bit map · 64 bits
B0 · A0B1 · 14B2 · FAB3 · 00B4 · 55B5 · 41B6 · 00B7 · 0076543210 Bit 7 = 1 · Pack voltage 1 Bit 6 = 0 · Pack voltage 0 Bit 5 = 1 · Pack voltage 1 Bit 4 = 0 · Pack voltage 0 Bit 3 = 0 · Pack voltage 0 Bit 2 = 0 · Pack voltage 0 Bit 1 = 0 · Pack voltage 0 Bit 0 = 0 · Pack voltage 0 Bit 15 = 0 · Pack voltage 0 Bit 14 = 0 · Pack voltage 0 Bit 13 = 0 · Pack voltage 0 Bit 12 = 1 · Pack voltage 1 Bit 11 = 0 · Pack voltage 0 Bit 10 = 1 · Pack voltage 1 Bit 9 = 0 · Pack voltage 0 Bit 8 = 0 · Pack voltage 0 Bit 23 = 1 · Pack current 1 Bit 22 = 1 · Pack current 1 Bit 21 = 1 · Pack current 1 Bit 20 = 1 · Pack current 1 Bit 19 = 1 · Pack current 1 Bit 18 = 0 · Pack current 0 Bit 17 = 1 · Pack current 1 Bit 16 = 0 · Pack current 0 Bit 31 = 0 · Pack current 0 Bit 30 = 0 · Pack current 0 Bit 29 = 0 · Pack current 0 Bit 28 = 0 · Pack current 0 Bit 27 = 0 · Pack current 0 Bit 26 = 0 · Pack current 0 Bit 25 = 0 · Pack current 0 Bit 24 = 0 · Pack current 0 Bit 39 = 0 · State of charge 0 Bit 38 = 1 · State of charge 1 Bit 37 = 0 · State of charge 0 Bit 36 = 1 · State of charge 1 Bit 35 = 0 · State of charge 0 Bit 34 = 1 · State of charge 1 Bit 33 = 0 · State of charge 0 Bit 32 = 1 · State of charge 1 Bit 47 = 0 · Module temperature 0 Bit 46 = 1 · Module temperature 1 Bit 45 = 0 · Module temperature 0 Bit 44 = 0 · Module temperature 0 Bit 43 = 0 · Module temperature 0 Bit 42 = 0 · Module temperature 0 Bit 41 = 0 · Module temperature 0 Bit 40 = 1 · Module temperature 1 Bit 55 = 0 · unassigned 0 Bit 54 = 0 · unassigned 0 Bit 53 = 0 · unassigned 0 Bit 52 = 0 · unassigned 0 Bit 51 = 0 · unassigned 0 Bit 50 = 0 · unassigned 0 Bit 49 = 0 · unassigned 0 Bit 48 = 0 · unassigned 0 Bit 63 = 0 · unassigned 0 Bit 62 = 0 · unassigned 0 Bit 61 = 0 · unassigned 0 Bit 60 = 0 · unassigned 0 Bit 59 = 0 · unassigned 0 Bit 58 = 0 · unassigned 0 Bit 57 = 0 · unassigned 0 Bit 56 = 0 · unassigned 0

Select a bit to see its position and matching signals.

  • Pack voltage
  • Pack current
  • State of charge
  • Module temperature

An asterisk marks an overlapping bit.

Decoded signal values
SignalEncodingRaw integerRaw hexPhysical
Pack voltageIntel52800x14A052.8 V
Pack currentIntel2500xFA25 A
State of chargeIntel850x5585 %
Module temperatureIntel650x4125 °C
Generated C99 masks and functions
#include <stdint.h>

/* Pass a validated payload of at least 8 bytes. */
#define DBC_BIT(data, b) ((uint64_t)(((data)[(b) / 8] >> ((b) % 8)) & 1u))

#define DBC_1_PACK_VOLTAGE_MASK UINT64_C(0xFFFF)
#define DBC_1_PACK_VOLTAGE_RAW(data) (( \
    (DBC_BIT((data), 0) << 0) | \
    (DBC_BIT((data), 1) << 1) | \
    (DBC_BIT((data), 2) << 2) | \
    (DBC_BIT((data), 3) << 3) | \
    (DBC_BIT((data), 4) << 4) | \
    (DBC_BIT((data), 5) << 5) | \
    (DBC_BIT((data), 6) << 6) | \
    (DBC_BIT((data), 7) << 7) | \
    (DBC_BIT((data), 8) << 8) | \
    (DBC_BIT((data), 9) << 9) | \
    (DBC_BIT((data), 10) << 10) | \
    (DBC_BIT((data), 11) << 11) | \
    (DBC_BIT((data), 12) << 12) | \
    (DBC_BIT((data), 13) << 13) | \
    (DBC_BIT((data), 14) << 14) | \
    (DBC_BIT((data), 15) << 15) \
) & DBC_1_PACK_VOLTAGE_MASK)
static inline double dbc_1_pack_voltage_physical(const uint8_t data[static 8]) {
    const uint64_t raw = DBC_1_PACK_VOLTAGE_RAW(data);
    const uint64_t value = raw;
    return (double)value * (0.01) + (0.0);
}

#define DBC_2_PACK_CURRENT_MASK UINT64_C(0xFFFF)
#define DBC_2_PACK_CURRENT_RAW(data) (( \
    (DBC_BIT((data), 16) << 0) | \
    (DBC_BIT((data), 17) << 1) | \
    (DBC_BIT((data), 18) << 2) | \
    (DBC_BIT((data), 19) << 3) | \
    (DBC_BIT((data), 20) << 4) | \
    (DBC_BIT((data), 21) << 5) | \
    (DBC_BIT((data), 22) << 6) | \
    (DBC_BIT((data), 23) << 7) | \
    (DBC_BIT((data), 24) << 8) | \
    (DBC_BIT((data), 25) << 9) | \
    (DBC_BIT((data), 26) << 10) | \
    (DBC_BIT((data), 27) << 11) | \
    (DBC_BIT((data), 28) << 12) | \
    (DBC_BIT((data), 29) << 13) | \
    (DBC_BIT((data), 30) << 14) | \
    (DBC_BIT((data), 31) << 15) \
) & DBC_2_PACK_CURRENT_MASK)
static inline double dbc_2_pack_current_physical(const uint8_t data[static 8]) {
    const uint64_t raw = DBC_2_PACK_CURRENT_RAW(data);
    const int64_t value = raw & (UINT64_C(1) << 15)
        ? -INT64_C(1) - (int64_t)(DBC_2_PACK_CURRENT_MASK ^ raw) : (int64_t)raw;
    return (double)value * (0.1) + (0.0);
}

#define DBC_3_STATE_OF_CHARGE_MASK UINT64_C(0xFF)
#define DBC_3_STATE_OF_CHARGE_RAW(data) (( \
    (DBC_BIT((data), 32) << 0) | \
    (DBC_BIT((data), 33) << 1) | \
    (DBC_BIT((data), 34) << 2) | \
    (DBC_BIT((data), 35) << 3) | \
    (DBC_BIT((data), 36) << 4) | \
    (DBC_BIT((data), 37) << 5) | \
    (DBC_BIT((data), 38) << 6) | \
    (DBC_BIT((data), 39) << 7) \
) & DBC_3_STATE_OF_CHARGE_MASK)
static inline double dbc_3_state_of_charge_physical(const uint8_t data[static 8]) {
    const uint64_t raw = DBC_3_STATE_OF_CHARGE_RAW(data);
    const uint64_t value = raw;
    return (double)value * (1.0) + (0.0);
}

#define DBC_4_MODULE_TEMPERATURE_MASK UINT64_C(0xFF)
#define DBC_4_MODULE_TEMPERATURE_RAW(data) (( \
    (DBC_BIT((data), 40) << 0) | \
    (DBC_BIT((data), 41) << 1) | \
    (DBC_BIT((data), 42) << 2) | \
    (DBC_BIT((data), 43) << 3) | \
    (DBC_BIT((data), 44) << 4) | \
    (DBC_BIT((data), 45) << 5) | \
    (DBC_BIT((data), 46) << 6) | \
    (DBC_BIT((data), 47) << 7) \
) & DBC_4_MODULE_TEMPERATURE_MASK)
static inline double dbc_4_module_temperature_physical(const uint8_t data[static 8]) {
    const uint64_t raw = DBC_4_MODULE_TEMPERATURE_RAW(data);
    const uint64_t value = raw;
    return (double)value * (1.0) + (-40.0);
}
Generated Python 3 decoder
# Pure Python 3 CAN decoder for a 8-byte payload.
FRAME_LEN = 8

def dbc_1_pack_voltage_physical(data: bytes) -> float:
    if len(data) < 8:
        raise ValueError("Expected at least 8 payload bytes")
    raw = (int.from_bytes(data[:8], "little") >> 0) & 0xFFFF
    return raw * (0.01) + (0.0)

def dbc_2_pack_current_physical(data: bytes) -> float:
    if len(data) < 8:
        raise ValueError("Expected at least 8 payload bytes")
    raw = (int.from_bytes(data[:8], "little") >> 16) & 0xFFFF
    if raw & (1 << 15):
        raw -= 1 << 16
    return raw * (0.1) + (0.0)

def dbc_3_state_of_charge_physical(data: bytes) -> float:
    if len(data) < 8:
        raise ValueError("Expected at least 8 payload bytes")
    raw = (int.from_bytes(data[:8], "little") >> 32) & 0xFF
    return raw * (1.0) + (0.0)

def dbc_4_module_temperature_physical(data: bytes) -> float:
    if len(data) < 8:
        raise ValueError("Expected at least 8 payload bytes")
    raw = (int.from_bytes(data[:8], "little") >> 40) & 0xFF
    return raw * (1.0) + (-40.0)

def decode_frame(data: bytes) -> dict[str, float]:
    return {
        "dbc_1_pack_voltage": dbc_1_pack_voltage_physical(data),
        "dbc_2_pack_current": dbc_2_pack_current_physical(data),
        "dbc_3_state_of_charge": dbc_3_state_of_charge_physical(data),
        "dbc_4_module_temperature": dbc_4_module_temperature_physical(data),
    }

Inspect 16-bit signed current and scaling in low-voltage ESS BMS CAN frames

Low-voltage 48 V rack batteries and solar inverter BMS buses (Pylontech, Victron Venus, JK/Seplos adapters) typically transmit telemetry at 500 kbps using standard 11-bit frames with Intel little-endian multi-byte words.

Bytes 0–1 (A0 14 → 0x14A0 = 5,280 → 52.80 V) and signed bytes 2–3 (FA 00 → +250 → +25.0 A; or FE 3E / 3E FE → −45.0 A when discharging) let you verify polarity before enabling closed-loop charge limits on your inverter.

Formulas

  • Intel 16-bit LE word = byte[n] | (byte[n+1] << 8)
  • Pack voltage (V) = 0x14A0 (5,280) × 0.01 = 52.80 V
  • Signed two’s-complement current = 0xFE3E (−450) × 0.1 = −45.0 A

Worked example

Payload A0 14 FA 00 55 41 00 00 decodes cleanly to 52.8 V, +25 A charging current, 85% SOC and 25 °C temperature (65 − 40 offset), generating ready-to-compile C99 unpack functions.

Frequently asked questions

Why does byte 0 + byte 1 (A0 14) become 0x14A0 instead of 0xA014?

Intel little-endian ordering places the least significant byte first in the CAN frame payload, so byte 1 forms the upper byte of the 16-bit word.

What happens if inverter BMS telemetry expects a 0.1 V scale instead of 0.01 V?

Update the Scale field directly on that row to verify whether the manufacturer’s DBC frame scales voltage by 0.01 (5280 = 52.80 V) or 0.1 (528 = 52.8 V).

How do I switch between Intel and Motorola byte order in the generated C99 code?

Toggle the Byte order dropdown on any signal row; the decoder updates the visual bit map and regenerates the DBC_BIT shift masks automatically.