Using web browser, I can only connect to the CC3000 server ip after starting Serial monitor. After, 1 to 4 connections --(depending on the length of time between connections) I can no longer connect to CC3000 server ip.
What do I need to make server available 24/7, continuously?
I log Date, Time Temperature, Humidity, and Barometric pressure every 15 minutes to SD card. This part of sketch is working correctly. Part that is failing is the web display of the data; after 1 to 4 connections. Also, I have included the ability to download data from the SD Card via a download link. Download works most of the time --until file size gets to be ~ 100 kilobytes. Most concerned on making server available all the time.
Is this possible without addition hardware?
I am using an Arduino Mega 2560 and Adafruit CC3000 shield with Firmware 1.28.
Can you make CC3000 server available all the time?
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- tech500
- Posts: 199
- Joined: Wed Dec 04, 2013 3:53 pm
Can you make CC3000 server available all the time?
- Attachments
-
- CC3000_Weather_Observations_Webserver.zip
- (6.48 KiB) Downloaded 47 times
- adafruit_support_mike
- Posts: 67454
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Can you make CC3000 server available all the time?
The code you posted is pretty large. There are enough moving pieces that it will be hard to isolate specific problems.
Try creating a new sketch and write the simplest webserver you possibly can. Get that running and stable, then start adding pieces to it. Add things one at a time, testing to make sure the code works the way you expect it to each step of the way. That process will make problems easier to find and fix.
Try creating a new sketch and write the simplest webserver you possibly can. Get that running and stable, then start adding pieces to it. Add things one at a time, testing to make sure the code works the way you expect it to each step of the way. That process will make problems easier to find and fix.
- tech500
- Posts: 199
- Joined: Wed Dec 04, 2013 3:53 pm
Re: Can you make CC3000 server available all the time?
I have eliminated most of my code. Converted part of the web server found on arduino.cc playground to work with the Adafruit CC3000 Shield.
Behavior is close to what I have been experiencing. Made a couple of changes to delays at the end of the listen function.
The most consecutive server webpages I have been able to open are eleven of eleven attempts. This is opening the webpage immediately after seeing "Ready" on the serial monitor.
I am planning to try longer period between opening the next server web page.
William
Behavior is close to what I have been experiencing. Made a couple of changes to delays at the end of the listen function.
The most consecutive server webpages I have been able to open are eleven of eleven attempts. This is opening the webpage immediately after seeing "Ready" on the serial monitor.
I am planning to try longer period between opening the next server web page.
William
- Attachments
-
- Simplified_webserver.zip
- (3.74 KiB) Downloaded 48 times
- adafruit_support_mike
- Posts: 67454
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Can you make CC3000 server available all the time?
Try adding a call to 'cc3000.checkConnected()'. That tests the wifi link.
Wifi connections are more vulnerable to noise and interference than wired connections, so you can't rely on the data-link layer staying connected indefinitely. It's a good idea to test it before you enter the 'do the network stuff' block, and have logic to shut down the existing connection and make a new connection if necessary.
Wifi connections are more vulnerable to noise and interference than wired connections, so you can't rely on the data-link layer staying connected indefinitely. It's a good idea to test it before you enter the 'do the network stuff' block, and have logic to shut down the existing connection and make a new connection if necessary.
- tech500
- Posts: 199
- Joined: Wed Dec 04, 2013 3:53 pm
Re: Can you make CC3000 server available all the time?
Added cc3000.checkConnected() and added following code prior to setup:
Still testing; has been able to make connections for one hour. Will see how long it will make connections.
Code: Select all
const unsigned long
dhcpTimeout = 60L * 1000L, // Max time to wait for address from DHCP
connectTimeout = 15L * 1000L, // Max time to wait for server connection
responseTimeout = 15L * 1000L; // Max time to wait for data from server
- Attachments
-
- CC3000_Weather_Observations_Webserver.zip
- (6.33 KiB) Downloaded 43 times
- tech500
- Posts: 199
- Joined: Wed Dec 04, 2013 3:53 pm
Re: Can you make CC3000 server available all the time?
Back to testing Simplified_webserver.
Switched out Adafruit_CC3000_Server.h for this one: http://code.ohloh.net/file?fid=DRlVCO1n ... ed=true#L0 by Tony DiCola .
Have been able to connect to server ip for the last 4 hours and still making connections. Will see how it does; time will tell
Switched out Adafruit_CC3000_Server.h for this one: http://code.ohloh.net/file?fid=DRlVCO1n ... ed=true#L0 by Tony DiCola .
Code: Select all
// Initialize the server and start listening for connections.
void Adafruit_CC3000_Server::begin() {
// Set the CC3000 inactivity timeout to 0 (never timeout). This will ensure
// the CC3000 does not close the listening socket when it's idle for more than
// 60 seconds (the default timeout). See more information from:
// http://e2e.ti.com/support/low_power_rf/f/851/t/292664.aspx
unsigned long aucDHCP = 14400;
unsigned long aucARP = 3600;
unsigned long aucKeepalive = 30;
unsigned long aucInactivity = 0;
- tech500
- Posts: 199
- Joined: Wed Dec 04, 2013 3:53 pm
Re: Can you make CC3000 server available all the time?
7/18/2014 Update:
Happy to report, I have been able to make connections for 24 hours; without needing to re-initialize CC3000 Shield!!!
This was accomplished switching out the Adafruit_CC3000_Server.h with one I linked to previously.
William
Happy to report, I have been able to make connections for 24 hours; without needing to re-initialize CC3000 Shield!!!
This was accomplished switching out the Adafruit_CC3000_Server.h with one I linked to previously.
William
Last edited by tech500 on Fri Jul 18, 2014 5:10 pm, edited 1 time in total.
- tdicola
- Posts: 1074
- Joined: Thu Oct 17, 2013 9:11 pm
Re: Can you make CC3000 server available all the time?
Ah, that's great that it's stable for you now. It's a little tough to tell but what was the change you made that helped the stability?
- tech500
- Posts: 199
- Joined: Wed Dec 04, 2013 3:53 pm
Re: Can you make CC3000 server available all the time?
Deleted the current Adafruit CC3000 Library version of "Adafruit_CC3000_Server.h." I made no changes to the posted "Adafruit_CC3000_Server.h" I found by searching with "Google" for "cc3000 socket inactivity timeout." Copied the file into the libraries folder; replacing the original "Adafruit_CC3000_Server.h." Made connections during 24 hour period without needing to re-initialize the CC3000 Shield. The web link to file is in an earlier part of this message thread.
I think the most important thing was setting of the socket inactivity timeout to "never timeout" IMHO.
William
I think the most important thing was setting of the socket inactivity timeout to "never timeout" IMHO.
William
- tdicola
- Posts: 1074
- Joined: Thu Oct 17, 2013 9:11 pm
Re: Can you make CC3000 server available all the time?
Ah thanks for clarifying. The server code in the library right now should be setting the inactivity timeout to 0 (it's in the server's begin() function) with the same code so it might have been an issue with an older version of the library. Good to hear it's working for you now, thanks for the followup!
- tech500
- Posts: 199
- Joined: Wed Dec 04, 2013 3:53 pm
Re: Can you make CC3000 server available all the time?
Serial_Monitor_capture.txt shows repeated connections to web server with only one Adafruit CC3000 Shield initialization --on a local network connection.
Forwarding a port for an external ip address; I only connect a couple times. Sketch is the same in both cases. ISP is att u-verse. I have been able to connect once from a remote location --this leads be to believe the port is open and that it is making it thru the Gateway.
I did find one point in the sketch that needed to have connection closed after logging to SD Card every 15 minutes.
Attached latest version: CC3000_Weather_Observation_Webserver.zip
Forwarding a port for an external ip address; I only connect a couple times. Sketch is the same in both cases. ISP is att u-verse. I have been able to connect once from a remote location --this leads be to believe the port is open and that it is making it thru the Gateway.
I did find one point in the sketch that needed to have connection closed after logging to SD Card every 15 minutes.
Attached latest version: CC3000_Weather_Observation_Webserver.zip
- Attachments
-
- CC3000_Weather_Observations_Webserver.zip
- (6.36 KiB) Downloaded 35 times
-
- Serial_Monitor_capture.txt
- (9.88 KiB) Downloaded 153 times
- tech500
- Posts: 199
- Joined: Wed Dec 04, 2013 3:53 pm
Re: Can you make CC3000 server available all the time?
I test for four GET requests; GET /, GET /index.htm, GET /favicon, and GET /log.txt. I was seeing in the serial monitor other attempts to go to non-existing pages; causing the connection to reset and not allowing re-connection.
Now I check for NOT the four conditions, I checked the NOT of the above conditions; any attempt that meets this condition gets a "Page Not Found" and the connection is closed.
Made the change tonight --still testing.
Now I check for NOT the four conditions, I checked the NOT of the above conditions; any attempt that meets this condition gets a "Page Not Found" and the connection is closed.
Made the change tonight --still testing.
- Attachments
-
- Rev__CC3000_Weather_Observations_Webserver.zip
- Arduino Mega sketch Added "Page Not Found"
- (6.59 KiB) Downloaded 35 times
Last edited by tech500 on Sat Aug 09, 2014 12:09 am, edited 1 time in total.
- tech500
- Posts: 199
- Joined: Wed Dec 04, 2013 3:53 pm
Re: Can you make CC3000 server available all the time?
Has anyone seen "Get /currentsetting.htm HTTP 1.1" in Serial Monitor with the CC3000; it has the Host IP of the CC300." It appears to happen at the same interval as when I attempt to log data at fifth-teen minute interval; which is skipped due to the "currentsetting.htm event." No where in my code is there anything "currentsetting.htm".
I have elimated the listen function for testing now. Looks like the Data Logging at fifth-teen minute interval is back to every fifth-teen minutes.
I have elimated the listen function for testing now. Looks like the Data Logging at fifth-teen minute interval is back to every fifth-teen minutes.
- adafruit_support_mike
- Posts: 67454
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Can you make CC3000 server available all the time?
That string doesn't appear anywhere in the CC3000 library either. It must be something you're getting from the server.
What request gets processed just before that?
What request gets processed just before that?
- tech500
- Posts: 199
- Joined: Wed Dec 04, 2013 3:53 pm
Re: Can you make CC3000 server available all the time?
I see no other request immediately before event; Attaching screen capture of the Serial Monitor.
Believe this to be an external request; there is a port forwarded on the router.
Latest sketch update allowed consecutive CC3000 connections during a 11 hour period before stopping --sketch was still running and logging data.
William
Believe this to be an external request; there is a port forwarded on the router.
Latest sketch update allowed consecutive CC3000 connections during a 11 hour period before stopping --sketch was still running and logging data.
William
- Attachments
-
- CC3000_Weather_Observations_Webserver.zip
- This is the version that was running when "Currentsetting.htm" was encountered.
- (6.54 KiB) Downloaded 34 times
-
- Shows "currentsetting.htm" event. Event occurred all during 11 hour period.
- Serial Monitor.jpg (50.3 KiB) Viewed 829 times
Please be positive and constructive with your questions and comments.