Noob - No traffic Dragino > Chirpstack v4


I completely agree with you on the Arduino MKRWAN 1310 board; Chirpstack cannot break down and decode any sensor data despite valid hex payloads; that is definitely a scripting issue.

However, with the Dragino, Chirpstack does decode, interpret, and chart the sensor data. I agree, it’s odd that it doesn’t label the incoming data fields, but it does detect the field data, creates fields in Chirpstack, and then posts data to the fields as new data arrives.

See below… The first image are the fields that were auto-created by Chirpstack based on incoming data, the second graphic is data posting to the same fields as device metrics.

Thanks for your assistance… I posted the JSON decode script for both the Dragino and Arduino; if you can find any errors and/or corrections, I appreciate the help. I will re-test any suggestions and post the results immediately, usually within a few hours.



Your codec for MKR is not correct.
Make the codec correct first.

The codec is not correct.
Why shift 14 bits left?
This is my guess based on my experience.

I guess you copied the codec from old TTN.
ChirpStack and new TTN need decodeUplink(input)

Actually, you can read the codec of LHT65N as a sample.

// TTNv2 to V4 converter
function decodeUplink(input) {
   return {
   data: Decoder(input.bytes, input.fPort)

function Decode(port, bytes) {  
    var temperature = (bytes[0] << 8 | bytes[1]) / 100;
    var humidity = bytes[2] << 8 | bytes[3];
    var pressure = (bytes[4] << 8 | bytes[5]) / 100;
    var ill= bytes[6] << 8 | bytes[7];
    var UVA = bytes[8] << 8 | bytes[9];
    var UVB = bytes[10] << 8 | bytes[11];
    var UV_Index= bytes[12] << 8 | bytes[13]; 
return {
        temperature: temperature,
        humidity: humidity,
        pressure: pressure, 
        illumination: ill,
        UVA: UVA, 
        UVB: UVB, 
        UV_Index: UV_Index 
1 Like

Kevin! You’re a genius!

When I first inserted the LHT65N code snippet, it did NOT work…

Then I realized the decodeUplink header:

function decodeUplink(input) {
   return {
   data: Decoder(input.bytes, input.fPort)

It was still in Chirp V3…

I changed it to:

function decodeUplink(input) {
        return { 
            data: Decode(input.fPort, input.bytes, input.variables)

Magically, this appears in the device profile!

The CODEC error is gone, and all is well!

Thank you, and thanks also to SP193 for being patient with me and working with me to success. I have three Arduino MKRWAN 1310s collecting dust in a box for two years, and they can finally be integrated.

I may have some other problems down the road, but this one was a major roadblock that’s now resolved.



This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.