Plot.ly Data Stops Sending

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
mjwilsun
 
Posts: 12
Joined: Wed Nov 26, 2014 2:41 pm

Plot.ly Data Stops Sending

Post by mjwilsun »

I'm using a cc3000 shield to try and send analog data to plot.ly but I can only get it to post data for between 20-30 seconds before it stops sending. I was trying the same with pushingbox and having the same issue. It would send for a short time and then just quit on me. I would love it if someone could shed some light on this for me.

My Serial return looks good:

... Initializing...
... Connected!
... Request DHCP
... Attempting to connect to plotly's REST servers
... Connected to plotly's REST servers
... Sending HTTP Post to plotly
... A-ok from plotly, All Streams Go!
... View your streaming plot here: https://plot.ly/~mjwilsun/4
... Connecting to plotly's streaming servers...
... Connected to plotly's streaming servers
... Initializing stream
... Done initializing, ready to stream!

And here is the code I'm working with:

Code: Select all

#include <Adafruit_CC3000.h>
#include <ccspi.h>
#include <SPI.h>
#include <plotly_streaming_cc3000.h>

#define photoresistor_pin 0 //analog pin 0

#define WLAN_SSID       "Wifi Name"
#define WLAN_PASS       "Wifi PW"
#define WLAN_SECURITY   WLAN_SEC_WPA2

// Sign up to plotly here: https://plot.ly
// View your API key and streamtokens here: https://plot.ly/settings
#define nTraces 1
// View your tokens here: https://plot.ly/settings
// Supply as many tokens as data traces
// e.g. if you want to ploty A0 and A1 vs time, supply two tokens
char *tokens[nTraces] = {"Plot.ly Token"};
// arguments: username, api key, streaming token, filename
plotly graph("Plot.ly Name", "Plot.ly Key", tokens, "filename", nTraces);



void wifi_connect(){
  /* Initialise the module */
  Serial.println(F("\n... Initializing..."));
  if (!graph.cc3000.begin())
  {
    Serial.println(F("... Couldn't begin()! Check your wiring?"));
    while(1);
  }

  // Optional SSID scan
  // listSSIDResults();

  if (!graph.cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY)) {
    Serial.println(F("Failed!"));
    while(1);
  }

  Serial.println(F("... Connected!"));

  /* Wait for DHCP to complete */
  Serial.println(F("... Request DHCP"));
  while (!graph.cc3000.checkDHCP())
  {
    delay(100); // ToDo: Insert a DHCP timeout!
  }
}


void setup() {
  graph.timezone = "America/Los_Angeles",
  graph.maxpoints = 1000;
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }

  wifi_connect();

  bool success;
  success = graph.init();
  if(!success){while(true){}}
  graph.openStream();
}

void loop() {
  int sensor_reading = analogRead(photoresistor_pin);
  graph.plot(millis(), sensor_reading, tokens[0]);
  delay(5000);
} 

User avatar
adafruit2
 
Posts: 22148
Joined: Fri Mar 11, 2005 7:36 pm

Re: Plot.ly Data Stops Sending

Post by adafruit2 »

where does it quit? at what point is it stuck? does it say its sending and its not? we need some more details :)

User avatar
mjwilsun
 
Posts: 12
Joined: Wed Nov 26, 2014 2:41 pm

Re: Plot.ly Data Stops Sending

Post by mjwilsun »

Thanks for the reply. The code is meant to run continuously, but I'm not sure how to find where or at what point it's getting stuck. As far as saying whether or not it's sending data, I only have that serial return saying that the connection has been made. I can watch the graph update in real time, but at sporadic and random time intervals it just stops. Is there a way for me to test where the problem is coming from?

User avatar
tdicola
 
Posts: 1074
Joined: Thu Oct 17, 2013 9:11 pm

Re: Plot.ly Data Stops Sending

Post by tdicola »

Just to check, you're using the Arduino & CC3000 library for plotly from here right? https://github.com/plotly/arduino-api Was just checking out the code to see if it had any potential issues with memory or buffers, but it looks great and only streams data out the HTTP connection as its available instead of buffering it in RAM on the Arduino (very easy to fill up the RAM with complex data that way).

One thing to try though, are you using the latest 1.13 firmware version on the CC3000? If not try upgrading to it by following the steps here: https://learn.adafruit.com/adafruit-cc3 ... e-upgrades The 1.13 release had some fixes that improve the stability of the CC3000's firmware and might help with lockups that you see here.

Also be sure to use Arduino IDE version 1.0.6 and not the beta versions like 1.5.7 or 1.5.8. Right now the beta versions have a newer avr-gcc toolchain that we've seen some issues with like lockups, so stick to 1.0.6 to make sure things run as best as they can.

Let me know if upgrading to 1.13 helps or if you have more questions, thanks!

User avatar
mjwilsun
 
Posts: 12
Joined: Wed Nov 26, 2014 2:41 pm

Re: Plot.ly Data Stops Sending

Post by mjwilsun »

