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:
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 Name | Description | Example Status |
|---|
e2c-trinity-codec-converter.exe | The main converter application. | Required |
SensorDecoders | The folder containing Milesight scripts. | Present |
dragino-end-node-decoder | The folder containing Dragino scripts. | Present |

- Double-click
e2c-trinity-codec-converter.exe to launch the GUI tool. - The tool will automatically scan the folders. Select your sensor's Vendor (e.g., Milesight) from the first dropdown.
- Select your sensor's specific Model (e.g., AM102) from the second dropdown.
- Click the Generate Codec TOML button.
- 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.
- Navigate to LNS Configuration -> Payload Codecs.
- Click the Import Codec button at the top.
- Select Import from file and upload the newly generated
.toml file (e.g., milesight-am102-codec.toml). - 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.
- Find the Uplink Test tab on the right side of the import window.
- 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...). - Click the Run Decode button.
- 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"). - 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.