How to Convert LoRaWAN Sensor Codec Formats and Import to E2C Field

How to Convert LoRaWAN Sensor Codec Formats and Import to E2C Field

1. Introduction & Basic Concepts

  • When do you need this guide? When using Robustel E2C Field, if the Codec of the LoRaWAN device you want to connect is not pre-integrated into the system, you will need to manually convert the raw Codec file provided by the device manufacturer into a .toml file supported by E2C Field, and then import it.
  • Why do we need a Codec? To save battery power, LoRaWAN sensors transmit data over the air in a compressed, encrypted hexadecimal (Hex) format (e.g., 0175640367...). The gateway cannot understand this raw data directly. A Payload Codec acts as a "translator" to convert this Hex data into readable engineering values (e.g., Temperature: 26.3°C).
  • Why do we need to convert it? Robustel's E2C Field software uses an embedded ChirpStack LNS (LoRaWAN Network Server) to manage sensors. ChirpStack requires the Codec files to be in a specific .toml configuration format.
  • What this tool does: Sensor manufacturers (like Milesight or Dragino) usually provide raw JavaScript decoders. The E2C Trinity Codec Converter is a Windows tool that automatically packages these raw vendor scripts into the .toml format required by E2C Field.

2. Prerequisites

Before starting the configuration, please ensure you have the following ready on your PC:

  • The Conversion Tool:e2c-trinity-codec-converter.exe downloaded to your Windows PC.
  • Raw Codec Source Folders: You must download the raw decoder folders provided by the sensor manufacturers. For example:
    • Milesight:SensorDecoders folder (from Milesight GitHub)
    • Dragino:dragino-end-node-decoder folder (from Dragino GitHub)
  • E2C Field Access: You can log into the E2C Field web interface on your Robustel Gateway.

3. Configuration Steps

Step 1: Prepare the Files in the Same Directory

The conversion tool works by scanning its current folder. You must place the .exe file and the manufacturer's raw Codec folder in the exact same directory.

File/Folder NameDescriptionExample Status
e2c-trinity-codec-converter.exeThe main converter application.Required
SensorDecodersThe folder containing Milesight scripts.Present
dragino-end-node-decoderThe folder containing Dragino scripts.Present

Step 2: Run the Tool and Generate the TOML File

  1. Double-clicke2c-trinity-codec-converter.exe to launch the GUI tool.
  2. The tool will automatically scan the folders. Select your sensor's Vendor (e.g., Milesight) from the first dropdown.
  3. Select your sensor's specific Model (e.g., AM102) from the second dropdown.
  4. Click the Generate Codec TOML button.
  5. Check the Log panel at the bottom. If it shows [SUCCESS], the .toml file has been created in the same folder.

Step 3: Import the Codec into E2C Field

Now, log into the gateway's E2C Field web interface.

  1. Navigate to LNS Configuration -> Payload Codecs.
  2. Click the Import Codec button at the top.
  3. Select Import from file and upload the newly generated .toml file (e.g., milesight-am102-codec.toml).
  4. The system will automatically fill in the Name, Brand, Series, and display the JavaScript Code Preview.

Step 4: Mandatory Testing and Publishing

Before saving, you must verify that the Codec works correctly.

  1. Find the Uplink Test tab on the right side of the import window.
  2. In the Input Payload (HEX) box, paste a sample hexadecimal payload (you can usually find a sample in the sensor's official user manual, e.g., ff0bffff01...).
  3. Click the Run Decode button.
  4. Look at the Output Console. If the setup is correct, you will see a neatly formatted JSON output showing readable data (e.g., "temperature": "enable").
  5. Once verified, click the Publish button at the bottom right to save this Codec to the gateway.

Next Steps: Your Codec is now ready! You can proceed to create a "Device Profile" using this Codec and add your physical LoRaWAN sensors.