Thanks tdicola (side note, I'm working towards doing your cloud thermometer project, but I wanted to get this working first. I was having the same issues with the amazon server as I am with this.). And I actually updated all of the cc3000 firmware prior to posting here to see if that was the issue and unfortunately it didn't fix the problem. I haven't installed the beta either, so that shouldn't be the issue.

Anything else you can think of that might be causing the problem? Hardware issue with the cc3000 itself?

User avatar
tdicola
 
Posts: 1074
Joined: Thu Oct 17, 2013 9:11 pm

Re: Plot.ly Data Stops Sending

Post by tdicola »

Oh nice, thanks for confirming it's at the most recent firmware. Let me take a look and try running a bit to repro. I'll try to see where the CC3000 is getting stuck and investigate a little more. My suspicion is the library might be sending stuff a little too fast for the CC3000 to handle. Is it just a normal Arduino Uno that you're using with it, or something else?

User avatar
mjwilsun
 
Posts: 12
Joined: Wed Nov 26, 2014 2:41 pm

Re: Plot.ly Data Stops Sending

Post by mjwilsun »

Sorry for the delayed response. But yes, it's the regular Arduino Uno and Adafruit cc3000.

User avatar
tdicola
 
Posts: 1074
Joined: Thu Oct 17, 2013 9:11 pm

Re: Plot.ly Data Stops Sending

Post by tdicola »

Circling back to this issue I haven't had a chance to try plotly's library to repro yet, but I did port over the latest 1.14 firmware version from TI. Just to check if the latest firmware has any fixes that help, can you try grabbing the latest CC3000 library code from github and installing the 1.14 firmware? I'm curious if you still get an intermittent lockup with that firmware. I should be able to check out plotly's library this weekend and try reproing myself. Thanks for the patience and help so far!

User avatar
mjwilsun
 
Posts: 12
Joined: Wed Nov 26, 2014 2:41 pm

Re: Plot.ly Data Stops Sending

Post by mjwilsun »

Thanks tdiCola. I've installed the latest firmware and unfortunately I'm still have the same issue. A random time between 5-10 seconds, and it just stops sending data.

User avatar
tdicola
 
Posts: 1074
Joined: Thu Oct 17, 2013 9:11 pm

Re: Plot.ly Data Stops Sending

Post by tdicola »

Had some time and was able to get everything setup and sending data to plotly. I haven't seen any lockups yet but have been running for just a few minutes. I do notice it seems to disconnect and reconnect periodically, but looking at their web interface it looks like data is still flowing to the graph (right now I'm just graphing noise from reading an ADC channel with nothing connected).

One thing I did notice though, installing their arduino library is a little odd. When you clone their repo it has a lot of subfolders and I think you only need to copy the plotly_streaming_cc3000 subfolder into your Arduino libraries folder. However after you copy that folder you should also delete the Adafruit_CC3000 subfolder they added inside it. It looks like they copied in an old version of the CC3000 library, and I have a feeling it will probably confuse Arduino's compiler (perhaps even have it use the old library code). I deleted this folder and am just using the latest CC3000 library code from Adafruit's github (installed as normal in the Arduino libraries folder). Also using firmware 1.13 for now. You might try nuking that Adafruit_CC3000 folder if its present in your plotly library, just to see if it helps.

Also one other thing, what Arduino IDE version are you using--is it 1.0.6? Make sure to use that version (or the beta version 1.5.6-R2). If you use 1.5.7 or 1.5.8 it has some known issues with its newer toolchain not working well with the CC3000 library right now. I'm using Arduino 1.5.6-R2 (can find it here http://arduino.cc/en/Main/OldSoftwareReleases).

I'll let this run and keep an eye on it to see how long it goes. You were seeing yours lock up after just a few seconds right?

User avatar
mjwilsun
 
Posts: 12
Joined: Wed Nov 26, 2014 2:41 pm

Re: Plot.ly Data Stops Sending

Post by mjwilsun »

Thanks for the reply. I won't be able to double check those versions for a couple days, but yes the lock up was happening after a few seconds. I'll post again when I check them and get rid of the sub folder.

User avatar
tdicola
 
Posts: 1074
Joined: Thu Oct 17, 2013 9:11 pm

Re: Plot.ly Data Stops Sending

Post by tdicola »

Hrm I noticed my graph stopped updating on plotly's website after about 5 minutes or so, but when I reloaded their website it was showing updates again. You might check if you repro the issue if you can refresh their website and still see data coming in to the site.

User avatar
mjwilsun
 
Posts: 12
Joined: Wed Nov 26, 2014 2:41 pm

Re: Plot.ly Data Stops Sending

Post by mjwilsun »

I didn't notice that problem, but since the data wasn't logging for very long I'm not surprised. I did try reloading and relogging in but it wasn't picking up any data for me.

User avatar
mjwilsun
 
Posts: 12
Joined: Wed Nov 26, 2014 2:41 pm

Re: Plot.ly Data Stops Sending

Post by mjwilsun »

I nuked that subfolder and it seems to have done the trick. I've been streaming data for 15 minutes with no interruption. I'm going to let it go for the day and see how it does.

User avatar
tdicola
 
Posts: 1074
Joined: Thu Oct 17, 2013 9:11 pm

Re: Plot.ly Data Stops Sending

Post by tdicola »

Oh nice, glad that helped with the reliability so far. Yeah I ran my example for a few hours and it seems to be pretty good about consistently reconnecting and keeping the data streaming to plotly's service. Let's see how things go with it for you too.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”