Seeeduino with cayenne

hello guys
i am having a problem with my seeeduino board ,
i am not receiving data to my cayenne dashboard

and am using this code

#include <LoRaWan.h>

#include <DHT.h>

#include <TheThingsNetwork.h>
#include <CayenneLPP.h>
#define DHTPIN A0 // the pin we're connected the temperature and humidity  sensor 
#define DHTTYPE DHT11   // DHT 11 
DHT dht(DHTPIN, DHTTYPE);
#define moisture A2 // the pin we're connected the moisture sensor 
int moistureval;

// Set your AppEUI and AppKey
const char *appEui = "xxxxxxxxxxx";
const char *appKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";


#define loraSerial SerialUSB
#define debugSerial SerialUSB

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

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


//define and int variables 
//unit16_t induval = 0;
uint16_t induVal = 0;
bool induState = false;
//uint16_t lightVal = 0;
//bool errorState = false;
uint16_t humidity = 0;
uint16_t temperature = 0;
//uint8_t addTemperature(uint8_t channel, float celsius);
//uint8_t addRelativeHumidity(uint8_t channel, float rh);








void setup()
{
  //loraSerial.begin(57600);
  //while(!SerialUSB);
  debugSerial.begin(115200);
  pinMode(moisture,INPUT);
  

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

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

  debugSerial.println("-- JOIN");
  ttn.join(appEui, appKey);
  dht.begin();
}

void loop()
{
  debugSerial.println("-- LOOP");
  debugSerial.println("----------------------------------");
  //ttn.showStatus();
  debugSerial.println();
  debugSerial.println("sensor information");
  debugSerial.println("----------------------------------");
  debugSerial.println("DATA");
  debugSerial.println();

  





  
   temperature =dht.readTemperature()*100 ;
   humidity =dht.readHumidity()*100;
   moistureval = analogRead(moisture);


  debugSerial.print("Temperature");
  debugSerial.println("Temperature");
  debugSerial.print("Humidity");
  debugSerial.println("Humidity");
  debugSerial.print("moisture");
  debugSerial.println("moisture");

  
//
 float t = temperature;
 float h = humidity;




  
 
  lpp.reset();
  lpp.addTemperature(1, t);
  lpp.addRelativeHumidity(2,h );
//  lpp.addmoisture(3, m);
  
  //lpp.addBarometricPressure(2, 1073.21);
  //lpp.addGPS(3, 52.37365, 4.88650, 2);

debugSerial.println("payload");
    byte payload[4]={0};
    
    payload[0] = highByte(temperature);
    payload[1] = lowByte(temperature);
    payload[2] = highByte(humidity);
    payload[3] = lowByte(humidity);
   // payload[4] = highByte(moistureval);
   // payload[5] = lowByte(moistureval);



   int loop;
   for(loop=0; loop < 4; loop++)
   debugSerial.println(payload[loop]);
   











  

  // Send it off
 // ttn.sendBytes(lpp.getBuffer(), lpp.getSize());
   //  SerialUSB.print("Temperature: "+String (temperature));
   //SerialUSB.print("humidity: "+String (humidity));
   ttn.sendBytes(payload, sizeof(payload));

   debugSerial.println();

  delay(10000);
}

i need help please

you are manually sending raw data and not in cayenne lPP format.

debugSerial.println("payload");
byte payload[4]={0};

payload[0] = highByte(temperature);
payload[1] = lowByte(temperature);
payload[2] = highByte(humidity);
payload[3] = lowByte(humidity);
   // payload[4] = highByte(moistureval);
   // payload[5] = lowByte(moistureval);
   int loop;
   for(loop=0; loop < 4; loop++)
   debugSerial.println(payload[loop]);
  // Send it off
 // ttn.sendBytes(lpp.getBuffer(), lpp.getSize());
   //  SerialUSB.print("Temperature: "+String (temperature));
   //SerialUSB.print("humidity: "+String (humidity));
   ttn.sendBytes(payload, sizeof(payload)); 

replace the entire main function with:

