ThingSpeak and Things Stack for LoRaWan Connected Devices

Christopher Stapels on 26 May 2021
Latest activity Reply by Christopher Stapels on 8 Jun 2021

ThingSpeak includes an integration with The Things Stack to support collection of data over a long range network. I made a short presentation for this upcoming conference that shows you how to add the ThingSpeak integration to your Things Stack project. The agenda seems to be filled with other useful IoT talks. Here is the information on the conference:

Discover the next-generation #LoRaWAN deployments at The Things Stack Conference. Explore advanced LoRaWAN features, cloud integrations and the next-generation #IoT devices at #TheThingsConference - TheThings Stack Edition, online on 28 May 2021!

Registrations are now open: – ow.ly/I1PZ30mNt0I

#TheThingsConference #TheThingsNetwork #LoRaWAN

If you go and see something you like, please feel free to share in this discussion.

Guo Chang Man
Guo Chang Man on 8 Jun 2021 (Edited on 8 Jun 2021)

Hi Christopher,

Thanks for the video.

I'm modifying from the sample shown in your video (3:53) to upload battery data to ThingSpeak channel.

function decodeUplink(input) {
  var b = input.bytes;
  var battery = (b[0] << 8) | b[1];
  return {
    field1: battery
  };
}

Did I get it wrong? Seems like I'm unable to send anything over, and the Test Decoder tool shows this "{}".

After changing to the following (reference to documentation):

function decodeUplink(input) {
  var data = {}
  var b = input.bytes;
  data.field1 = (b[0] << 8) | b[1];
  return {
    data: data
  };
}

I got this from the Test Decoder tool:

{
  "field1": 3876
}

I do see entries in ThingSpeak channel, but the data field appears to be empty or invalid.

Could you advise?

Thanks.

Regards, GC

Christopher Stapels
Christopher Stapels on 8 Jun 2021

Thanks for sharing your code. I'm not totally clear what the issue is. I know the code I show in the video works for my channel. Ill try sending data from the functions you shared to my channel and see what is happening.

Guo Chang Man
Guo Chang Man on 8 Jun 2021

Hi Christopher,

Thanks for your response. Your video is really helpful. I've managed to get it working using this code:

function decodeUplink(input) {
  var data = {}
  var b = input.bytes;
  data.field1 = (b[0] << 8) | b[1];
  return {
    data: data
  };
}

Regards, GC

Christopher Stapels
Christopher Stapels on 8 Jun 2021

Ill have to fix the video. It seems my working decoder is coming from an old v2 application. Thanks for sharing and helping me get it right!

Christopher Stapels
Christopher Stapels on 2 Jun 2021 (Edited on 2 Jun 2021)

The conference is over, but you can still see the video I created. All the other interesting talks at the conference are also available.

Guo Chang Man
Guo Chang Man on 8 Jun 2021

Excellent video!