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
user1.1024.new.2.bin → 0x1000
blank.bin → 0x7E000
esp_init_data_default.bin → 0xFC000
- Connect ESP and put into firmware upload mode by grounding GPIO0 and then powering on the ESP.
- Make sure SpiAutoSet is checked & select your correct com port. Baud usually works at 230400 but try lower if you have troubles.
- 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:
EspSerial.begin(1115200);
delay(10);
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()
{
EspSerial.begin(115200);
delay(10);
Cayenne.begin(token, wifi, ssid, password);
}
void loop()
{
Cayenne.run();
}
Thats it!