0

Stability Issues?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Stability Issues?

by evilc66 on Tue Nov 10, 2015 10:38 am

I'm curious to see if anyone else is having this issue.

I'm using an ESP8266 Huzzah! board and trying the digital out sketch in the IO Basics repository. All that I have changed is the Wifi credentials and my AIO details. The power switch tail has been replaced by an LED on the output.

Connecting to wifi is no problem. Over the last two days though, connecting to AIO has been hit or miss. Yesterday, I couldn't connect at all. Today, it took 10 attempts before it managed to connect (serial output displayed below):

Code: Select all | TOGGLE FULL SIZE
WiFi connected
IP address:
192.168.43.41
Connecting to Adafruit IO... Connection failed
Retrying connection...
Connection failed
Retrying connection...
Connection failed
Retrying connection...
Connection failed
Retrying connection...
Connection failed
Retrying connection...
Connection failed
Retrying connection...
Connection failed
Retrying connection...
Connection failed
Retrying connection...
Connection failed
Retrying connection...
Adafruit IO Connected!


That's a bit of a pain, but not the end of the world. What's more annoying is that after I manage to connect to AIO, the connection remains spotty. After connecting, I'll send a command through the dashboard (just an on/off toggle switch sending 1 or 0). Sometimes it will work. Other times it will reset the connection (shown below)

Code: Select all | TOGGLE FULL SIZE
Connecting to Adafruit IO... Adafruit IO Connected!
Received:
Connecting to Adafruit IO... Adafruit IO Connected!
Received:
Received: 1
Connecting to Adafruit IO... Adafruit IO Connected!
Received:
Received: 1
Connecting to Adafruit IO... Adafruit IO Connected!
Received:
Received: 1
Received: 0
Received: 1
Received: 0
Connecting to Adafruit IO... Adafruit IO Connected!
Received:
Received: 1
Received: 0
Connecting to Adafruit IO... Adafruit IO Connected!
Received:


I'm not sure what is going on. At first I thought it may have been a power issue, as I was just powering it from the FTDI board, so I connected a 5v/2A power supply to it to make sure that the power was stable. It doesn't seem like it made any appreciable difference.

Anyone have any ideas?

evilc66
 
Posts: 9
Joined: Fri Sep 25, 2015 4:16 pm

Re: Stability Issues?

by evilc66 on Tue Nov 10, 2015 2:53 pm

I think I found the source of the issue, at least for me.

At the beginning of the loop() function, there is an if statement that pings the service and attempts to reconnect if the connection is dropped. Taking that section of code out made everything far more responsive and reliable. Not sure if the ping issue is due to my particular connection situation. I will try it on another network to see if the problem persists, but at least for now, I'm up and running more reliably than I was before.

evilc66
 
Posts: 9
Joined: Fri Sep 25, 2015 4:16 pm

Re: Stability Issues?

by k00kykelly on Mon Nov 16, 2015 1:24 am

I'm having this issue also. I put a few print statements in the code so I could get some visibility to what might be going on. The "mqtt.ping(3)" test fails regularly and the "mqtt.connected()" test fails every time it gets to that point in the code. The ping failures probably average out to 1 in 10 times through the loop. Whenever I see the ping test has failed on the serial output the mqtt message gets lost.

Deets:
Arduini Uno
CC3000 shield
running adafruit-io-basics-master/arduino_cc3000/digital_out

k00kykelly
 
Posts: 7
Joined: Thu Feb 06, 2014 10:01 pm

Re: Stability Issues?

by k00kykelly on Mon Nov 16, 2015 3:33 am

I upped the ping to 15 tries to see if it would avoid the if statement more often. It doesn't fail the ping test, but it also never receives any MQTT messages. Boo! Also, seems prone to time-out with the WDT. Tried 1 and 6, but neither of those were particularly good either.

It seems that the mqtt.connected might not be working properly and just defaults to 0. My C++ is rusty, but here are some relevant snippets of code from the MQTT library and my best guess of what is happening with those.


from Adafruit_MQTT.h - initializes the function to a fail-safe value of 0
// Return true if connected to the MQTT server, otherwise false.
virtual bool connected() = 0; // Subclasses need to fill this in!


from Adafruit_MQTT_CC3000.h - fills in with an actual status (specific to CC3000 hardware)
// connect to server
DEBUG_PRINTLN(F("Connecting to TCP"));
mqttclient = cc3000->connectTCP(serverip, portnum);

return mqttclient.connected();
.
.
.
bool connected() {
return mqttclient.connected();
}


from Adafruit_MQTT_Client.cpp
bool Adafruit_MQTT_Client::connected() {
// Return true if connected, false if not connected.
return client->connected();
}


Anyone know how to turn debug on? Is it "#define DEBUG_ENABLE 1" or something else? Knowing if the code was hitting that "Connecting to TCP" bit would be useful.

k00kykelly
 
Posts: 7
Joined: Thu Feb 06, 2014 10:01 pm

Re: Stability Issues?

by jwcooper on Mon Nov 16, 2015 1:17 pm

Please try again today. We've upgraded some software components in our backend to handle the higher volume we're getting now that we have so many more users in the beta test.

jwcooper
 
Posts: 666
Joined: Tue May 01, 2012 9:08 pm

Please be positive and constructive with your questions and comments.