WifiShield with arduino uno compiling error

Hi Craig,

Thanks for the response.
Yes, I have tried 2 type of devices NodeMCU and Wemos connected to Cayenne without problems.

I am sure it’s not about firewall because when I upload the script, there is no new DHCP client connected in my router. (It’s only shown in DHCP client when I am debuging the connection with AT+CWJAP=“MyRouter”,“Password”).

Hi @kreggly
Do you know how to solve this type of error? ; (I’m using an arduino one + ESP8266)

C:\Users\Ricardo\Documents\Arduino\libraries\Cayenne-MQTT-ESP8266-master\src/CayenneMQTTESP8266.h:21:25: fatal error: ESP8266WiFi.h: No such file or directory
#include

I attach the code, greetings
exampleesp8266.txt (1.7 KB)

That sketch is not designed to use the ESP as a shield. It is designed to reflash the firmware inside the ESP with this sketch. The Uno is entirely un-necessary. If you are trying to compile it for Uno, I can see how you might get errors.

I have not seen a sketch yet that uses the ESP as a shield yet with MQTT.

Cheers,

Craig

And with a wifi shield if possible? What type of wifi shield should I buy to connect my arduino one by wifi to cayenne? . I’m new to this, I thought with an ESP8266 module that was enough.

The ESP modules are magical. They can actually be programmed with an Arduino sketch. You don’t need an Arduino at all.

If you do want to use an ESP with an Uno, so you have access to the IO etc, you can use the ESP as a Uno WiFi shield. You just need to use the Blynk based Cayenne library and program the ESP with an AT command set.

You can also upload the ESP MQTT sketch to the ESP - the sketch you attached earlier, and get connected to Cayenne.

I do not know of a way to use the ESP as a Uno WiFi shield with the Cayenne MQTT however.

Does this clarify things for you.

Cheers,

Craig

Finally after so many attempts following this conversation. I finally tried this method. After so many attempts, finally the code was successfully uploaded to Arduino. But when I opened my Cayenne Dashboard, the Arduino was still offline. The Serial Monitor displayed the following messages :
ATE0
AT+CIPSTART=“TCP”,“arduino.mydevices.com”,8442
AT+CIPCLOSE
Did i miss out any steps or something. Kindly do help me asap. I’m stuck with this since long time. Your help is much appreciated.
THANKS IN ADVANCE

Hi @saromarimuthu

Were you able to flash the ESP firmware with the AT command set? @kreggly may be able to help there. I’ve done it but can’t remember where I got the .bin file used for the AT set. I used a flash program I found online and used a USB to TTL card to connect to the rx and tx pins.

Yeah, I have the PlDuino talking Cayenne.

I’ll write something up showing how soon.

You can use the NodeMCU windows app to load AT SW. I put 1.3 in the PlDuino
ESP-02. The Cayenne lib supports 1.0 and above.

Awesome!

I finally hooked up my ESP-01 to my UNO and your code is working for me as well. One thing that I do have to point out is that “#define EspSerial Serial1” does not work on an UNO. The correct line is “#define EspSerial Serial”. Found this on another forum:

Arduino Uno doesn’t have Serial1, only Serial:
Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. These pins are connected to the corresponding pins of the ATmega8U2 USB-to-TTL Serial chip.

I’m not exactly sure what they mean by Arduino Uno doesn’t have Serial1, only Serial.

This is true for Uno. I made that statement elsewhere. We really need a clean space to put moderated/tested solutions :stuck_out_tongue:

I’d like to figure out how to get Cayenne to support the Software serial library. Then we could drop the ESP on some generic pins and keep “Serial” for debug. The Cayenne lib doesn’t like being passed a Software serial port.

Cheers,

Craig

hi… my wifi module model is ESP8266 12F, FOR THIS MODULE how i connect ?

Two ways.

Program the ESP with firmware that speaks cayenne.

Program it with the AT command firmware and command it with an arduino
through the serial port.

Both ways are detailed on the forum.

When I have time, I have been asked to make better howtos on connecting the
myriad ESP devices, but I only volunteer here. My day job designing control
systems keeps me pretty busy :slight_smile:

If you don’t find the answers by searching the forum, I’ll likely get
around to some documentation this Saturday. Sunday, I’m brewing beer!

1 Like

I get the following error:
Arduino: 1.8.2 (Windows Store 1.8.3.0) (Windows 10), Board: “Generic ESP8266 Module, 80 MHz, 40MHz, DIO, 115200, 512K (64K SPIFFS), ck, Disabled, None”

C:\Users\Pavitar\Documents\Arduino\libraries\ESP8266HardwareSerial\ESP8266.cpp:22:26: fatal error: avr/pgmspace.h: No such file or directory

#include <avr/pgmspace.h>

                      ^

compilation terminated.

exit status 1
Error compiling for board Generic ESP8266 Module.

did you get a solution? I’m also stuck at compilation errors

Do you have the board installed? Not sure why you would get that error.

In doing some research on this, it looks like a legacy code issue, pointing at a hardcoded folder that is not always there. Try locating the ESP8266.cpp file on your computer and changing:

#include <avr/pgmspace.h>

to

#include <pgmspace.h>

I’ve had to hack the library files for some of the ESP modules that are not identified by the IDE as ESPs.

Are we talking raw ESP8266 12F modules, or some board with the 12F and a usb to serial module?

Cheers,

Craig

One of my major issues is also that I’m not able to program esp8266 independently.

Offlate it has always given me the following error, which was working just fine before

warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed

I tried doing this, but it led to another error saying:

In file included from C:\Users\Pavitar\Documents\Arduino\libraries\Cayenne/CayenneESP8266Shield.h:24:0,

             from C:\Users\Pavitar\Desktop\esp8266cayenne\esp8266cayenne.ino:24:

C:\Users\Pavitar\Documents\Arduino\libraries\Cayenne/BlynkSimpleShieldEsp8266_HardSer.h:15:2: error: #error This code is not intended to run on the ESP8266 platform! Please check your Tools->Board setting.

#error This code is not intended to run on the ESP8266 platform! Please check your Tools->Board setting.

^

exit status 1
Error compiling for board Generic ESP8266 Module.