# The Things Node - Cayenne

**URL:** <https://www.thethingsnetwork.org/forum/t/the-things-node-cayenne/12012>\
**Category:** End Devices (Nodes)\
**Created:** [January 24, 2018, 8:14pm UTC](https://www.thethingsnetwork.org/forum/t/the-things-node-cayenne/12012 "2018-01-24T20:14:34Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![patmolloy](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/patmolloy/32/35697_2.png) [@patmolloy](https://www.thethingsnetwork.org/forum/u/patmolloy)\
**Post date:** [January 24, 2018, 8:14pm UTC](https://www.thethingsnetwork.org/forum/t/the-things-node-cayenne/12012/1 "2018-01-24T20:14:34Z")

</div>

Has anyone tried to get the Cayenne Integration working with the Things Node … I just posted this in the Cayenne forum …

> **[TTN (The Things Network) - The Things Node](https://community.mydevices.com/t/ttn-the-things-network-the-things-node/7375?u=pat.molloy)**
>
> Hi, I just received my bundle of devices from The Things Network. Gateway is up and running as well as my “The Things Node”. Was trying the Cayenne Integration. I am only seeing the meta-data coming across (RSSI & SNR) but not the 4 fields of actual...

---

<div class="post-metadata">

**Author:** ![BoRRoZ](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/borroz/32/44234_2.png) [@BoRRoZ](https://www.thethingsnetwork.org/forum/u/BoRRoZ)\
**Post date:** [January 24, 2018, 8:19pm UTC](https://www.thethingsnetwork.org/forum/t/the-things-node-cayenne/12012/2 "2018-01-24T20:19:07Z")

</div>

did you load the basic sketch in the TTN node

---

<div class="post-metadata">

**Author:** ![patmolloy](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/patmolloy/32/35697_2.png) [@patmolloy](https://www.thethingsnetwork.org/forum/u/patmolloy)\
**Post date:** [January 24, 2018, 8:22pm UTC](https://www.thethingsnetwork.org/forum/t/the-things-node-cayenne/12012/3 "2018-01-24T20:22:50Z")

</div>

Yes, that’s what I’m running!

---

<div class="post-metadata">

**Author:** ![BoRRoZ](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/borroz/32/44234_2.png) [@BoRRoZ](https://www.thethingsnetwork.org/forum/u/BoRRoZ)\
**Post date:** [January 24, 2018, 8:26pm UTC](https://www.thethingsnetwork.org/forum/t/the-things-node-cayenne/12012/4 "2018-01-24T20:26:40Z")

</div>

you should run the (edited) CayenneLPP sketch

---

<div class="post-metadata">

**Author:** ![patmolloy](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/patmolloy/32/35697_2.png) [@patmolloy](https://www.thethingsnetwork.org/forum/u/patmolloy)\
**Post date:** [January 24, 2018, 8:29pm UTC](https://www.thethingsnetwork.org/forum/t/the-things-node-cayenne/12012/5 "2018-01-24T20:29:43Z")

</div>

Thanks!! I am relatively new to all this - how do I do that please?

Pat

---

<div class="post-metadata">

**Author:** ![BoRRoZ](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/borroz/32/44234_2.png) [@BoRRoZ](https://www.thethingsnetwork.org/forum/u/BoRRoZ)\
**Post date:** [January 24, 2018, 8:34pm UTC](https://www.thethingsnetwork.org/forum/t/the-things-node-cayenne/12012/6 "2018-01-24T20:34:00Z")

</div>

obvious first question : do you have an Cayenne account ?

if not create one [here](https://cayenne.mydevices.com/cayenne/signup)

---

<div class="post-metadata">

**Author:** ![BoRRoZ](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/borroz/32/44234_2.png) [@BoRRoZ](https://www.thethingsnetwork.org/forum/u/BoRRoZ)\
**Post date:** [January 24, 2018, 8:42pm UTC](https://www.thethingsnetwork.org/forum/t/the-things-node-cayenne/12012/7 "2018-01-24T20:42:20Z")

</div>

I can confirm its fully integrated, with a few clicks you see your dashboard

![ttn-nodeCayenne](https://www.thethingsnetwork.org/forum/uploads/default/original/2X/4/4698187286f3b35dd913991afe56d262facca75c.jpg)

[see](https://cayenne.mydevices.com/shared/5a68f1269802217512740fe0) temp demo

oh and the graph is working fine to 🙂

![cayenne-tempgraphdemo](https://www.thethingsnetwork.org/forum/uploads/default/original/2X/4/4a6ecea88ffd67586d2fefb62c0fa9da37dc99ef.jpg)

---

<div class="post-metadata">

**Author:** ![patmolloy](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/patmolloy/32/35697_2.png) [@patmolloy](https://www.thethingsnetwork.org/forum/u/patmolloy)\
**Post date:** [January 24, 2018, 9:50pm UTC](https://www.thethingsnetwork.org/forum/t/the-things-node-cayenne/12012/9 "2018-01-24T21:50:15Z")

</div>

Yes, have been using Cayenne on other devices and also with the MicroChip LoRa Mote with no problems so at a basic level I get it. I just expected the Things Node to work without any fiddling 🙂 It’s the fiddling bit I am not clear on.

I can see my Things Node in Cayenne, but all I see is RSSI and SNR and Location. None of sensors.

Thanks so much for your help!

Pat

---

<div class="post-metadata">

**Author:** ![patmolloy](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/patmolloy/32/35697_2.png) [@patmolloy](https://www.thethingsnetwork.org/forum/u/patmolloy)\
**Post date:** [January 24, 2018, 9:57pm UTC](https://www.thethingsnetwork.org/forum/t/the-things-node-cayenne/12012/10 "2018-01-24T21:57:43Z")

</div>

Ok, so I need to modify the sketch that runs on the Node to use LPP?

If’ you’ve done it, are you willing to share?

Pat

---

<div class="post-metadata">

**Author:** ![BoRRoZ](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/borroz/32/44234_2.png) [@BoRRoZ](https://www.thethingsnetwork.org/forum/u/BoRRoZ)\
**Post date:** [January 24, 2018, 10:06pm UTC](https://www.thethingsnetwork.org/forum/t/the-things-node-cayenne/12012/11 "2018-01-24T22:06:38Z")

</div>

use the CayenneLPP sketch

and edit 3 things :

![editedsketchCayeneLPP](https://www.thethingsnetwork.org/forum/uploads/default/original/2X/1/16c8a2417be6ab5cc420c3940e7c2645bc0fd8b6.jpg)

log in to Cayenne and select The Things node (you need the device id to register )

---

<div class="post-metadata">

**Author:** ![patmolloy](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/patmolloy/32/35697_2.png) [@patmolloy](https://www.thethingsnetwork.org/forum/u/patmolloy)\
**Post date:** [January 24, 2018, 10:19pm UTC](https://www.thethingsnetwork.org/forum/t/the-things-node-cayenne/12012/12 "2018-01-24T22:19:49Z")

</div>

Thanks! I completely follow, but the only CayenneLPP file I have is at Examples-\>TheThings **Network** -\>CayenneLPP

And it contains only this (below) … i.e. knows nothing about the Node ☹ I assume I need to weave the two files together (i.e. the CayenneLPP and Examples-\>TheThings **Node-** \>Basic.

> #include \<TheThingsNetwork.h\>  
> #include \<CayenneLPP.h\>
> 
> // Set your AppEUI and AppKey  
> const char \*appEui = “0000000000000000”;  
> const char \*appKey = “00000000000000000000000000000000”;
> 
> #define loraSerial Serial1  
> #define debugSerial Serial
> 
> // Replace REPLACE\_ME with TTN\_FP\_EU868 or TTN\_FP\_US915  
> #define freqPlan REPLACE\_ME
> 
> TheThingsNetwork ttn(loraSerial, debugSerial, freqPlan);  
> CayenneLPP lpp(51);
> 
> void setup()  
> {  
> loraSerial.begin(57600);  
> debugSerial.begin(9600);
> 
> // Wait a maximum of 10s for Serial Monitor  
> while (!debugSerial && millis() \< 10000)  
> ;
> 
> debugSerial.println(“-- STATUS”);  
> ttn.showStatus();
> 
> debugSerial.println(“-- JOIN”);  
> ttn.join(appEui, appKey);  
> }
> 
> void loop()  
> {  
> debugSerial.println(“-- LOOP”);
> 
> lpp.reset();  
> lpp.addTemperature(1, 22.5);  
> lpp.addBarometricPressure(2, 1073.21);  
> lpp.addGPS(3, 52.37365, 4.88650, 2);
> 
> // Send it off  
> ttn.sendBytes(lpp.getBuffer(), lpp.getSize());
> 
> delay(10000);  
> }

---

<div class="post-metadata">

**Author:** ![BoRRoZ](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/borroz/32/44234_2.png) [@BoRRoZ](https://www.thethingsnetwork.org/forum/u/BoRRoZ)\
**Post date:** [January 24, 2018, 10:24pm UTC](https://www.thethingsnetwork.org/forum/t/the-things-node-cayenne/12012/13 "2018-01-24T22:24:53Z")

</div>

ah ok

install the things node library … comes with the CayenneLPP example

![ttn node lib](https://www.thethingsnetwork.org/forum/uploads/default/original/2X/b/b906715357aabc6a5afe3585b39af6281a10af51.jpg)

![ttn node lib 2](https://www.thethingsnetwork.org/forum/uploads/default/original/2X/c/c7f01e5100a3d55cab0efa680fd99fa759ff60e1.jpg)

---

<div class="post-metadata">

**Author:** ![patmolloy](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/patmolloy/32/35697_2.png) [@patmolloy](https://www.thethingsnetwork.org/forum/u/patmolloy)\
**Post date:** [January 24, 2018, 10:28pm UTC](https://www.thethingsnetwork.org/forum/t/the-things-node-cayenne/12012/14 "2018-01-24T22:28:05Z")

</div>

You are _very_ patient. Thank you 🙂 I _thought_ I had done that … but will give it another go!!

Pat

---

<div class="post-metadata">

**Author:** ![patmolloy](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/patmolloy/32/35697_2.png) [@patmolloy](https://www.thethingsnetwork.org/forum/u/patmolloy)\
**Post date:** [January 24, 2018, 10:33pm UTC](https://www.thethingsnetwork.org/forum/t/the-things-node-cayenne/12012/15 "2018-01-24T22:33:25Z")

</div>

Yeah - it _is_ installed ☹ This is what I see … no CayenneLPP in TheThingsNode library.

![image](https://www.thethingsnetwork.org/forum/uploads/default/original/2X/a/a045315cb79919cf2764eb8eb94cb904c4079940.jpg)

![image](https://www.thethingsnetwork.org/forum/uploads/default/original/2X/9/92313b1ca6381bb6dffc54cc160ff1b79650dbf0.jpg)

---

<div class="post-metadata">

**Author:** ![BoRRoZ](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/borroz/32/44234_2.png) [@BoRRoZ](https://www.thethingsnetwork.org/forum/u/BoRRoZ)\
**Post date:** [January 24, 2018, 10:37pm UTC](https://www.thethingsnetwork.org/forum/t/the-things-node-cayenne/12012/16 "2018-01-24T22:37:53Z")

</div>

I can’t read your screenshot… must be my old eyes 😉

![TTN lib 3](https://www.thethingsnetwork.org/forum/uploads/default/original/2X/3/3a8b6f6daeb91a7c36971c3aecf3e111817da2a2.jpg)

maybe click and update the lib version ?

![TTN lib 4](https://www.thethingsnetwork.org/forum/uploads/default/original/2X/0/074b4087e9c24bec1d8875658d1b216e2538b674.jpg)

---

<div class="post-metadata">

**Author:** ![patmolloy](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/patmolloy/32/35697_2.png) [@patmolloy](https://www.thethingsnetwork.org/forum/u/patmolloy)\
**Post date:** [January 24, 2018, 10:41pm UTC](https://www.thethingsnetwork.org/forum/t/the-things-node-cayenne/12012/17 "2018-01-24T22:41:30Z")

</div>

Very very odd. Sorry for the wild goose chase. I will go hunting. I did update the lib. Will fool around before asking any more 🙂 Thanks a million.

---

<div class="post-metadata">

**Author:** ![BoRRoZ](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/borroz/32/44234_2.png) [@BoRRoZ](https://www.thethingsnetwork.org/forum/u/BoRRoZ)\
**Post date:** [January 24, 2018, 10:48pm UTC](https://www.thethingsnetwork.org/forum/t/the-things-node-cayenne/12012/18 "2018-01-24T22:48:39Z")

</div>

**TTN node CayenneLPP** :

```cpp
#include <TheThingsNode.h>
#include <CayenneLPP.h>

// Set your AppEUI and AppKey
const char *appEui = "0000000000000000";
const char *appKey = "00000000000000000000000000000000";

#define loraSerial Serial1
#define debugSerial Serial

// Replace REPLACE_ME with TTN_FP_EU868 or TTN_FP_US915
#define freqPlan REPLACE_ME

TheThingsNetwork ttn(loraSerial, debugSerial, freqPlan);
TheThingsNode *node;
CayenneLPP lpp(51);

#define PORT_SETUP 1
#define PORT_INTERVAL 2
#define PORT_MOTION 3
#define PORT_BUTTON 4

void setup()
{
  loraSerial.begin(57600);
  debugSerial.begin(9600);

  // Wait a maximum of 10s for Serial Monitor
  while (!debugSerial && millis() < 10000)
    ;

  // Config Node
  node = TheThingsNode::setup();
  node->configLight(true);
  node->configInterval(true, 60000);
  node->configTemperature(true);
  node->onWake(wake);
  node->onInterval(interval);
  node->onSleep(sleep);
  node->onMotionStart(onMotionStart);
  node->onButtonRelease(onButtonRelease);

  // Test sensors and set LED to GREEN if it works
  node->showStatus();
  node->setColor(TTN_GREEN);

  debugSerial.println("-- TTN: STATUS");
  ttn.showStatus();

  debugSerial.println("-- TTN: JOIN");
  ttn.join(appEui, appKey);

  debugSerial.println("-- SEND: SETUP");
  sendData(PORT_SETUP);
}

void loop()
{
  node->loop();
}

void interval()
{
  node->setColor(TTN_BLUE);

  debugSerial.println("-- SEND: INTERVAL");
  sendData(PORT_INTERVAL);
}

void wake()
{
  node->setColor(TTN_GREEN);
}

void sleep()
{
  node->setColor(TTN_BLACK);
}

void onMotionStart()
{
  node->setColor(TTN_BLUE);

  debugSerial.print("-- SEND: MOTION");
  sendData(PORT_MOTION);
}

void onButtonRelease(unsigned long duration)
{
  node->setColor(TTN_BLUE);

  debugSerial.print("-- SEND: BUTTON");
  debugSerial.println(duration);

  sendData(PORT_BUTTON);
}

void sendData(uint8_t port)
{
  printSensors();

  lpp.reset();
  lpp.addDigitalInput(1, node->isButtonPressed());
  lpp.addDigitalInput(2, node->isUSBConnected());
  lpp.addDigitalInput(3, node->isMoving());
  lpp.addAnalogInput(4, node->getBattery()/1000.0);
  lpp.addTemperature(5, node->getTemperatureAsFloat());
  lpp.addLuminosity(6, node->getLight());
  
  float x,y,z;
  node->getAcceleration(&x, &y, &z);
  lpp.addAccelerometer(7, x, y, z);
  
  ttn.sendBytes(lpp.getBuffer(), lpp.getSize());
}

void printSensors()
{
  debugSerial.println();
  debugSerial.println("SENSORS:");
  debugSerial.println("--------");
  
  debugSerial.print("LED Colour:\t");
  debugSerial.println(node->colorToString(node->getColor()));

  debugSerial.print("Temperature:\t");
  debugSerial.print(node->getTemperatureAsFloat());
  debugSerial.println("°C");

  debugSerial.print("Light Sensor:\t");
  debugSerial.print(node->getLight());
  debugSerial.println("lux");
  
  debugSerial.print("Moving now:\t");
  if(node->isMoving())
  {
    debugSerial.println("yes");
  }
  else
  {
    debugSerial.println("no");
  }
  
  debugSerial.print("Button pressed:\t");
  if(node->isButtonPressed())
  {
    debugSerial.println("yes");
  }
  else
  {
    debugSerial.println("no");
  }

  debugSerial.print("USB connected:\t");
  if(node->isUSBConnected())
  {
    debugSerial.println("yes");
  }
  else
  {
    debugSerial.println("no");
  }

  debugSerial.print("Battery:\t");
  debugSerial.print(node->getBattery());
  debugSerial.println("mV");

  float x,y,z;
  node->getAcceleration(&x, &y, &z);

  debugSerial.print("Acceleration:\tx=");
  debugSerial.print(x);
  debugSerial.print("g\n\t\ty=");
  debugSerial.print(y);
  debugSerial.print("g\n\t\tz=");
  debugSerial.print(z);
  debugSerial.println("g");

  debugSerial.println("--------");
  debugSerial.println();
  
}

```

---

<div class="post-metadata">

**Author:** ![patmolloy](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/patmolloy/32/35697_2.png) [@patmolloy](https://www.thethingsnetwork.org/forum/u/patmolloy)\
**Post date:** [January 24, 2018, 10:51pm UTC](https://www.thethingsnetwork.org/forum/t/the-things-node-cayenne/12012/19 "2018-01-24T22:51:40Z")

</div>

Fab 🙂

I just found it in the Github repo too … definitely not in my examples!

Compiling now!

Pat

---

<div class="post-metadata">

**Author:** ![patmolloy](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/patmolloy/32/35697_2.png) [@patmolloy](https://www.thethingsnetwork.org/forum/u/patmolloy)\
**Post date:** [January 24, 2018, 11:15pm UTC](https://www.thethingsnetwork.org/forum/t/the-things-node-cayenne/12012/20 "2018-01-24T23:15:15Z")

</div>

Woop !!

![image](https://www.thethingsnetwork.org/forum/uploads/default/original/2X/5/50d186abc4128c0d00edaa16bb978acff419e80d.png)

Some definite odd stuff with my libraries … now apparently fixed and worked instantly.

Cannot thank you enough for all your help!

Now for a few hours on my _day_ job 🙂

Pat

---

<div class="post-metadata">

**Author:** ![patmolloy](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/patmolloy/32/35697_2.png) [@patmolloy](https://www.thethingsnetwork.org/forum/u/patmolloy)\
**Post date:** [January 24, 2018, 11:20pm UTC](https://www.thethingsnetwork.org/forum/t/the-things-node-cayenne/12012/21 "2018-01-24T23:20:17Z")

</div>

This is better 🙂

> {  
> “accelerometer\_7”: {  
> “x”: -0.063,  
> “y”: -0.008,  
> “z”: -0.969  
> },  
> “analog\_in\_4”: 4.74,  
> “digital\_in\_1”: 0,  
> “digital\_in\_2”: 1,  
> “digital\_in\_3”: 0,  
> “luminosity\_6”: 28,  
> “temperature\_5”: 25.7  
> }

[Next page](https://www.thethingsnetwork.org/forum/t/the-things-node-cayenne/12012.md?page=2)
