Get Data from IOT Adafruit (Feeds)

Hi all,

I need to get the data from the feeds I have at IO Adafruit. I have an arduino 8266 on a remote location that send data to a dashboard at IO Adafruit and it's working well but I need to use a computer or my iPhone to see the data and I want to do that with another 8266 at home.

My 8266 at home is connecting to my account at IOT adafruit and evantually it will show it on an LCD display. For now it's only on Serial.print and it's enought for my test.

My problem is the following. I can get the data from 5 feeds but when I try to get the data for more than 5 feeds, all feeds after 5 are not working. No error message, I just don't get the data for more than 5 feeds.

The syntaxe is ok for those because If I cancell any of the frist five, the sixth one start working.

Maybe it's a limit of data with "onMessage"

#include "config.h"
#include <ESP8266WiFi.h>

#define Green 15 //LED to show I'm connected to Wi-Fi
#define Yellow 2 //LED to show I didn't received any data since..

//variables to store the data received from Feeds (IO Adafruit) for serial print

int Level_Bleu = 0;
int Flow_Bleu = 0;
int Level_Noir = 0;
int Sunshine = 0;
int E_D_H = 0;
int Batt_Volts = 0;


//Getting the feeds from my IO Adafruit dashboard

AdafruitIO_Feed *LevelBleu = io.feed("levelbleu");
AdafruitIO_Feed *FlowBleu = io.feed("flowbleu");
AdafruitIO_Feed *LevelNoir = io.feed("levelnoir");
AdafruitIO_Feed *Wlux = io.feed("wlux");
AdafruitIO_Feed *EDH = io.feed("detectedh");

AdafruitIO_Feed *BattVolts = io.feed("1-rv-batt");


int RemoteDataRX_Check = 0;

unsigned long previousMillis_1 = 0;
const long interval_1 = 1000;


void setup() {
 
   pinMode(Green, OUTPUT);
   digitalWrite(Green, LOW);

   pinMode(Yellow, OUTPUT);
   digitalWrite(Yellow, LOW);;
 
   Serial.begin(115200);

//*********************WiFi connexion and adafruit status 

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

   LevelBleu->onMessage(handleMessage1);
   FlowBleu->onMessage(handleMessage2);
   LevelNoir->onMessage(handleMessage3);
   Wlux->onMessage(handleMessage4);
   EDH->onMessage(handleMessage5);
   
   BattVolts->onMessage(handleMessage6);
   
      
// wait for a connection
   while(io.status() < AIO_CONNECTED) {
   Serial.println(".");
   Serial.println();
   Serial.println(io.statusText());
   delay(500);
   }
}


void handleMessage1(AdafruitIO_Data *data) {
  Serial.print("Level Bleu <-  ");Serial.println(data->toInt());Level_Bleu = data->toInt();RemoteDataRX_Check = 0;}
  
void handleMessage2(AdafruitIO_Data *data) {
  Serial.print("Flow Bleu <-  ");Serial.println(data->toInt());Flow_Bleu = data->toInt();RemoteDataRX_Check = 0;}
  
void handleMessage3(AdafruitIO_Data *data) {
  Serial.print("Level Noir <-  ");Serial.println(data->toInt());Level_Noir = data->toInt();RemoteDataRX_Check = 0;}
  
void handleMessage4(AdafruitIO_Data *data) {
  Serial.print("Sunshine <-  ");Serial.println(data->toInt());Sunshine = data->toInt();RemoteDataRX_Check = 0;}
  
void handleMessage5(AdafruitIO_Data *data) {
  Serial.print("EDH<-  ");Serial.println(data->toInt());E_D_H = data->toInt();RemoteDataRX_Check = 0;}


void handleMessage6(AdafruitIO_Data *data) {
  Serial.print("Batt Volts<-  ");Serial.println(data->toInt());Batt_Volts = data->toInt();RemoteDataRX_Check = 0;}



void connectionCheck(){

     if(WiFi.status()>= WL_CONNECTED){ 
     digitalWrite(Green, HIGH);
     }
     if(WiFi.status()!= WL_CONNECTED){ 
     digitalWrite(Green, LOW);
     }
}


void VR_RemoteDataRX_Check(){

     unsigned long currentMillis_1 = millis(); 
  if (currentMillis_1 - previousMillis_1 >= interval_1){

     RemoteDataRX_Check++;
     Serial.print("********************** Data Delay OK = ");
     Serial.println(RemoteDataRX_Check);
     previousMillis_1 = currentMillis_1;
   }
   
  if (RemoteDataRX_Check >= 90){
     digitalWrite(Yellow, HIGH);
     Serial.println("***************Missing Data");
     }else{
     digitalWrite(Yellow, LOW);
   }
}


void SerialPrint(){

     Serial.print("**************Level Bleu: ");Serial.println(Level_Bleu);
     Serial.print("**************Flow Bleu: ");Serial.println(Flow_Bleu);
     Serial.print("**************Level Noir: ");Serial.println(Level_Noir);
     Serial.print("**************Sunshine: ");Serial.println(Sunshine);
     Serial.print("**************EDH: ");Serial.println(E_D_H);

     Serial.print("**************Dc Batt: ");Serial.println(Batt_Volts);
} 


void loop() {
  
io.run();
connectionCheck();
VR_RemoteDataRX_Check();
//SerialPrint();
delay(300);
}

You'd probably be better off asking at the Adafruit IO Forum.

OK, we never know. I just post it on the IO Adafruit forum.

Let's see from which forum I get my answer.

Thanks

Wondering if there's a 5 feed limit on free Adafruit IO accounts. They'd know at the forum.

No, it as nothing to do with feeds limit. I have a paid account and all feeds are working on the web site or my iPhone.

My only problem it to received more than 5 feeds on my 8266 at home.

The ESP8266 may have a limit. In the AP mode I think it is limited to handling 5 clients, so it may have similar limits as to what you are doing.

Wow Zoomkat,

That's a very good hypothesis.

It's probably not the same of sending data to the IO Adafruit dashboard because I'm sending the data of 15 sensors with one 8266 to that dashboard without any problem and I can read the resukt on the web dashboard. Of course I'm sending the data
3 sensors at the time to not overload the maximum of 60 feeds a minute but on another project I'm sending 9 sensors data with another 8266 to another dashboard and it's working.

Reading the data from the IO Adafruit with a 8266 is not the same action as sending it so you may be rights.

Now, if it is a problem of 5 clients limit how can I split that in my code ?

For sending 15 sensors at a rate of 3 sensors at the time, I'm using swicth case to send 3 sensors data at the time with an interval in between.

If you look at my code to get the data from the feeds, you will see that I have to put the lines about the feeds at the beginning to load it in the 8266 memory when it start.

AdafruitIO_Feed *LevelBleu = io.feed("levelbleu");
AdafruitIO_Feed *FlowBleu = io.feed("flowbleu");
AdafruitIO_Feed *LevelNoir = io.feed("levelnoir");
AdafruitIO_Feed *Wlux = io.feed("wlux");
AdafruitIO_Feed *EDH = io.feed("detectedh");

AdafruitIO_Feed *BattVolts = io.feed("1-rv-batt");

Questions

Is there in the code, a way to flush that part of memory and include new feeds name? That way I could use a fonction that will load 5 feeds to get the data and then erase those 5 to input 5 new one and then gat the data from the new 5 feeds?

Also, keep in mind that the code is not reading the data that is already in the dashboard but it read the feeds as they arrive at the IO Adafruit dashboard. I monitored the feeds on the web page and I can see that when the feeds arrived at IO Adafruit, my 8266 at home is printing the data at the same time.