void loop()
{
  debugSerial.println("-- LOOP");
 float t = temperature;
 float h = humidity;
  lpp.reset();
  lpp.addTemperature(1, t;
  lpp.addRelativeHumidity(2,h );

  // Send it off
  ttn.sendBytes(lpp.getBuffer(), lpp.getSize());

  delay(10000);
}

#include <LoRaWan.h>

#include <DHT.h>

#include <TheThingsNetwork.h>
#include <CayenneLPP.h>
#define DHTPIN A0 // the pin we’re connected the temperature and humidity sensor
#define DHTTYPE DHT11 // DHT 11
DHT dht(DHTPIN, DHTTYPE);
#define moisture A2 // the pin we’re connected the moisture sensor
int moistureval;

// Set your AppEUI and AppKey
const char *appEui = “70B3D57ED00221E0”;
const char *appKey = “71C0CEF60AF960DADB0C51287B5E56A4”;

#define loraSerial SerialUSB
#define debugSerial SerialUSB

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

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

//define and int variables
//unit16_t induval = 0;
uint16_t induVal = 0;
bool induState = false;
//uint16_t lightVal = 0;
//bool errorState = false;
uint16_t humidity = 0;
uint16_t temperature = 0;
//uint8_t addTemperature(uint8_t channel, float celsius);
//uint8_t addRelativeHumidity(uint8_t channel, float rh);

void setup()
{
//loraSerial.begin(57600);
//while(!SerialUSB);
debugSerial.begin(115200);
pinMode(moisture,INPUT);

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

debugSerial.println(“-- STATUS”);
ttn.showStatus();

debugSerial.println(“-- JOIN”);
ttn.join(appEui, appKey);
dht.begin();
}

void loop()
{
debugSerial.println(“-- LOOP”);
debugSerial.println(“----------------------------------”);
//ttn.showStatus();
debugSerial.println();
debugSerial.println(“sensor information”);
debugSerial.println(“----------------------------------”);
debugSerial.println(“DATA”);
debugSerial.println();

temperature =dht.readTemperature()*100 ;
humidity =dht.readHumidity()*100;
moistureval = analogRead(moisture);

debugSerial.print(“Temperature”);
debugSerial.println(“Temperature”);
debugSerial.print(“Humidity”);
debugSerial.println(“Humidity”);
debugSerial.print(“moisture”);
debugSerial.println(“moisture”);

//
// float t = temperature;
// float h = humidity;

// lpp.reset();
// lpp.addTemperature(1, t);
// lpp.addRelativeHumidity(2,h );
// lpp.addmoisture(3, m);

//lpp.addBarometricPressure(2, 1073.21);
//lpp.addGPS(3, 52.37365, 4.88650, 2);

void loop()
{
debugSerial.println(“-- LOOP”);
float t = temperature;
float h = humidity;
lpp.reset();
lpp.addTemperature(1, t);
lpp.addRelativeHumidity(2,h );

// Send it off
ttn.sendBytes(lpp.getBuffer(), lpp.getSize());

delay(10000);
}

how can there be two main loops?

its have to be like this?
#include <LoRaWan.h>

#include <DHT.h>

#include <TheThingsNetwork.h>
#include <CayenneLPP.h>
#define DHTPIN A0 // the pin we’re connected the temperature and humidity sensor
#define DHTTYPE DHT11 // DHT 11
DHT dht(DHTPIN, DHTTYPE);
#define moisture A2 // the pin we’re connected the moisture sensor
int moistureval;

// Set your AppEUI and AppKey
const char *appEui = “70B3D57ED00221E0”;
const char *appKey = “71C0CEF60AF960DADB0C51287B5E56A4”;

#define loraSerial SerialUSB
#define debugSerial SerialUSB

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

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

//define and int variables
//unit16_t induval = 0;
uint16_t induVal = 0;
bool induState = false;
//uint16_t lightVal = 0;
//bool errorState = false;
uint16_t humidity = 0;
uint16_t temperature = 0;
//uint8_t addTemperature(uint8_t channel, float celsius);
//uint8_t addRelativeHumidity(uint8_t channel, float rh);

void setup()
{
//loraSerial.begin(57600);
//while(!SerialUSB);
debugSerial.begin(115200);
pinMode(moisture,INPUT);

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

debugSerial.println(“-- STATUS”);
ttn.showStatus();

debugSerial.println(“-- JOIN”);
ttn.join(appEui, appKey);
dht.begin();
}

void loop()
{
debugSerial.println(“-- LOOP”);
float t = temperature;
float h = humidity;
lpp.reset();
lpp.addTemperature(1, t);
lpp.addRelativeHumidity(2,h );

// Send it off
ttn.sendBytes(lpp.getBuffer(), lpp.getSize());

delay(10000);
}

yes, that looks fine.


i am getting this in the serial monitor
but on the cayenne side still nothing
https://cayenne.mydevices.com/cayenne/dashboard/lora/c07c3b40-d55e-11e9-a38a-d57172a4b4d4

why have you commented this?

sorry it was a mistake

i did uncomment it but still nothing

can you try this code:

#include "DHT.h"
#include <CayenneLPP.h>

#define DHTPIN            2
#define DHTTYPE           DHT22
DHT dht(DHTPIN, DHTTYPE);
unsigned char data[2] = {1, 2};
char buffer[256];
CayenneLPP lpp(51);

void setup(void)
{
  dht.begin();

  SerialUSB.begin(115200);
  //while(!SerialUSB);

  lora.init();

  memset(buffer, 0, 256);
  lora.getVersion(buffer, 256, 1);
  SerialUSB.print(buffer);

  memset(buffer, 0, 256);
  lora.getId(buffer, 256, 1);
  SerialUSB.print(buffer);

  lora.setKey("2B7E151628AED2A6ABF7158809CF4F3C", "2B7E151628AED2A6ABF7158809CF4F3C", "2B7E151628AED2A6ABF7158809CF4F3C");

  lora.setDeciveMode(LWABP);
  lora.setDataRate(DR0, EU868);

  lora.setChannel(0, 867.7);
  lora.setChannel(1, 867.9);
  lora.setChannel(2, 868.8);

  lora.setReceiceWindowFirst(0, 867.7);
  lora.setReceiceWindowSecond(869.5, DR3);

  lora.setDutyCycle(false);
  lora.setJoinDutyCycle(false);

  lora.setPower(14);
}

void loop(void)
{
  bool result = false;

  delay(10000);
  int h = dht.readHumidity();
  int t = dht.readTemperature();
  lpp.reset();
  lpp.addTemperature(1, t);
  lpp.addBarometricPressure(2, h);
  
  result = lora.transferPacket(lpp.getBuffer(), lpp.getSize(), 10);

  if (result)
  {
    short length;
    short rssi;

    memset(buffer, 0, 256);
    length = lora.receivePacket(buffer, 256, &rssi);

    if (length)
    {
      SerialUSB.print("Length is: ");
      SerialUSB.println(length);
      SerialUSB.print("RSSI is: ");
      SerialUSB.println(rssi);
      SerialUSB.print("Data is: ");
      for (unsigned char i = 0; i < length; i ++)
      {
        SerialUSB.print("0x");
        SerialUSB.print(buffer[i], HEX);
        SerialUSB.print(" ");
      }
      SerialUSB.println();
    }
  }
}```

#include <LoRaWan.h>

#include <DHT.h>

#include <CayenneLPP.h>
#define DHTPIN A0 // the pin we’re connected the temperature and humidity sensor

#define DHTTYPE DHT11 // DHT 11
DHT dht(DHTPIN, DHTTYPE);

unsigned char data[2] = {1, 2};
char buffer[256];
CayenneLPP lpp(51);

void setup(void)
{
dht.begin();

SerialUSB.begin(115200);
//while(!SerialUSB);

lora.init();

memset(buffer, 0, 256);
lora.getVersion(buffer, 256, 1);
SerialUSB.print(buffer);

memset(buffer, 0, 256);
lora.getId(buffer, 256, 1);
SerialUSB.print(buffer);

// void setID( char *DevAddr, char *DevEUI, char *AppEUI);
// lora.setId(NULL, “F9C01FAA68E1D265” , “70B3D57ED00210F4”);
//setKey(char *NwKSKey, char *AppSKey, char *AppKey);
// lora.setKey(NULL, NULL, “3FB33E70EECACFB206D4589FFD44980E”);

lora.setKey(“2B7E151628AED2A6ABF7158809CF4F3C”, “2B7E151628AED2A6ABF7158809CF4F3C”, “2B7E151628AED2A6ABF7158809CF4F3C”);

lora.setDeciveMode(LWOTAA);
lora.setDataRate(DR0, EU868);

lora.setChannel(0, 867.7);
lora.setChannel(1, 867.9);
lora.setChannel(2, 868.8);

lora.setReceiceWindowFirst(0, 867.7);
lora.setReceiceWindowSecond(869.5, DR3);

lora.setDutyCycle(false);
lora.setJoinDutyCycle(false);

lora.setPower(14);
}

void loop(void)
{
bool result = false;

delay(10000);
int h = dht.readHumidity();
int t = dht.readTemperature();
lpp.reset();
lpp.addTemperature(1, t);
lpp.addBarometricPressure(2, h);

result = lora.transferPacket(lpp.getBuffer(), lpp.getSize(), 10);

if (result)
{
short length;
short rssi;

memset(buffer, 0, 256);
length = lora.receivePacket(buffer, 256, &rssi);

if (length)
{
  SerialUSB.print("Length is: ");
  SerialUSB.println(length);
  SerialUSB.print("RSSI is: ");
  SerialUSB.println(rssi);
  SerialUSB.print("Data is: ");
  for (unsigned char i = 0; i < length; i ++)
  {
    SerialUSB.print("0x");
    SerialUSB.print(buffer[i], HEX);
    SerialUSB.print(" ");
  }
  SerialUSB.println();
}

}
}

https://cayenne.mydevices.com/shared/5d7b5a4633ed91791a67ad39

you need to set this to your keys.

hello sir

the AppKey = setkey?

lora.setKey(NULL, NULL, "appkey");

i did with my own

#include <LoRaWan.h>

#include <DHT.h>

#include <CayenneLPP.h>
#define DHTPIN A0 // the pin we’re connected the temperature and humidity sensor

#define DHTTYPE DHT11 // DHT 11
DHT dht(DHTPIN, DHTTYPE);

unsigned char data[2] = {1, 2};
char buffer[256];
CayenneLPP lpp(51);

void setup(void)
{
dht.begin();

SerialUSB.begin(115200);
//while(!SerialUSB);

lora.init();

memset(buffer, 0, 256);
lora.getVersion(buffer, 256, 1);
SerialUSB.print(buffer);

memset(buffer, 0, 256);
lora.getId(buffer, 256, 1);
SerialUSB.print(buffer);

// void setID( char *DevAddr, char *DevEUI, char *AppEUI);
// lora.setId(NULL, “F9C01FAA68E1D265” , “70B3D57ED00210F4”);
//setKey(char *NwKSKey, char *AppSKey, char *AppKey);
// lora.setKey(NULL, NULL, “3FB33E70EECACFB206D4589FFD44980E”);

lora.setKey(“3FB33E70EECACFB206D4589FFD44980E”, “3FB33E70EECACFB206D4589FFD44980E”, “3FB33E70EECACFB206D4589FFD44980E”);

lora.setDeciveMode(LWOTAA);
lora.setDataRate(DR0, EU868);

lora.setChannel(0, 867.7);
lora.setChannel(1, 867.9);
lora.setChannel(2, 868.8);

lora.setReceiceWindowFirst(0, 867.7);
lora.setReceiceWindowSecond(869.5, DR3);

lora.setDutyCycle(false);
lora.setJoinDutyCycle(false);

lora.setPower(14);
}

void loop(void)
{
bool result = false;

delay(10000);
int h = dht.readHumidity();
int t = dht.readTemperature();
lpp.reset();
lpp.addTemperature(1, t);
lpp.addBarometricPressure(2, h);

result = lora.transferPacket(lpp.getBuffer(), lpp.getSize(), 10);

if (result)
{
short length;
short rssi;

memset(buffer, 0, 256);
length = lora.receivePacket(buffer, 256, &rssi);

if (length)
{
  SerialUSB.print("Length is: ");
  SerialUSB.println(length);
  SerialUSB.print("RSSI is: ");
  SerialUSB.println(rssi);
  SerialUSB.print("Data is: ");
  for (unsigned char i = 0; i < length; i ++)
  {
    SerialUSB.print("0x");
    SerialUSB.print(buffer[i], HEX);
    SerialUSB.print(" ");
  }
  SerialUSB.println();
}

}
}

still the same problem

@shramik_salgaonkar did i well set up the cayenne dashboard?

if you see the serial monitor output, it clearly states that you are having issue connecting to the network.

you have still kept the same.