Adafruit connect not working anymore

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
gvandesompel
 
Posts: 6
Joined: Fri Aug 12, 2022 1:10 pm

Adafruit connect not working anymore

Post by gvandesompel »

hello all,
I hope somebody can help me out here with a strange issue. (project: "soil moisture measurement")
The code below is working since quite some time on an old ESP8266.(ESP12 mod) It' still functional.
I've uploaded the same code to another new ESP8266. This doesn't work: Error "Disconnected from Adafruit IO" ??
I am sure The Wifi connection is online. ( IP address etc) but on this new similar device there is no Adafruit IO connection possible?
The right Adafruit login + key is written in the config file.

Somebody? I am really lost.

Code: Select all

// edit the config.h tab and enter your Adafruit IO credentials
// and any additional configuration needed for WiFi, cellular,
// or ethernet clients.
#include "config.h"

/************************ Example Starts Here *******************************/

// vochtsensor pin
#define PULS_PIN 5 //D1
#define SENSOR_PIN A0

// photocell state
int current = 0;
int last = -1;

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

void setup() {

  // setup de vochtsensor pins
  pinMode(PULS_PIN, OUTPUT);
  digitalWrite(PULS_PIN, LOW);

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

  // wait for serial monitor to open
  while(! Serial);

  // connect to io.adafruit.com
  Serial.print("Connecting to Adafruit IO");
  io.connect();

  // wait for a connection
  while(io.status() < AIO_CONNECTED) {
    Serial.print(".");
    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();

  //lezen van de vochtsensor
  digitalWrite(PULS_PIN, HIGH);
  int meting = analogRead(SENSOR_PIN);
  current = meting;
  digitalWrite(PULS_PIN, LOW);

  // return if the value hasn't changed
  if(current == last)
    return;

  // save the current state to the analog feed
  Serial.print("sending -> ");
  Serial.println(current);
  analog->save(current);
  
  // store last photocell state
  last = current;

  // wait three seconds (1000 milliseconds == 1 second)
  //
  // because there are no active subscriptions, we can use delay()
  // instead of tracking millis()
  delay(30000);
}

User avatar
bidrohini
 
Posts: 202
Joined: Thu Oct 20, 2022 10:03 am

Re: Adafruit connect not working anymore

Post by bidrohini »

Is the second ESP really functional? Have you tested that board separately? Disconnect your sensor and try to upload a simple code to that second ESP board. This way you can make sure if the esp is good or not.

User avatar
gvandesompel
 
Posts: 6
Joined: Fri Aug 12, 2022 1:10 pm

Re: Adafruit connect not working anymore

Post by gvandesompel »

Yes, this one is functional.
I even tried with 2 new ones. A simple wifiscan sketch is functional.

The only difference between the 2 new esp's and the working old one is it's another brand. ( pin layout is the same however)

It's very strange. :-(

User avatar
gvandesompel
 
Posts: 6
Joined: Fri Aug 12, 2022 1:10 pm

Re: Adafruit connect not working anymore

Post by gvandesompel »

It appears the solution was an upgrade of the ESP8266 package in the Arduino Board manager!
I don't understand why. I didn't realize before this could be so sensitive for the same code on a newer ESP device.

I would appreciate it if somebody could explain the "reason why" to me...?

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

Re: Adafruit connect not working anymore

Post by brubell »

The Arduino ESP8266 core hasn't been released for a while, see latest releases here: https://github.com/esp8266/Arduino/releases

Likely your board was running a much older version of the board support package and the latest version fixed some bug within WiFi or MQTT connectivity.

User avatar
gvandesompel
 
Posts: 6
Joined: Fri Aug 12, 2022 1:10 pm

Re: Adafruit connect not working anymore

Post by gvandesompel »

brubell wrote: Tue Jan 03, 2023 2:08 pm The Arduino ESP8266 core hasn't been released for a while, see latest releases here: https://github.com/esp8266/Arduino/releases

Likely your board was running a much older version of the board support package and the latest version fixed some bug within WiFi or MQTT connectivity.
Thanks!

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”