WifiShield with arduino uno compiling error

I tried this, but received errors opening the library .zip:

Arduino: 1.6.13 (Windows 7), Board: “ESPDuino (ESP-13 Module), 80 MHz, 115200, 4M (3M SPIFFS)”

java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(ZipFile.java:219)
at java.util.zip.ZipFile.(ZipFile.java:149)
at java.util.zip.ZipFile.(ZipFile.java:163)
at processing.app.tools.ZipDeflater.(ZipDeflater.java:26)
at processing.app.Base.handleAddLibrary(Base.java:2206)
at processing.app.Base$6.actionPerformed(Base.java:1032)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877)
at java.awt.Component.processMouseEvent(Component.java:6533)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6298)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
at java.awt.Container.dispatchEventImpl(Container.java:2280)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.awt.EventQueue$4.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

Looks like you have a privilege issue on your PC. Try running the Arduino IDE as administrator.

You can also unzip the library and copy the folder into the libraries directory, then restart the IDE.

Cheers,

Craig

My bad - forgot I was using Windows (I needed Win7 for something else) and saved the file incorrectly instead of renaming it.

Sorry, I am new to this and should probably go back to easier stuff until I get my head around it - I get this now:

Arduino: 1.6.13 (Windows 7), Board: “ESPDuino (ESP-13 Module), 80 MHz, 115200, 4M (3M SPIFFS)”

C:\Users\tbscully\Documents\Arduino\libraries\Cayenne\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 ESPDuino (ESP-13 Module).

This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

Hmmmm, this is a new one to me. I think it is because it is not actually an ESP8266, thus the libraries aren’t recognizing it correctly and trying to do AVR things that aren’t compatible as the ESPs are not AVR based.

You could try removing the ESP8266 board from the boards manager, and use the additional boards json from the following link to install perhaps an updated version that includes this board. https://www.tindie.com/products/doit/espduinowifi-arduino-uno-r3/

UPDATE: I looked at the link and yes, they replaced the Generic ESP8266 Module in the file with the ESPDuino. I don’t recommend doing the above as they are using an old version. Just try setting it to Generic ESP module and see if it compiles for you.

@bestes, does anyone at “home office” have one of these boards?

Cheers,

Craig

Hello Kreggly!

I´m trying to do your example.
I use a Arduino UNO + ESP8266-01.
I done exactly what you said, but I have some issue with the serial between UNO and the ESP.
With the code you post, I will have the error: “‘Serial1’ was not declared in this scope”

//#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[] = "*****";
// Your network name and password.
char ssid[] = "*****";
char password[] = "*****";

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

void setup()
{ .......

I also install the library ESP8266HardwareSerial.zip like you said, I got 3 files “ESP8266.cpp”, “ESP8266_HardSer.h” and the “README.md”. But I´m not sure how I should use it… maybe I miss some detail!
Where I define the rx and tx pins to serial between UNO + ESP?

Thanks a lot!
AS

Hi @andreijrs,

You don’t have a separate serial port on the UNO, so you need to disable the debug port and use Serial to connect to the ESP shield. You don’t need to define pins as it is knows them already. They are the ones labelled RX and TX on the board. Just note when programming that you disconnect the ESP from the UNO so there are no confilcts, then reconnect after programming.

You can try adding a second serial port with the software serial library if you want to keep debug, but note that the UNO doesn’t have much program space if you plan on adding more user code.

See here:

/*
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[] = "";
char ssid[] = "";
char password[] = "";


// 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();
}

Cheers,

Craig

Hi @kreggly!
Thanks for your help.
At this moment I want a second serial port for debug, my code is something like:

#include <CayenneESP8266Shield.h>

// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = "***";
// Your network name and password.
char ssid[] = "***";
char password[] = "***";

#include <SoftwareSerial.h>
SoftwareSerial EspSerial(7, 8); // RX, TX

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

void setup() {...

Why I still have an error here?!

ESP8266 wifi(EspSerial);

“no matching function for call to ‘ESP8266::ESP8266(SoftwareSerial&)’”

Can you please help?

Thanks you!

@andreijrs,

Looks like the ESP8266 library has no handler for SoftwareSerial.

Craig

hi @adam @kreggly
i had gone through all above discussion but trying for espharware serial
“Zip doesn’t contain a library” is generated by ardino ide
link may have been broken or file corrupted as it seems like

@HamnaBazmi,

The file I attached is a zip file renamed a log file so it can be attached.Restore the extention to .zip, unzip it and copy the folder to your Arduino libraries directory.

@andreijrs,

Did you get this working for you?

If you want debug, maybe try this. Compiles fine for me:

/*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[] = "";

#include <SoftwareSerial.h>
SoftwareSerial DebugSerial(7, 8); // RX, TX
#define CAYENNE_PRINT DebugSerial  // 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();
}
1 Like

Thnx will get u back soon

Thanks @kreggly!
I will try it soon, and tell, if or how, it works with me.

Hi @andreijrs
Will wait for you
Come back ASAP☺

@kreggly

i am having problem with the rename of above file…
when i rename the above file, then also the file type is not changing i.e file type .h and .zip…it only showing text file after renaming also…

so whenever i want to attach .zip library file from ardunio, computer not able to recognise the renamed file…because its extension is still as text document even after changing to .h and .zip…

pls help

Hopefully soon we will have these files in the library so you won’t have to do this.

If you are on Windows, I think the issue you are facing is that you need to set your view settings in your file explorer to show extensions. Then you can actually chamge the extension.

I am mobile right now, but Google is your friend too.

Cheers,

Craig

1 Like

@kreggly
successfully compiled your code…

1 Like

Hi @vin3yasukhadeve

Squeeeeeeeeee!!!

Great news.

Although code is free to everyone. I am not the owner, only the encourager :slight_smile:

Cheers,

Craig

1 Like

@kreggly
Got connected to cayenne using ESP8266…

GREAT SUCCESS FOR ME…

please give one suggestion…
in our college cyberoam login is there…we have given separate id to use internet services.after connected to the wifi, login page is appear, in which we have to fill login info to acess the internet…

firstly, i connected to my college wifi.it got connected but i am not able to access internet because of login problem(i dnt know how to enter login details after connecting esp8266 to arduino)…

then
i tried by using mobile internet…got succeed…

please help me to connect using college cyberroam network

Sorry @vin3yasukhadeve,

That is a very specific thing that is really beyond the scope of what Cayenne does.

However, if we could find a generic method, it would be exciting to have this functionality.

Honestly though, it’s probably pretty tough to do as your ESP would have to be able to work with SSL certificates in order to submit your login information.

Cheers,

Craig

Hi @vin3yasukhadeve,

Are the analog reads good?

I could see an issue with the DHT read as I believe this sensor takes as much as 2 seconds to return with valid data.

Check here for how to error check your return values:

Cheers,

Craig

1 Like