Black Lives Matter - Action and Equality.
0

IO Arduino Library not connecting with Feather M4 + Airlift
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.
Please be positive and constructive with your questions and comments.

IO Arduino Library not connecting with Feather M4 + Airlift

by vdonovan2000 on Sun Apr 19, 2020 9:28 pm

Hi friends, I'm trying to connect to Adafruit IO using a Feather M4 Express and the Airlift ESP32 co-processor.

This setup works fine using the WifiNINA library, set up as follows:
Code: Select all | TOGGLE FULL SIZE
#include <SPI.h>
#include <WiFiNINA.h>

// Configure the pins used for the ESP32 connection
#define SPIWIFI       SPI  // The SPI port
#define SPIWIFI_SS    10   // Chip select pin
#define ESP32_RESETN  6   // Reset pin
#define SPIWIFI_ACK   9   // a.k.a BUSY or READY pin
#define ESP32_GPIO0   -1


But when I try the adafruitio_00_publish example, the io.statusText() is "Network disconnected".
I'd appreciate any ideas, comments, or things to try.

Here is the adafruitio_00_publish config.h, showing the pin assignments:
Code: Select all | TOGGLE FULL SIZE
// uncomment the following line if you are using airlift
#define USE_AIRLIFT

// uncomment the following line if you are using winc1500
// #define USE_WINC1500

// comment out the following lines if you are using fona or ethernet
#include "AdafruitIO_WiFi.h"

#if defined(USE_AIRLIFT) || defined(ADAFRUIT_METRO_M4_AIRLIFT_LITE) ||         \
    defined(ADAFRUIT_PYPORTAL)
// Configure the pins used for the ESP32 connection
#if !defined(SPIWIFI_SS) // if the wifi definition isnt in the board variant
// Don't change the names of these #define's! they match the variant ones
#define SPIWIFI SPI
#define SPIWIFI_SS 10 // Chip select pin
#define NINA_ACK 9    // a.k.a BUSY or READY pin
#define NINA_RESETN 6 // Reset pin
#define NINA_GPIO0 -1 // Not connected
#endif
AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS, SPIWIFI_SS,
                   NINA_ACK, NINA_RESETN, NINA_GPIO0, &SPIWIFI);
#else
AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS);
#endif


Here is the main code from the example, which I haven't changed:
Code: Select all | TOGGLE FULL SIZE
// this int will hold the current count for our sketch
int count = 0;

// set up the 'counter' feed
AdafruitIO_Feed *counter = io.feed("counter");

void setup() {

  // start the serial connection
  Serial.begin(115200);

  // wait for serial monitor to open
  while(! Serial);
  Serial.println(" ");
  Serial.println("Connecting to Adafruit IO");

  // connect to io.adafruit.com
  io.connect();

  // wait for a connection
  while(io.status() < AIO_CONNECTED) {
    Serial.println(io.statusText());
    delay(500);
  }

  // we are connected
  Serial.println();
  Serial.println(io.statusText());

}

void loop() {

  // io.run(); is required for all sketches.
  // it should always be present at the top of your loop
  // function. it keeps the client connected to
  // io.adafruit.com, and processes any incoming data.
  io.run();

  // save count to the 'counter' feed on Adafruit IO
  Serial.print("sending -> ");
  Serial.println(count);
  counter->save(count);

  // increment the count by 1
  count++;

  // Adafruit IO is rate limited for publishing, so a delay is required in
  // between feed->save events. In this example, we will wait three seconds
  // (1000 milliseconds == 1 second) during each loop.
  delay(3000);

}

vdonovan2000
 
Posts: 16
Joined: Tue Mar 05, 2019 8:38 pm

Re: IO Arduino Library not connecting with Feather M4 + Airl

by Systembolaget on Tue Apr 21, 2020 12:36 pm

You are not alone viewtopic.php?f=56&t=164186 and viewtopic.php?f=56&t=163288 with trying to get an AirLift to work with any of the Adafruit IO library example sketches.

I had to resort to using the Adafruit MQTT library for the time being.

Systembolaget
 
Posts: 227
Joined: Wed Mar 08, 2017 1:01 pm

Re: IO Arduino Library not connecting with Feather M4 + Airl

by vdonovan2000 on Tue Apr 21, 2020 1:19 pm

Many thanks for your reply. I've resorted to using the ArduinoHttpClient and cobbling together the POST statements. I might try the MQTT library in the future.

vdonovan2000
 
Posts: 16
Joined: Tue Mar 05, 2019 8:38 pm

Re: IO Arduino Library not connecting with Feather M4 + Airl

by Systembolaget on Tue Apr 21, 2020 1:57 pm

Yeah, well, MQTT ain't that bad; it's just somewhat cumbersome and the Adafruit IO library has some useful functions the MQTT library hasn't, like sharing feeds in code, for example.

After buying AirLift FeatherWings upon recommendation, also seeing the supposedly straightforward usage https://learn.adafruit.com/adafruit-io-basics-airlift I am quite disappointed that it won't work, and I bought a ton of these parts for what is going to be remote tree and lake monitoring.

I still hope that someone from Adafruit will find out how it could work.

Systembolaget
 
Posts: 227
Joined: Wed Mar 08, 2017 1:01 pm

Re: IO Arduino Library not connecting with Feather M4 + Airl

by vdonovan2000 on Tue Apr 21, 2020 4:33 pm

I'm sorry to hear that things are not working out as you'd hoped. I think I'm going to give up on the Feather M4 + Airlift for my project. I happened to have them lying around so that's what I was using, but I'm finding the Airlift just too flakey. I used the Feather Huzzah on another project requiring WiFi, so I think I'll go with that instead.

Best of luck on your project!

vdonovan2000
 
Posts: 16
Joined: Tue Mar 05, 2019 8:38 pm

Re: IO Arduino Library not connecting with Feather M4 + Airl

by brubell on Fri May 08, 2020 11:24 am

Hi, I just pushed a patch to the library fixing this issue: https://github.com/adafruit/Adafruit_IO ... o/pull/118

Please let me know if it works for you, thanks!

brubell
 
Posts: 891
Joined: Fri Jul 17, 2015 10:33 pm

Re: IO Arduino Library not connecting with Feather M4 + Airl

by Systembolaget on Fri May 08, 2020 11:37 am

Great, thanks; I'll try it as soon as I can get around to it.

Systembolaget
 
Posts: 227
Joined: Wed Mar 08, 2017 1:01 pm

Re: IO Arduino Library not connecting with Feather M4 + Airl

by vdonovan2000 on Fri May 08, 2020 11:50 am

Thank you!

vdonovan2000
 
Posts: 16
Joined: Tue Mar 05, 2019 8:38 pm

Please be positive and constructive with your questions and comments.