Good luck!

Let us know what you find.


See @kreggly’s post below


thanks Adam!


Forgot to attach the file in my last post :confused:

1 Like

Also just noticed you can change the device name in the device settings, so if the name of the Arduino you picked is bugging you just rename it to ESP8266

1 Like

So my HowTo in a nutshell.

I bought ESP8266-07 modules from AliExpress for a whole $2 each shipped.

To use them, you must provide a 3.3V supply between VCC and GND, attach the EN pin to VCC, and GPIO15 to GND.

To program, you must pull GPIO0 low, and momenterally put RST low to get into flashing mode.

You should also have an FTDI RS232-3V3 cable or some other USB to Serial converter with 3.3V logic.

Wire up the RX to TX and TX to RX plus GND from the RS232 cable to your ESP8266. If you have 3.3V on there, you can use it to power up your ESP, but I recommend an external supply with your programming jumpers.

Now download the Arduino software, and drop this in the additional boards field under preferences.

After doing this, if you go under tools, board manager, there will be an option to install the esp8266 stuff. This will allow you to select the ESP8266 as a programming target and program it like an Arduino. Aces!!

Now select the Generic ESP8266 with 64K SPIFFS and 115200 baud.

To check that you’ve selected the correct Open the Serial monitor, set it to 74880, as this is what my ESP8266-07 defaults to, and tap the reset low, or toggle the EN pin. You should see some bootloader text.

Now, I recommend you flash this sketch:

//Note that for the  ESP-07, the blue led is on GPIO2

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin 2 as an output.
  pinMode(2, OUTPUT);

// the loop function runs over and over again forever
void loop() {
  digitalWrite(2, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);              // wait for a second
  digitalWrite(2, LOW);    // turn the LED off by making the voltage LOW
  delay(2000);              // wait for a second

This will flash the blue led. Compile for ESP8266, and upload. If you have issues, remember that GPIO15, and GPIO0 must be low during programming, EN high, and you need to pull RST low momentarily to get the right mode.

If your blue LED is flashing (you might need to reset again. remove the jumper low to GPIO0), you have success.

Now go into the dashboard and create, as @ats1080s says, ANY arduino device, copy and paste your token, ssid, and password into this sketch:

#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()
  // initialize digital pin 2 as an output.
  pinMode(2, OUTPUT);
  Cayenne.begin(token, ssid, password);

void loop()

// This function will be called every time a Dashboard widget writes a value to Virtual Pin 2.
  CAYENNE_LOG("Got a value: %s", getValue.asStr());
  int i = getValue.asInt();
  if (i == 0)
    digitalWrite(2, LOW);
    digitalWrite(2, HIGH);

After resetting, you can go into the serial monitor. It should now show you stuff at 9600 baud. Watch it connect to your network and the dashboard.

Now add a virtual button 2, to turn your LED on and off, or just use the digital 2.

And that’s all there is too it.




So close, yet so far away-

Here’s the setup: ESP8266 and DHT11 (seems like #1 and #2 on the most wanted list)

Here’s the dashboard. Got the temp to add ok, but once I put the humidity on it started throwing command errors and reestablishing its connection to the server.

Here’s a screen grab of the serial monitor.

I see some things in Craig’s code that I think may be the problem with my code. I’ll do some tweaking and see what I can come up with.

@kreggly @ats1080s Thanks guys!


Hmm I wish I could remember what I was doing earlier, because I was getting errors with the IP address when I tried to use CayenneWiFiClient.h. I still can’t get the DS18B20 temp sensor to update the widget. I get more debug with your code, and I can see that the ESP is sending wrong values “< vw10temp,c=%.3f” If I try standalone code it will output the correct temp to the serial port every time.

What code do you think is conflicting?

I never set a pinMode in my code, as I recall that is important.

Also, humidity is now showing on the dashboard. I did nothing, number just appeared.


Cool. I was using it to test the virtual stuff.

I don’t want Cayenne to be the master of my IO. In fact, I’d like a switch to explicitly state that.

I want to stage IO sequences with Virtual IO, and letting Cayenne do it will not be able to handle the timing or complexity easily.

Maybe your device does not have the blue led on gpio2.

Putting my automotive hat on and swapping oil and tires… may not respond foe a bit :stuck_out_tongue:


I can’t get the ESP to send any temp to the dashboard in any virtual pin. I even tried to emulate using Cayenne.fahrenheitWrite(10, 74.97); and it just never makes it to the dashboard. But anyway, I can confirm that the code is reading the correct temp by printing it to the serial port. Must be a bug in the code.

Assuming you have debug on- are you seeing the vr# (read) and vw# (write) commands. At least that’s what I think they are.

Craig, I wasn’t using your code, just learning from it :+1: . I’m using the code I cobbled together using the Adafruit and Cayenne examples. I think I’m getting closer to something that works.

I’m back at work tomorrow, so I won’t have much time to play again until next weekend, good night all.


Note, I am using the ESP8266 ADC input, and have it reading using a direct read of the analog pin through Cayenne, as well as using a virtual pin where I do a median filter and convert to volts.

Something to note - In Cayenne, you need to read from the 3rd analog channel even though the channel is A0 in the Arduino sketch.

Also note, that for the ESP-07 at least, the ADC goes full scale from 0-3.3V. Woot. I’ve heard the ESP-01 only goes to 1. Mine goes to 3.3…

Also just received some ESP-12F modules. Will probably wire them up on the weekend.



1 Like

Here is my median filter, if anyone cares to use it. Note that you don’t want thousands of measurements, but if you get the occasional glitch, this will cure your problem.

For fast changing measurements, you don’t want to use this.

  float m = MedianRead(A0);

  //convert to voltage
  m = 3.3 * m / 1024.0;
  Cayenne.virtualWrite(V0, m);

//define how many measurements to make
#define MAX_BUF 11

int MedianRead(int chan) 
   int buffer[MAX_BUF]; 
   int i, j; 
   int temp; 

   //get some data
   for (i=0; i<MAX_BUF; i++) 
     buffer[i] = analogRead(chan);
   //sort em
   for (j=0; j<MAX_BUF-1; j++) 
     for (i=0; i<MAX_BUF-1- j;i++)
       if (buffer[i]>buffer[i+1])
         temp = buffer[i]; 
         buffer[i+1] = temp; 

   //return the one in the middle
   return buffer[(MAX_BUF-1)/2];



What version flash eap8266 for make it run?

NodeMCU. You can get a current build here just select the options you need.

The Arduino IDE and ESP library don’t need the Node MCU stuff, you are writing the flash through the bootloader with your own program.


Hmm I didn’t know that. I assumed the Arduino IDE used NodeMCU to boot and and then runs the code you upload. Looks like NodeMCU is only for LUA scripts.