LoRaWAN Payload Decoder: Managing Firmware Changes

LoRaWAN Payload Decoder: Keeping GPS and Sensor Data Correct After Firmware Updates

A livestock collar is still sending messages, but its battery value suddenly looks incorrect. A personnel badge remains online, yet its alarm status no longer matches the event. A temperature sensor starts reporting unexpected readings after a firmware update.

These symptoms deserve a check of the application payload format—not just the radio connection.

A LoRaWAN payload decoder translates device data into fields that a tracking platform can display and process. When firmware changes how those fields are encoded, the decoder and downstream application must remain compatible.

For OEM projects involving multiple device models and firmware generations, decoder management should be part of the product release process.

What Does a LoRaWAN Payload Decoder Do?

Many devices send compact binary application payloads. A decoder interprets those bytes using the manufacturer’s format specification and produces named values.

Depending on the device, the decoded output might include:

  • Latitude and longitude.
  • Battery voltage or estimated battery percentage.
  • Temperature and activity readings.
  • SOS or tamper status.
  • Position validity.
  • Device operating mode.

The Things Stack, for example, supports payload formatters that convert binary messages into readable application fields. Formatters can be configured for individual devices or an application.

The correct decoder depends on the device’s application protocol. Sharing a LoRaWAN network does not mean two devices use the same payload layout.

Why Firmware Changes Can Affect Decoding

A firmware update may introduce a new measurement, change the size of a field or add a status flag.

Consider an illustrative temperature field. One format might store temperature as an unsigned value with an offset. Another might use a signed integer multiplied by a scale factor. Applying the wrong interpretation can produce a plausible-looking but incorrect result.

Problems can also occur when a decoder:

  • Reads a field from the wrong byte position.
  • Uses the wrong byte order.
  • Treats a signed number as unsigned.
  • Confuses battery voltage with battery percentage.
  • Interprets an invalid-position marker as a valid coordinate.

These errors may pass through a dashboard unnoticed if validation checks only whether a value exists.

Separate Firmware Version from Payload Version

Firmware versions and payload versions serve different purposes.

A firmware release may improve power management without changing the transmitted data format. Another release may introduce a different payload structure.

For custom device development, define an explicit method for identifying the payload format. Possible approaches include a version field, a documented message type or a controlled device-to-decoder mapping.

The appropriate choice depends on the available payload space and system design. What matters is that the receiver can identify the correct interpretation without guessing.

Maintain a compatibility table such as the following:

Device familyFirmware releasePayload formatDecoder release
Collar A1.4Format 1Decoder 1.2
Collar A1.5Format 1Decoder 1.2
Collar A2.0Format 2Decoder 2.0
Badge B1.0Badge Format 1Badge Decoder 1.0

This is an illustrative release record, not a specification for a particular product.

Validate the Message Before Reading Its Fields

A robust decoder should check the message structure before extracting measurements.

Useful checks include the expected message type, supported format version and required payload length. If the application protocol uses different FPort values for different messages, validate those assignments as well.

Unknown or incomplete messages should produce a clear diagnostic result. They should not silently become normal readings.

For example, a missing temperature field should not automatically become zero degrees. An absent location should not become a valid point at latitude zero and longitude zero.

Distinguishing “unavailable” from a genuine zero value helps prevent misleading maps, reports and alarms.

Keep Platform Field Names and Units Consistent

Correct byte decoding is only the first step. The output must also match what the platform expects.

If one decoder publishes battery voltage and another publishes battery percentage under the same field name, dashboards and low-battery rules may interpret the values incorrectly.

Define an application data contract that specifies:

  • Field names.
  • Measurement units.
  • Numeric types and scale.
  • Validity indicators.
  • Missing-value behavior.
  • Alarm meanings.

Use unambiguous names such as battery_voltage_v and battery_percent when both measurements are supported.

If a field’s meaning changes, update the API documentation, reports and alert rules alongside the decoder.

Test with Known Payload Examples

Before releasing a new decoder, build a set of sample messages with independently verified expected results.

Include ordinary readings and boundary cases:

Test caseWhat it checks
Valid GPS positionCoordinate order, sign and scale
No valid GPS fixCorrect handling of unavailable location
Negative temperatureSigned-number interpretation
Low-battery eventField units and alarm mapping
Multiple status flagsIndependent interpretation of each flag
Truncated payloadRejection of incomplete data
Unknown format versionClear compatibility error
Previous firmware messageContinued support where required

Use the manufacturer’s protocol specification and controlled device tests to establish the expected output. A successful decode alone does not demonstrate that the values are correct.

Plan for Mixed Firmware Fleets

Large deployments rarely update every device at the same time.

A pasture may contain collars from several production batches. A facility may replace only a few personnel badges. Stored messages may also arrive after a decoder update.

During a transition, support the required old and new formats explicitly. Avoid replacing a shared application decoder without checking which devices depend on it.

Where appropriate, assign device-specific decoders or dispatch messages to the correct parsing logic using their documented format identifier.

Retain raw application payloads and relevant metadata according to the project’s access and retention policies. This can make it easier to investigate unexpected readings and reprocess affected records.

Include Decoder Documentation in OEM Deliverables

For a custom LoRaWAN tracking project, request more than a working device sample.

The integration package should include the payload specification, decoder source or supported integration method, sample messages, expected outputs and a compatibility record.

Also agree on how future protocol changes will be communicated and tested.

At Shenzhen Jinshengchang Technology Co., Ltd., discuss your device, firmware and platform requirements as part of the OEM/ODM project scope. For livestock collars, personnel badges and asset trackers, define the data interface early so the hardware and application teams can validate the complete solution.

Visit lora8.net to discuss your LoRaWAN tracking project.