Arduino Mega + Esp8266/or NodeMCU


Hi guys i like cayenne. I am making some sketchs with NodeMCU it is working fantastic but why we can use Arduino Mega + Esp8266? I am trying to make a IOT and i really need 30-40 pin. Before the cayenne i used thingspeak and it is really work good with arduino mega and esp8266. Cayenne is better than thingspeak but i need to use arduino mega + esp8266 or arduino mega + nodemcu or just esp32. Why alll these cayenne ardino librarys are working with ethernet cable shield? Cayenne can you write better library ?


@ozbayalperen1 esp8266 as a shield is not officially supported by cayenne but this will get you going


Dude, i am trying this method but it’s giving an error:
Why Cayenne employees don’t make a good library for arduino + esp8266? All makers have an arduino and esp8266 is the cheapest solution for wireless. This project is very important for me. Please help team Cayenne. Thanks Craig.


extract the zip file and add the library into the library folder of your arduino manually.


Okay i made this library thing i think but it is giving error when i clicked verify button:

Arduino:1.8.4 (Windows 10), Kart:“Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)”

C:\Users\mucittin\AppData\Local\Temp\arduino_modified_sketch_657397\sketch_nov21a.ino:24:34: fatal error: CayenneESP8266Shield.h: No such file or directory

#include <CayenneESP8266Shield.h>


compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.


You will need to install the attached CayenneESP8266Shield.log to your Cayenne library directory and rename it with a .h extension.


If you want maybe we can use teamviewer and discord.


do the above step and you will be good to go.


Okay i will try again.


Is this Cayenne ESP8266Shield.h file must be there? —> My Documents\Arduino\libraries\Cayenne\extras\libraries


My Documents\Arduino\libraries\Cayenne. in this you will see many .h files. add there.


Hi i made this folder thing but it is giving errors:
We are getting close to make thanks, Craig.


try this code.

Cayenne ESP8266 Shield WiFi Example
Adapted from Blynk's ESP8266_Shield_HardSer Example

This sketch connects to the Cayenne server using an ESP8266 WiFi module as a shield connected
via a hardware serial to an Arduino.

You should install the library via the Arduino IDE (Sketch->Include Library->Add .ZIP Library)
from the Cayenne extras/libraries folder (e.g. My Documents\Arduino\libraries\Cayenne\extras\libraries) to compile this example.

NOTE: Ensure a stable serial connection to ESP8266!
      Firmware version 1.0.0 (AT v0.22) or later is needed.
      You can change ESP baud rate. Connect to AT console and call:

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 Channels, data
should be sent to those channels using virtualWrites. Examples for sending and receiving
Virtual Channel 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 <CayenneESP8266Shield.h>

// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = "";
char ssid[] = "";
char password[] = "";

// Set ESP8266 Serial object
#define EspSerial Serial
ESP8266 wifi(EspSerial);

void setup()
	// Set ESP8266 baud rate

	Cayenne.begin(token, wifi, ssid, password);

void loop()


It is not giving an error but does not work.


it should work by now. i am not sure what this error is. @rsiegel and @kreggly tagging for this.


That last screen shot seems to be connecting unless I’m missing something. What’s not working?


How we can fix? Why this is so hard?


@ozbayalperen1 can you follow this tutorial.
as i am not sure abt this error. try updating your esp8266 firmware


@ozbayalperen1 just follow the instructions here (linked above) It works I promise.


Bumping this old thread to share that we’ve just provided support in our MQTT Arduino library for using ESP8266 as a shield :slight_smile: We’ve done basic testing and works well. Give it a try for your project and let us know how it works out for you !

Here is the updated library on our github:

and the code can be found here: