disk91/WioLoRaWANFieldTester

TTN webhook configuration for WioLoRaWANFieldTester

Opened this issue · 2 comments

Dear community,

Thank you for working on WioLoRaWANFieldTester.
I am a newbie in LoRaWAN, so pardon my ignorance.

I purchased a WioLoRaWANFieldTester field tester with battery from seeed.
i am only interested in TTN, not Helium.

After reinstalling firmware and setting GPS to 9600bds, I could register on my TTN Gateway and GPS worked. After long hours of testing I cannot upload any information.

I followed the instructions on the wiki, unfortunately, I don't understand how to set-up TTN payload formatters. I followed the instructions on the wiki without adding any formatters, unfortunately it replies "impossible to decode data". So I need to decode data ...

I found this webhook code and used it:

function Decoder(bytes, port) { 
  var decoded = {};
  
  if ( port != 1 ) return decoded;
  
  var lonSign = (bytes[0]>>7) & 0x01 ? -1 : 1;
  var latSign = (bytes[0]>>6) & 0x01 ? -1 : 1;
  
  var encLat = ((bytes[0] & 0x3f)<<17)+
               (bytes[1]<<9)+
               (bytes[2]<<1)+
               (bytes[3]>>7);

  var encLon = ((bytes[3] & 0x7f)<<16)+
               (bytes[4]<<8)+
               bytes[5];
  
  var hdop = bytes[8]/10;
  var sats = bytes[9];
  
  const maxHdop = 2;
  const minSats = 5;
  
  if ((hdop < maxHdop) && (sats >= minSats)) {
    // Send only acceptable quality of position to mappers
    decoded.latitude = latSign * (encLat * 108 + 53) / 10000000;
    decoded.longitude = lonSign * (encLon * 215 + 107) / 10000000;  
    decoded.altitude = ((bytes[6]<<8)+bytes[7])-1000;
    decoded.accuracy = (hdop*5+5)/10
    decoded.hdop = hdop;
    decoded.sats = sats;
  } else {
    decoded.error = "Need more GPS precision (hdop must be <"+maxHdop+
      " & sats must be >= "+minSats+") current hdop: "+hdop+" & sats:"+sats;
  }

  return decoded;
}

Also I wonder whether it is possible to use an experimental project in TTN Mapper for TTN. Can I integrate directly wih TTN Mapper and not disk91. With the above script "decoded_payload": {}, so data never reaches TNT Mapper.

Please advise:

  1. Which TTN payload is needed ? Is the above webhook correct ?
  2. Can I upload directly to TNT mapper or should I use your backend?

Kind regards,
Ffries

The project, when connected to the backend dev.disk91.com automatically pushes the data to ttnmapper.
For the rest, read the setup guide for TTN

Thanks, closing the issue.