Cannot connect to cayenne with my NodeMCU ESP-12E board!


Hii, I have a NodeMCU ESP8266 Amica, I have tried to connect, but i couldn’t, Compiling and upload in arduino IDE was successfull, but no connection to Wifi, it still says “Waiting for board to connect…” , nothing happens. my code is this (NOTE that i have used CLIENT ID as token and All libraries are installed fully and every requirements are met but its really strange that can’t connect to cayenne!!!):

#include “MQ135.h”
#include “CayenneDefines.h”
#include “CayenneWiFi.h”
#include “CayenneWiFiClient.h”
#define CAYANNE_PRINT Serial
#define VIRTUAL_PIN 5
#define ANALOGPIN A0

char token[] = “4281a770-6ec7-11e7-8942-2bfc58a71315”; // Insert your token here
char ssid[] = “Zyxel”; // Insert your SSID here
char pwd[] = “far13137474dad”; // Insert your SSID password here
MQ135 gasSensor = MQ135(ANALOGPIN);

void setup() {
// put your setup code here, to run once:
Cayenne.begin(token, ssid, pwd);

void loop() {
// put your main code here, to run repeatedly:;
// float rzero = gasSensor.getRZero(); //this to get the rzero value, uncomment this to get ppm value
// float ppm = gasSensor.getPPM(); // this to get ppm value, uncomment this to get rzero value
// Serial.println(rzero); // this to display the rzero value continuously, uncomment this to get ppm value
// Serial.println(ppm); // this to display the ppm value continuously, uncomment this to get rzero value
// Cayenne.virtualWrite(VIRTUAL_PIN,ppm); // uncomment after rzero define and get your ppm calculation

Thanks for helping.



Perhaps try to change the type of card in arduino IDE. At the moment I’m using NodeMCU 1.0(ESP 12E Module) but it can work with other ESP type (Wemos D1 for example).

Another point is that it’s quite long the first time, 3 to 5 minute for my first trial.

good luck


I have tried separate cayenne internet connection sketch and i tested it but in the serial monitor it says “Invalid auth token”. Is it Client ID as that token? I feel i’m entering wrong token, in addition to Client ID field, in Bring your own thing window , username and password fields are available too. Am i using wrong field as token? :thinking:


Also i tried to delete dashes from the client id field, then my output of internet connection sketch changed to this:

[275435] Connecting to
[275964] Connect success
[275964] <msg 2,1,32
[276271] >msg 0,1,9
[276271] Invalid auth token
[277912] state 0, tconn 0
[281272] Connecting to
[281547] Connect success
[281547] <msg 2,1,32

It seems still my token is wrong


Hi @fardadjung,

This looks like you’re using MQTT authentication in a non-MQTT sketch. MQTT sketches don’t ask for a auth token, that’s a Arduino only thing. Try this example connection code, which has spaces for your MQTT Username/Password/Client ID, as well as the Wifi SSID and password.


So I have this problem where my NodeMCU v1.0 will not connect to Dashboard.

It just keeps saying ‘waiting for board…’

Is there supposed to be a sketch I load? I am not provided with one as when working with an UNO from the dashboard.
Note: this NodeMCU has been previously flashed from the Arduino IDE 1.8.2. (FW or bootloader overwritten maybe?)

I can flash it anytime using Arduino IDE 1.8.2.
I have tried everything, serial port rate, board settings, reloading the Board json definition from, holding down the Flash button, everything I can think of. Serial USB driver is correct and working, again, I can flash it from the IDE no problem. I even matched the board settings from the NodeMCU help sheet

Is the dashboard missing a plugin or not providing a startup sketch? plz help

quadruple checked these:
Install the Arduino IDE and add Cayenne MQTT Library to Arduino IDE.
Install the ESP8266 board package to Arduino IDE. show me how
Install required USB driver on your computer so you can program the ESP8266. show me how
Connect the ESP8266 to your PC/Mac via data-capable USB cable.
In the Arduino IDE, go to the tools menu, select your board, and the port your ESP8266 is connected to.

Waiting for board to connect…

Here are my other projects, so I am fairly confident that I am just missing something with Cayenne itself…?

thanks sirs

Nodemcu connect problem

ok the file was missing, looks like i had to grab Cayenne-MQTT-ESP8266-Master library, not just CayenneMQTT library.

then I ran the test code above (Cannot connect to cayenne with my NodeMCU ESP-12E board! ) and things it compiled and started working

Help with newbi NodeMCU

Thanks for the update @lagunacomputer.

By the way, we launched a huge IoT contest. Check it out and enter :slight_smile: