WifiShield with arduino uno compiling error


#84

I’m confused. Are you using the ESP with AT commands to connect, or are you using the .bat file to connect through USB?


#85

As discussed earlier, adam ji, my query is:

I have Arduino Uno board. I have ESP8266 Wifi Module. I have attached 1 relay to turn light ON and OFF. I want to switch ON and OFF the light using the mobile app through internet from remote location. This all is working fine with Blynk Server. But issues with Blynk is we have to attach USB Cable from PC to Arduino Uno board to run Blynk server+ for internet connection to the Uno Board.
After blynk, someone told me thingspeak.com can solve this issue, but till date I am not getting the Arduino code of thingspeak.com for this problem. I explored on google for that, and I came to know about Cayenne. Cayenne seems good and seems to provide much more features than thingspeak.com. Since that day till today I am struggling hard to solve this problem, but yet I am not getting any proper solution for my problem and my problem still stands the same.

I want Arduino Uno Board to work independently using the internet from the Wifi Router and without the use of PC for switching ON and OFF the light using 1 relay attached to it.
Please suggest if you or anyone have some solution to this.


#86

Hi kreggly i am having following msg after compiling above sketch. PLS help!
C:\Users\Rahul\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.


#87

What code are you running? If it’s the shield code I would check to make sure you have the correct board selected in your IDE. The error would indicate you have an ESP selected. This code is meant to be run on another device that uses an ESP as a shield to connect.


#88

@rahul,

Yep if you are running the ESP as a shield, then you need to select the main Arduino device you are using to talk to the ESP.

If you are programming the ESP as an Arduino, then add an ESP device to your Dashboard and use the example code provided. ESP standalone is now supported by Cayenne, so the best way to get an ESP going is to follow the example on the Dashboard.

Code is here:

Cheers,

Craig


#89

error saying “Zip doesn’t contain a library”

Arduino: 1.8.3 (Windows 10), Board: “Arduino/Genuino Uno”

java.io.IOException: Zip doesn’t contain a library
at processing.app.Base.handleAddLibrary(Base.java:2248)
at processing.app.Base$6.actionPerformed(Base.java:1069)
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:80)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
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:80)
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)
Zip doesn’t contain a library

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.


#90

@mgargiulo07,

Here’s what I did to compile from scratch right now.

Install ESP Library
Start Arduino and open Preferences window.
Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json32 into Additional Board Manager URLs field. You can add multiple URLs, separating them with commas.
Open Boards Manager from Tools > Board menu and install esp8266 platform.

Install Cayenne Library
Go to https://github.com/myDevicesIoT/Cayenne-Arduino-Library and grab a zip.
Drag directory in zip file to ~Arduino/libraries

Install Cayenne Shield Library
Open the Cayenne Arduino library directory and go to ~extras.
Create a directory called libraries.
Copy ESP8266HardwareSerial.zip to the libraries directory you just created.
Load your sketch and go to Sketch->Include Library->Add .ZIP Library.
Navigate to where you put it.

Install the ESP Shield header
Copy CayenneESP8266Shield.h to the root of your Cayenne library.

Select Generic Uno, or whatever your host board is and compile away.

Cheers,

Craig


#91

I am just going around in circles…so… I am going to post exactly what I did and you can tell me where I am failing miserably.

  1. I installed the ESP library: http://arduino.esp8266.com/stable/package_esp8266com_index.json32 VIA the preference window and installed v2.2.0 of the ESP8266 platform.

  2. I downloaded the Cayenne-Arduino-Libarary-Master zip and located in this directory: C:\Users\Matt\Documents\Arduino\libraries

3)I then downloaded the ESP8266HardwareSerial.log folder, coverted to a zip and put it at this directory:
C:\Users\Matt\Documents\Arduino\libraries\Cayenne-Arduino-Library-master\Cayenne-Arduino-Library-master\extras\libraries

  1. So far everything has gone smoothly. But this is where I am failing hadr. I have converted the CayenneESP8266Shield.log file into a .h file and moved it to: C:\Users\Matt\Documents\Arduino\libraries\Cayenne-Arduino-Library-master which is the root of my Cayene Library but when I run the script it still says that i do not have the file.

wait. something good happened! It started to post to my serial monitor! However it now says “ATE0
AT+CIPCLOSE
AT+CIPSTART=“TCP”,“arduino.mydevices.com”,8442
AT+CIPCLOSE” a billion times.


#92

@mgargiulo07,

What you need to do is install the esp8266hardware serial library from within your sketch.

Open your sketch.
Go to the menu bar and select Sketch->Include Library->Add .ZIP Library and navigate to where you put the zip file.
Compile, and …
Party on Garth.

Cheers,

Craig


#93

Thanks for the help on this Craig,

I have been able to successfully upload all libraries but am still receiving the following on my serial monitor:
AT+CIPCLOSE
AT+CIPSTART=“TCP”,“arduino.mydevices.com”,8442
AT+CIPCLOSE"

Do you think this is an issue with my AT command?


#94

@mgargiulo07,

Yes, I think you have old firmware that is not compatible. Version must be 1.0 or higher.

Others on the forum have seen this same symptom, and after a firmware upgrade on the ESP, it worked.

Cheers,

Craig


#95

You can’t print serial or anything that the ESP is using. The serial connection is used now for communication to the ESP. If you try to view the serial monitor it will disrupt the connection. If you want to use print serial or debug you need to use software serial on a uno to a different serial connection. Can you post your code?


#96

@vapor83
#define CAYENNE_DEBUG // Uncomment to show debug messages
#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space
#include <CayenneESP8266Shield.h>
#include <SoftwareSerial.h>
#include <SparkFunESP8266WiFi.h>

// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = “xxxxxxxxxxx”;
char ssid[] = “xxxxxxxxx”;
char password[] = “xxxxxxxxxxx”;

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

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

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

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

I have also added all zip files VIA ’ Include Library’


#97

You need to disable your debug stuff as Mitch says.

I would try the sketch here first:.

Cheers,

Craig


#98

Hi guys,

I find this thread very very useful. In fact, I created my own tutorial on my Wordpress site using the codes here. I linked this thread there as well just in case. Thank you very much guys!

The link is https://eldontronics.wordpress.com/2017/08/28/beginning-iot-with-esp8266-01-wifi-module-and-cayenne-iot-platform/.

I hope I can help beginners like me as well. More power, Cayenne!


#99

I’ve fixed the
AT+CIPCLOSE
AT+CIPSTART=“TCP”,“arduino.mydevices.com”,8442
AT+CIPCLOSE

problem by changing EspSerial baud rate to 9600.


#100

ESPs are funny things. If you didn’t flash the firmware yourself, it could be any number of different baud rates by default.

Cheers,

Craig


#101

Wanted to update this thread to share that we’ve just provided support in our MQTT Arduino library for using ESP8266 as a shield :slight_smile: This should avoid the situation where you need to use the unofficial code in this thread.

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:


#102

Oh yeah! Let us know how that goes guys :slight_smile:

~B


#103

Followed the instructions and finally, my serial monitor reads:
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
I have seen similar errors in the forums, and most of the time, flashing the firmware is what is suggested to fix. I attempted to flash the firmware through python and nodemcu, following seperate tutorials for each. Nodemcu simply froze and I never saw a progress bar. Python/PIP encountered a fatal error when using the erase_flash command. Could I possible have a bad chip? I am able to connect to wifi through AT commands, but haven’t been able to connect to cayenne despite numerous attempts/tutorials. Is there perhaps a way to only code my esp8266 to connect to wifi and not cayenne in order to debug? Also, I am using an Arduino Uno with the Esp8266-01.