LinkNode R4 (ESP8266-12F) WDT reset loop when Cayenne sketch loaded

Hey folks, I purchased a LinkNode R4 and would like to use it with Cayenne, but when I load on the cayenne sketch it just does wdt reset loop.

ets Jan 8 2013,rst cause:4, boot mode:(3,7)

wdt reset
load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v3de0c112
~ld

The sketch I used:
/*
Cayenne WiFi Example

This sketch connects to the Cayenne server using an Arduino WiFi shield
and runs the main communication loop.

The Cayenne Library is required to run this sketch. If you have not already done so you can install it from the Arduino IDE Library Manager.

Steps:
1. Set the token variable to match the Arduino token from the Dashboard.
2. Set the network name and password.
3. Compile and upload this sketch.

For Cayenne Dashboard widgets using digital or analog pins this sketch will automatically
send data on those pins to the Cayenne server. If the widgets use Virtual Pins, data
should be sent to those pins using virtualWrites. Examples for sending and receiving
Virtual Pin data are under the Basics folder.
*/

#define CAYENNE_DEBUG         // Uncomment to show debug messages
#define CAYENNE_PRINT Serial  // Comment this out to disable prints and save space
#include <CayenneWiFi.h>

// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = "xxxxxxxxxx";
// Your network name and password.
char ssid[] = "Telpage Bench";
char password[] = "xxxxxx";

void setup()
{
  Serial.begin(9600);
//  delay(1000);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(9, OUTPUT);
  digitalWrite(5, LOW);
  digitalWrite(6, LOW);
  digitalWrite(7, LOW);
  digitalWrite(9, LOW);
  Cayenne.begin(token, ssid, password);
}

void loop()
{
 //  while(!digitalRead(0)){    
//              //pulling gpio0 to gnd for few seconds resets the device due to wdt reset.
//  }
  Cayenne.run();
}

Any Ideas on what I can do? Other sketches work fine.

That sketch is not compatible. You need to use the ESP library. The following HowTo works for all ESPs.

Looks like a great little board.

Cheers,

Craig

Where do I get this ESP library? I installed the esp8266 board in the arduino IDE. and installed the cayenne library.

The Cayenne library includes the Blynk library which has support for the ESP. Just compile this sketch and see if it works for you:

#define CAYENNE_DEBUG         // Uncomment to show debug messages
#define CAYENNE_PRINT Serial  // Comment this out to disable prints and save space

#include "CayenneDefines.h"
#include "BlynkSimpleEsp8266.h"
#include "CayenneWiFiClient.h"

// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = "<your_token>";
// Your network name and password.
char ssid[] = "<your_ssid>";
char password[] = "<your_pwd>";

void setup()
{
  Serial.begin(9600);
  Cayenne.begin(token, ssid, password);
}

void loop()
{
  Cayenne.run();
}

Cheers,

Craig

Awesome! Thank you. Let me know if I should start a new thread for this question.
I got 1 relay added and working. But I need to add the other 3. When I try to add another in cayenne it just gives me the same code as the first one. How do I extend this for all four?
#define CAYENNE_DEBUG // Uncomment to show debug messages
#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space

#include "CayenneDefines.h"
#include "BlynkSimpleEsp8266.h"
#include "CayenneWiFiClient.h"
#define VIRTUAL_PIN 1
#define RELAY_DIGITAL_PIN 16


// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = "xxxxxxxxxxx";
// Your network name and password.
char ssid[] = "xxxxxxxxxx";
char password[] = "xxxxxxxxxxx";

void setup()
{
  // set digital pin to output
  pinMode(RELAY_DIGITAL_PIN, OUTPUT);

  Serial.begin(9600);
  Cayenne.begin(token, ssid, password);
}

CAYENNE_IN(VIRTUAL_PIN)
{
  // get value sent from dashboard
  int currentValue = getValue.asInt(); // 0 to 1

  // assuming you wire your relay as normally open
  if (currentValue == 0) {
    digitalWrite(RELAY_DIGITAL_PIN, HIGH);
  } else {
    digitalWrite(RELAY_DIGITAL_PIN, LOW);
  }
}


void loop()
{
  Cayenne.run();
}

Hi @modsbyus,

You actually don’t need virtual functions or pinmode settings, just use digital pins when creating your relay actuators, and Cayenne takes care of the rest.

You only need virtual pins if you are doing something fancy and need to do calculations or use a driver not natively supported by Cayenne.

Cheers,

Craig

Okay, I removed that widget and while recreating it, I chose digital instead of virtual. The sketch it gives me looks the same. Also, how do I change the part below to accommodate 4 relays?

// get value sent from dashboard
  int currentValue = getValue.asInt(); // 0 to 1

  // assuming you wire your relay as normally open
  if (currentValue == 0) {
    digitalWrite(RELAY_DIGITAL_PIN, HIGH);
  } else {
    digitalWrite(RELAY_DIGITAL_PIN, LOW);
  }
}

I found the solution Here
Thanks for all your help! Its very nice to come to a forum where you get help that isn’t wrapped in cockiness.

2 Likes

@modsbyus,

Cheers! Love helping people get hooked up :slight_smile:

Stick around and help us bring IoT to the world.

Thx,

Craig

1 Like