Arduino UNO + ESP8266 -- Not working

Followed the following link to get my Arduino UNO + ESP8266 connect to Cayenne

The serial output shows the following, Am I missing anything?? Dashboard says Waiting for board to connect… Please suggest?

ATE0
AT+CIPCLOSE
AT+CIPSTART=“TCP”,“arduino.mydevices.com”,8442
AT+CIPCLOSE
AT+CIPSTART=“TCP”,“arduino.mydevices.com”,8442
AT+CIPCLOSE
AT+CIPSTART=“TCP”,“arduino.mydevices.com”,8442
AT+CIPCLOSE
AT+CIPSTART=“TCP”,“arduino.mydevices.com”,8442
AT+CIPCLOSE
AT+CIPSTART=“TCP”,“arduino.mydevices.com”,8442
AT+CIPCLOSE
AT+CIPSTART=“TCP”,“arduino.mydevices.com”,8442
AT+CIPCLOSE
AT+CIPSTART=“TCP”,“arduino.mydevices.com”,8442
AT+CIPCLOSE
AT+CIPSTART=“TCP”,“arduino.mydevices.com”,8442

Amit

@amit.agrawal,

Please show your code and confirm your hardware.

Last time we saw these errors, they had the wrong sketch.

Cheers,

Craig

Hardware:
ESP8266 and Arduino UNO, few sensors. Here is the small video about hardware.

Source Code - Complete sketch file
/*
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
//#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 = “xxxxxxxxxxx”;
char ssid = “AMIT AGRAWAL”;
char password = “xxxxxxxxx”;

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

void setup()
{
//Serial.begin(9600);
delay(10);
// Set ESP8266 baud rate
EspSerial.begin(115200);
delay(10);

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

void loop()
{
Cayenne.run();
}

Code looks ok. What ESP866 do you have and did you program it with AT code?
Are you powering the ESP with a 3.3V supply? Are the correct enables and
pin configuration set for run mode? Did you try flipping your TX and RX
around?

ESP8266 ESP-01

I was able to push the data using same setup to a different platform.

I was able to push the data using same setup to a different platform.

I don’t understand this statement. Please elaborate.

I bought the device with Axelta Systems who has the their own IOT platform. The platform exposes REST APIs to push the data and I was able to do so using the same h/w setup I am using to push it to Cayenne. The only difference is in the sketch which I already shared with you.

If you think the code to push data to other platform will help, I can share that. It simply reads the data from sensors and pushes the Data to proprietary IoT platform using REST APIs.

Amit

Ok. That Cayenne sketch requires that you have AT firmware loaded into the
ESP-01.

Sounds like your alternate setup proves the hardware is electrically good
and wired correctly, thus I think the issue must be the ESP device firmware.

Cheers,

Craig

How can I confirm that? sorry if it is a silly question?

Not a silly question at all, Amit.

I have a USB to 3 volt serial adapter I use then connect to the ESP and
then type AT. You should get OK as a response.

Another way is to program your uno with a very basic sketch, writing to
Espserial with AT commands and send responses back to the serial monitor. I
posted one somewhere here.

My guess is if it is not a hardware issue, as you say the setup works
elsewhere, you may have nodemcu loaded on your ESP, another popular ESP
firmware… or an older version of the AT firmware.

Here’s one way to load the firmware.

There are others including using the arduino ide.

Cheers,

Craig

Great Thanks…

When I run this using a different sketch:

AT+CWJAP=“AMIT AGRAWAL”,“9341933992”

I get

OK

So it has AT firmware and you are receiving responses.

Very strange. So either an old firmware, which I think is unlikely, or
perhaps you have a blocked port on your firewall.

Search the forum for putty and test that your outbound port is open to the
cayenne server.

Also, does the ESP device show up on your router?

Thanks for posting. You are right, it is indeed UNO.

There is hardly any custom code that is written, just changed the network SSID and password… If you have access to sample code, could you suggest the changes?

Thanks.

Amit

Checkout that link. I posted 2 examples for using esp as a shield. One normal one, and the other using software serial with a ttl adaptor for prints. Let us know if it works.

1 Like

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: