Can't connect to adafruit.io via ethernet

Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Locked
User avatar
chrisspurgeon
 
Posts: 37
Joined: Sat Mar 28, 2009 11:44 pm

Can't connect to adafruit.io via ethernet

Post by chrisspurgeon »

Hi all, I'm attempting to connect to adafruit.io using an Arduino UNO and Arduino ethernet shield.

I began by installing the Adafruit_IO_Arduino library from https://github.com/adafruit/Adafruit_IO_Arduino .
I attempted to run the "adafruit_00_publish" example sketch. I made sure to comment out the two WIFI lines in config.h, and uncomment the two Ethernet lines.

When I attempted to compile the sketch, I got this error...

Code: Select all

In file included from /var/folders/0c/7c1k8k2j7sl3h77rhjm09_9h0000gp/T/arduino_build_844763/sketch/config.h:43:0,
                 from /var/folders/0c/7c1k8k2j7sl3h77rhjm09_9h0000gp/T/arduino_modified_sketch_805552/adafruitio_00_publish.ino:18:
/Users/chrisspurgeon/Documents/Arduino/libraries/Adafruit_IO_Arduino/src/AdafruitIO_Ethernet.h:17:27: fatal error: Adafruit_MQTT.h: No such file or directory
compilation terminated.
...so I installed the Adafruit MQTT Library and tried again. This time I got this error...

Code: Select all

In file included from /var/folders/0c/7c1k8k2j7sl3h77rhjm09_9h0000gp/T/arduino_build_677786/sketch/config.h:43:0,
                 from /var/folders/0c/7c1k8k2j7sl3h77rhjm09_9h0000gp/T/arduino_modified_sketch_775262/adafruitio_00_publish.ino:18:
/Users/chrisspurgeon/Documents/Arduino/libraries/Adafruit_IO_Arduino/src/AdafruitIO_Ethernet.h:20:23: fatal error: Ethernet2.h: No such file or directory
compilation terminated.
...so I installed the Ethernet2 library and tried again.

This time the code appeared to compile and upload OK. But when I go to io.adafruit.com I don't see any data appearing in my "counter" feed. I've double checked that my username and AIO key are correct.

I get this text in the Serial Monitor, and then nothing more...

Code: Select all

Connecting to Adafruit IOAdafruitIO::connect()
I have no problem running other sketches on the board, including sketches that use the Ethernet shield to make http calls. I'm using a Mac running OSX 10.14.2, and version 1.8.7 of the Arduino IDE.

Any idea what's going on?

Thanks!

User avatar
brubell
Learn User Page
 
Posts: 2017
Joined: Fri Jul 17, 2015 10:33 pm

Re: Can't connect to adafruit.io via ethernet

Post by brubell »

Adafruit IO Arduino is compatible with the Arduino Ethernet Featherwing (https://www.adafruit.com/product/3201), which uses a WIZ5500 chip. It's possible that the Arduino Ethernet shield is not compatible with this library, as it might use a different chip.

Could you link a product page/purchase page for the shield you're using?

User avatar
chrisspurgeon
 
Posts: 37
Joined: Sat Mar 28, 2009 11:44 pm

Re: Can't connect to adafruit.io via ethernet

Post by chrisspurgeon »

It's an older model ethernet shield from arduino.cc. I believe it's this one...

https://store.arduino.cc/usa/arduino-et ... poe-module

That page says that model shield uses a Wiznet W5100 ethernet chip. Their new model ( https://store.arduino.cc/usa/arduino-ethernet-shield-2 ) does use the W5500 chipset. I can grab one of those if you think that's all I need to do.

Thanks!

Chris

User avatar
brubell
Learn User Page
 
Posts: 2017
Joined: Fri Jul 17, 2015 10:33 pm

Re: Can't connect to adafruit.io via ethernet

Post by brubell »

That page says that model shield uses a Wiznet W5100 ethernet chip. Their new model ( https://store.arduino.cc/usa/arduino-ethernet-shield-2 ) does use the W5500 chipset. I can grab one of those if you think that's all I need to do.
The library does not officially support that shield - the only ethernet shield officially supported by Adafruit IO Arduino is the Ethernet FeatherWing. You could try it, but I can't guarantee if it'll work as I haven't tested it before.

User avatar
chrisspurgeon
 
Posts: 37
Joined: Sat Mar 28, 2009 11:44 pm

Re: Can't connect to adafruit.io via ethernet

Post by chrisspurgeon »

Yeah, doesn't look like it works on a current Arduino.cc ethernet shield either. I just tried it with the latest shield, coupled it with a brand new UNO, and it fails just like before.

Drag, was hoping not to have to shell out for a featherwing board and ethernet wing.

User avatar
chrisspurgeon
 
Posts: 37
Joined: Sat Mar 28, 2009 11:44 pm

Re: Can't connect to adafruit.io via ethernet

Post by chrisspurgeon »

OK, I'm back.

Got an Adafruit Feather M0 datalogger, and an Adafruit Ethernet FeatherWing, and tried again. Running the "adafruitio_00_publish" sketch the same initial sequence of issues appeared. First the Arduino IDE showed an error saying it couldn't find the Adafruit MQTT Library, so I installed that and tried the sketch again. This time it said it couldn't find the Ethernet2 library, so I installed that and tried the sketch a third time.

This time the sketch compiled ok and made it as far as this block of code in the sketch...

Code: Select all

  while(io.status() < AIO_CONNECTED) {
    Serial.print(".");
    delay(500);
  }
I stuck a debugging Serial.println in there, and io.status() is always returning a value of "2", which I believe is "AIO_DISCONNECTED".

Any idea what's going on?

I can run simple web client sketches just fine, so I know the feather, the ethernet wing, my connection to the Internet, and my soldering job are all OK. I've double checked my username (chrisspurgeon), AIO key, and feed name ("counter"), and they all seem just fine.

When verifying the Arduino sketch in verbose mode I see no errors, but I do see this warning...

Code: Select all

In file included from /Users/chrisspurgeon/Documents/Arduino/libraries/Adafruit_IO_Arduino/src/AdafruitIO_Ethernet.h:17:0,
                 from /var/folders/0c/7c1k8k2j7sl3h77rhjm09_9h0000gp/T/arduino_build_711404/sketch/config.h:43,
                 from /var/folders/0c/7c1k8k2j7sl3h77rhjm09_9h0000gp/T/arduino_modified_sketch_764742/adafruitio_00_publish.ino:18:
/Users/chrisspurgeon/Documents/Arduino/libraries/Adafruit_MQTT_Library/Adafruit_MQTT.h:28:0: warning: "strncpy_P" redefined [enabled by default]
 #define strncpy_P(dest, src, len) strncpy((dest), (src), (len))
 ^
In file included from /Users/chrisspurgeon/Library/Arduino15/packages/adafruit/hardware/samd/1.3.0/cores/arduino/Arduino.h:36:0,
                 from /var/folders/0c/7c1k8k2j7sl3h77rhjm09_9h0000gp/T/arduino_build_711404/sketch/adafruitio_00_publish.ino.cpp:1:
/Users/chrisspurgeon/Library/Arduino15/packages/adafruit/hardware/samd/1.3.0/cores/arduino/avr/pgmspace.h:74:0: note: this is the location of the previous definition
 #define strncpy_P(s1, s2, n) strncpy((s1), (s2), (n))
 ^
In file included from /Users/chrisspurgeon/Documents/Arduino/libraries/Adafruit_IO_Arduino/src/AdafruitIO_Ethernet.h:17:0,
                 from /var/folders/0c/7c1k8k2j7sl3h77rhjm09_9h0000gp/T/arduino_build_711404/sketch/config.h:43,
                 from /var/folders/0c/7c1k8k2j7sl3h77rhjm09_9h0000gp/T/arduino_modified_sketch_764742/adafruitio_00_publish.ino:18:
/Users/chrisspurgeon/Documents/Arduino/libraries/Adafruit_MQTT_Library/Adafruit_MQTT.h:29:0: warning: "strncasecmp_P" redefined [enabled by default]
 #define strncasecmp_P(f1, f2, len) strncasecmp((f1), (f2), (len))
 ^
In file included from /Users/chrisspurgeon/Library/Arduino15/packages/adafruit/hardware/samd/1.3.0/cores/arduino/Arduino.h:36:0,
                 from /var/folders/0c/7c1k8k2j7sl3h77rhjm09_9h0000gp/T/arduino_build_711404/sketch/adafruitio_00_publish.ino.cpp:1:
/Users/chrisspurgeon/Library/Arduino15/packages/adafruit/hardware/samd/1.3.0/cores/arduino/avr/pgmspace.h:72:0: note: this is the location of the previous definition
 #define strncasecmp_P(s1, s2, n) strncasecmp((s1), (s2), (n))
 ^


Other than that, no other warnings.

I would love it if I could actually get this thing working. Any suggestions or guidance would be most welcome!

User avatar
brubell
Learn User Page
 
Posts: 2017
Joined: Fri Jul 17, 2015 10:33 pm

Re: Can't connect to adafruit.io via ethernet

Post by brubell »

Update: I just got it working from my end, watch this thread. I'll be updating and releasing a new library version with this fix shortly...

User avatar
brubell
Learn User Page
 
Posts: 2017
Joined: Fri Jul 17, 2015 10:33 pm

Re: Can't connect to adafruit.io via ethernet

Post by brubell »

PR for this forum topic, will be releasing in Adafruit IO Arduino v2.7.3: https://github.com/adafruit/Adafruit_IO_Arduino/pull/82

User avatar
brubell
Learn User Page
 
Posts: 2017
Joined: Fri Jul 17, 2015 10:33 pm

Re: Can't connect to adafruit.io via ethernet

Post by brubell »

Library version updated to 2.7.3, including the Ethernet fix: https://github.com/adafruit/Adafruit_IO ... tag/v2.7.3

User avatar
chrisspurgeon
 
Posts: 37
Joined: Sat Mar 28, 2009 11:44 pm

Re: Can't connect to adafruit.io via ethernet

Post by chrisspurgeon »

SWEET!

Off to try it, thanks!!!!!!

User avatar
chrisspurgeon
 
Posts: 37
Joined: Sat Mar 28, 2009 11:44 pm

Re: Can't connect to adafruit.io via ethernet

Post by chrisspurgeon »

IT WORKS!!!!

Everything compiled without errors, and I'm seeing data in my dashboard. THANKS SO MUCH!


P.S. During the compile, I got a couple of warnings. Here they are, just in case you need/want them...

Code: Select all

Compiling sketch...

In file included from /Users/chrisspurgeon/Documents/Arduino/libraries/Adafruit_IO_Arduino/src/AdafruitIO_Ethernet.h:17:0,
                 from /var/folders/0c/7c1k8k2j7sl3h77rhjm09_9h0000gp/T/arduino_build_406119/sketch/config.h:43,
                 from /var/folders/0c/7c1k8k2j7sl3h77rhjm09_9h0000gp/T/arduino_modified_sketch_962133/adafruitio_00_publish.ino:18:
/Users/chrisspurgeon/Documents/Arduino/libraries/Adafruit_MQTT_Library/Adafruit_MQTT.h:28:0: warning: "strncpy_P" redefined [enabled by default]
 #define strncpy_P(dest, src, len) strncpy((dest), (src), (len))
 ^
In file included from /Users/chrisspurgeon/Library/Arduino15/packages/adafruit/hardware/samd/1.3.0/cores/arduino/Arduino.h:36:0,
                 from /var/folders/0c/7c1k8k2j7sl3h77rhjm09_9h0000gp/T/arduino_build_406119/sketch/adafruitio_00_publish.ino.cpp:1:
/Users/chrisspurgeon/Library/Arduino15/packages/adafruit/hardware/samd/1.3.0/cores/arduino/avr/pgmspace.h:74:0: note: this is the location of the previous definition
 #define strncpy_P(s1, s2, n) strncpy((s1), (s2), (n))
 ^
In file included from /Users/chrisspurgeon/Documents/Arduino/libraries/Adafruit_IO_Arduino/src/AdafruitIO_Ethernet.h:17:0,
                 from /var/folders/0c/7c1k8k2j7sl3h77rhjm09_9h0000gp/T/arduino_build_406119/sketch/config.h:43,
                 from /var/folders/0c/7c1k8k2j7sl3h77rhjm09_9h0000gp/T/arduino_modified_sketch_962133/adafruitio_00_publish.ino:18:
/Users/chrisspurgeon/Documents/Arduino/libraries/Adafruit_MQTT_Library/Adafruit_MQTT.h:29:0: warning: "strncasecmp_P" redefined [enabled by default]
 #define strncasecmp_P(f1, f2, len) strncasecmp((f1), (f2), (len))
 ^
In file included from /Users/chrisspurgeon/Library/Arduino15/packages/adafruit/hardware/samd/1.3.0/cores/arduino/Arduino.h:36:0,
                 from /var/folders/0c/7c1k8k2j7sl3h77rhjm09_9h0000gp/T/arduino_build_406119/sketch/adafruitio_00_publish.ino.cpp:1:
/Users/chrisspurgeon/Library/Arduino15/packages/adafruit/hardware/samd/1.3.0/cores/arduino/avr/pgmspace.h:72:0: note: this is the location of the previous definition
 #define strncasecmp_P(s1, s2, n) strncasecmp((s1), (s2), (n))
 ^

 

User avatar
brubell
Learn User Page
 
Posts: 2017
Joined: Fri Jul 17, 2015 10:33 pm

Re: Can't connect to adafruit.io via ethernet

Post by brubell »

chrisspurgeon wrote:IT WORKS!!!!

Everything compiled without errors, and I'm seeing data in my dashboard. THANKS SO MUCH!
No problem, thanks for waiting while I sorted out the issue.

Locked
Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.

Return to “Internet of Things: Adafruit IO and Wippersnapper”