There are somebody that write a post for a simple connection to Cayenne app with an Arduino UNO + ESP8266 module?
Arduino can send the AT command to ESP8266 module? Which is the Cayenne code to upload on Arduino UNO? ESP8266 standalone?
I tried anything but nothing works
I tried instructions by @kreggly (Esp8266 - #3 by kreggly), but allways with errors
Hi @jakub.demeter,
First of all, what ESP8266 module are you using? Can you confirm if it has the AT firmware already loaded or is it using NodeLua? NodeLua is not compatible with the ESP Shield library.
I got this working last night on a PLDuino with an ESP-02. I had to load new AT 1.3 firmware into the ESP.
For the Uno, you need to disable the Cayenne debug messages on the Serial port, as the ESP will need this port. Alternatively, you can implement the software serial library for a second port. This will “bit-bang” the RS-232 protocol to the I/O pins you connect the ESP to.
When I get time, I will document the process in more step by step detail, but for now, please let me know the model, assembly, and software state of your ESP.
Cheers,
Craig
In a nutshell, you want to follow this to install the esp hardware serial library, and tweaked header file, then use the following sketch that disables the debug stuff since you only have the one port on the Uno. SoftwareSerial doesn’t work with the Cayenne serial handler unfortunately.
/*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 ESP8266HardwareSerial.zip 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:
AT+UART_DEF=115200,8,1,0,0
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
#include <CayenneESP8266Shield.h>
// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = "";
char ssid[] = "";
char password[] = "";
//can't use debug as the Uno only has one serial port
//#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space
// Set ESP8266 Serial object
#define EspSerial Serial
ESP8266 wifi(EspSerial);
void setup()
{
DebugSerial.begin(9600);
delay(10);
// Set ESP8266 baud rate
EspSerial.begin(115200);
delay(10);
Cayenne.begin(token, wifi, ssid, password);
}
void loop()
{
Cayenne.run();
}
You wire the ESP up to the RX/TX lines as described in the sketch notes. GP0 and the ESP enables should be held high. Some require GP15 to be held low, etc. That’s why I ask about which one you have.
If you try this, and it doesn’t work, you probably have NodeLua on your ESP.
Cheers,
Craig