Hi @priyaranjan391 and welcome to the Cayenne Community.

Yes, we have many users on this forum who have successfully connected ESP8266 microcontrollers to Cayenne and used them in projects using the code in post #20 of this thread. Give it a shot and let us know if you run into any questions or trouble.


What is the prefered version of AT commands with cayenne? 0.22 or the new 1.1?


Hi @vapor83,

It is very confusing. Doesn’t help that there are multiple ways to program, multiple softwares, and multiple ESP devices and boards based on those devices.

I prefer to tell people to just program the ESP directly with Cayenne, and use an I/O expander if you need more I/O.

So I don’t have an answer for you. What we need to do is try, and let us know what works. Then we can create a detailed procedure and a table showing what works.




I’ve been using mainly the .22 which seems to work good. Just starting to use the 1.1 and that seems to work fine too. Just a fyi


Don’t think it matters as long as it works.

What ESP, and how are you programming them?

Can you share a rough procedure for us?




So I’ve been using the ESP8266-01 & the new ESP8266-01S. I take a proto shield and mount the ESP to it or use a breadboard adapter if you want to be able to remove it (see pics). I basically make a ESP shield that goes to the Serial RX/TX with a switch on it for easy uploading to the arduino.

First you need to upload the AT firmware for the ESP so the arduino/cayenne can talk to it using AT commands. You need the following: ESP_download_tool_v2.4 & the ESP_IOT_SDK 1.0.0. I included just the files you need here for simplicity. Open the download tool and setup the files and addresses(ADDR) exactly as shown.

blank.bin --> 0xFE000
boot_v1.5.bin --> 0x00000 --> 0x1000
blank.bin --> 0x7E000
esp_init_data_default.bin --> 0xFC000

  1. Connect ESP and put into firmware upload mode by grounding GPIO0 and then powering on the ESP.
  2. Make sure SpiAutoSet is checked & select your correct com port. Baud usually works at 230400 but try lower if you have troubles.
  3. Click Start.

Now you should have AT command set firmware! Unground GPIO0 and reboot the ESP. Open up a serial terminal and test with come commands.

Set Baud at 115200 and try typing AT. It should send back “ok” if everything worked.

Now we need to set it to station mode. Type AT+CWMODE_DEF? and it will probably return the number 2… we want it to say 1. Now type AT+CWMODE_DEF=1 and it should say ok. Verify with the first command AT+CWMODE_DEF? and it should return 1 now. Now enter AT+RST and it will reboot and say ready. Now were ready to connect it to our sketch/cayenne.

You need to include this library : #include <CayenneESP8266Shield.h>
In the header of your sketch you need to define which serial were using which is usually the first Serial (pins 0 &1):
#define EspSerial Serial
ESP8266 wifi(EspSerial);

Then in setup you need to tell it to start by:

So when were done it looks like this:

#include <CayenneESP8266Shield.h>

char token[] = "blah";
char ssid[] = "devices";
char password[] = "password";

#define EspSerial Serial
ESP8266 wifi(EspSerial);

void setup()

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

void loop()

Thats it!

Connecting to Cayenne with Sparkfun ESP8266
Cayenne Esp8266 + Arduino [Confused]
Need help connecting to Cayenne with ESP8266
Add directions for connecting device to internet

Cheers. That’s awesome!




The DS18B20 does not work on WeMos D1 R2 on Cayenne.
Connected to pin D9, Virtual V1.

#include "CayenneDefines.h" 
#include "BlynkSimpleEsp8266.h" 
#include "CayenneWiFiClient.h" 
#define CAYENNE_PRINT seryjny
#include <OneWire.h>
#include <DallasTemperature.h>

// Virtual Pin of the DS18B20 widget.
#define VIRTUAL_PIN V1

// Digital pin the DS18B20 is connected to. Do not use digital pins 0 or 1 since those conflict with the use of Serial.
const int tmpPin = D9;

OneWire oneWire(tmpPin);
DallasTemperature sensors(&oneWire);

char token[] = "..........";
char ssid[] = "............";
char password[] = "";

void setup()
  Cayenne.begin(token, ssid, password);
void loop()

// This function is called when the Cayenne widget requests data for the Virtual Pin.
  // Send the command to get temperatures.
  // This command writes the temperature in Celsius to the Virtual Pin.
  Cayenne.celsiusWrite(VIRTUAL_PIN, sensors.getTempCByIndex(0));
  // To send the temperature in Fahrenheit use the corresponding code below.
  //Cayenne.fahrenheitWrite(VIRTUAL_PIN, sensors.getTempFByIndex(0));


I personally don’t like running sensors.requestTemperatures in a CAYENNE_OUT call. No big deal when it’s quick, but if you have multiples on the one wire bus, it can take some time.

I think standard practice should be to run it in a timed loop using the timer library interval function, then store the values into global variables that the CAYENNE_OUT functions can simply grab when requested.

Here’s an example scheme you can implement.




i think the problem in that code is:
where it says
Cayenne.celsiusWrite(VIRTUAL_PIN, sensors.getTempCByIndex(0));

mod to
Cayenne.virtualWrite(VIRTUAL_PIN, sensors.getTempCByIndex(0));

thats gets my ds18b20 sensor up and running.



hi there,i run esp8266-01 with ssr attached to it using that
for the ssr, i use channel 3 cause all other channel boot with the ssr high and relay modules needs 5v ssr needs 3v to activate
simply copy and paste in arduino ide then change all ***** with your infos then upload

1 #define CAYENNE_DEBUG // Uncomment to show debug messages
2 #define CAYENNE_PRINT Serial // Comment this out to disable prints and save space
4 #include "CayenneDefines.h"
5 #include "BlynkSimpleEsp8266.h"
6 #include "CayenneWiFiClient.h"
8 // Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
9 char token[] = “********”;
10 // Your network name and password.
11 char ssid[] = “";
12 char password[] = "
14 void setup()
15 {
17 Serial.begin(9600);
18 Cayenne.begin(token, ssid, password);
19 }
21 void loop()
22 {
24 }


Code should work the same, just need to research how to put it in program
mode and set the device setting for the amount of memory etc your device

Google your device and set the Arduino IDE settings to match.


change celsiusWrite for virtualWrite



@rmoscoloni @kreggly @philippethibault @tomixps @vapor83 @priyaranjan391 @HamnaBazmi @adam @jhonathan.lhp @usmcwarmachine @pearl3 @jorge.montalvao @raviunoff @vivekgs27 @mmkameshwaran @cy80rg @tad.dvor @m3mn0t and anyone else who is following along this thread…

We’ve just released UI support for the ESP8266 stand alone. We also supported SparkFun’s Thing Dev board since we recently partnered with them. Check it out and let us know what you think!

You can read about it in our release notes here:


That’s great


My dashboard doesn’t have that “Sharing” Icon. I just have “Overview” on the left, then the project name and the Settings gear on the right. Any thoughts on why that would be?

(Chrome browser on Macbook)


You only can share in the “Projects” tab I believe.


I thought that’s where I was. Am I not? If not, then how do I get there?

The “Overview” button looks just like what @bestes posted above, but I don’t see “Scheduling” or the other buttons. Pardon my Cayenne n00bness…


Never mind – found it. I guess I’ve just been looking at the device page, and I never actually created a project!


They look similar but the advantage of projects is that you can have widgets from multiple devices on the same dashboard. And that you can eliminate things like the default Pi widgets that are not otherwise removable by just refusing to include them in your Project view.

If you have just a single device, you can still replicate it’s device dashboard exactly in a project view to access the Sharing feature.