CC3000 connection drops after many polls

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
ranger9
 
Posts: 52
Joined: Tue Nov 23, 2010 8:05 pm

CC3000 connection drops after many polls

Post by ranger9 »

Hello --

I've read this thread (http://forums.adafruit.com/viewtopic.ph ... lit=CC3000), but my problem is different. I'm working on an internet-connected "smart thermostat" using a CC3000 module and a DHT22 sensor on a Menta board. My sketch connects to a PHP server to upload the DHT22's readings into a mySQL database (via GET args) and download user-entered commands (via a JSON-encoded string.)

All this works correctly on startup. However, the CC3000 invariably stops connecting after about 1,200 polls. The serial monitor shows the sketch is still running, but the CC3000 fails to connect.

I don't think the problem is at the server end, because I can press the reset button on the Menta to restart the sketch, and it will begin connecting again with no changes on the server.

Has anyone else encountered the situation of the CC3000 "giving up" after a period of usage? I've noticed the silver cover on top of the CC3000 module gets pretty warm to the touch during operation, and wonder if it might be heat-related. But that's only a guess!

Thanks for any info...

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: CC3000 connection drops after many polls

Post by adafruit_support_rick »

You may be running into a heap fragmentation issue. Are you using the String class, or doing malloc or any other sort of dynamic storage allocation?
Can you post the full text of your sketch?

User avatar
ranger9
 
Posts: 52
Joined: Tue Nov 23, 2010 8:05 pm

Re: CC3000 connection drops after many polls

Post by ranger9 »

Finally getting back to this project. The code is based on the WiFi Weather Station project on the ALS, so I figured it ought to work... but sure enough, when I included the FreeMem function out of the webClient example, and called it after each execution, I could see the free memory gradually getting smaller. Even with a stripped-down sketch I'm still dropping my connection after about 2,200 polls -- which gives me less than 200 hours of operation if I log once every five minutes.

I'm guessing that the issue is that my sketch (like WiFi Weather Station) uses a String to build the URI that sends data back to the web server. Unfortunately, I can't figure out any way around that, since I need for my data strings to be variable in length... unless somebody else has a clever idea...? If not, I may have to omit the data-logging feature out of my thermostat.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: CC3000 connection drops after many polls

Post by adafruit_support_rick »

You can define a char array that's long enough for the longest string you anticipate. Use C library calls like sprintf, strcat, etc. to construct the string in the array.

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

Return to “Other Arduino products from Adafruit”