Show Posts
|
|
Pages: 1 2 [3] 4 5 ... 408
|
|
31
|
Using Arduino / Networking, Protocols, and Devices / Re: WiFi shield (official) sending, but slowly
|
on: May 16, 2013, 02:20:33 pm
|
|
Flash helper:
F("")
Eg. Serial.print("hello"); // not using flash helper Serial.print(F("hello")); // using flash helper
This will save hello in flash so you can preserve SRAM. But according to pylon, this function uses write() so each character is creating a separate packet, slowing things down for wifi. You should still use it for serial to save memory.
|
|
|
|
|
32
|
Using Arduino / Networking, Protocols, and Devices / Re: Thumbs way down for Arduino WiFi shield. Read before you buy
|
on: May 16, 2013, 04:47:46 am
|
Documentation is one of the most neglected fields IMO, probably because not many people like doing it at any time much less at the end of a project when you want to get to the next fun thing.
I'm one of the few that actually enjoys documenting things.
______ Rob
Then we share more than just a hobby in Arduino! I recently started writing very detailed work log, well, not for money or contract or anything, but to document my learning process for my next big thing, arduino server project for a web based cross platform graphical user interface. I have grown to like documenting when I realized I can't possibly remember everything I did the day before. Lots of time I delay library release because docs aren't perfect 
|
|
|
|
|
34
|
Development / Suggestions for the Arduino Project / Arduino team, add version numbers on all your library/firmware/hardware!
|
on: May 15, 2013, 08:44:49 pm
|
I have found that there is no version number anywhere in any of the arduino library, firmware, and hardware, that I have come across, except for the occasional R2 R3 on hardware revisions. I do version numbers (all contract work, libraries, firmware, and PCB designs I do). This makes it easy to track down where the problems are. But Arduino team, you have a very different "use the latest thing" philosophy! Take the WiFi shield for example, there are multiple firmware and library and they don't all work together. I once downloaded some version of the firmware and library but after a few weeks, those versions are gone and replaced with the latest thing. How am I supposed to know which version is which, especially after I found out the latest thing you published isn't exactly working? Just read a few posts here to see how poorly the wifi shield firmware is: http://forum.arduino.cc/index.php?topic=166151.msg1238976#msg1238976http://forum.arduino.cc/index.php?topic=166592.msg1241413#msg1241413http://forum.arduino.cc/index.php?topic=123824.msg930868#msg930868http://forum.arduino.cc/index.php?topic=165549.msg1235221#msg1235221I can't even make an effective complaint. I have no number. I can say that an earlier version of library works with wifi R3 (no numbers) but the later version won't. That's it! So come on! You don't have just one arduino and one thing going on anymore. The sooner you slap on some version numbers, the better off you are. You're in a deep hole already so help us and help yourselves too! Add version numbers.
|
|
|
|
|
35
|
Using Arduino / Networking, Protocols, and Devices / Re: Using Arduino Wifi Shield to go to a website
|
on: May 15, 2013, 08:25:13 pm
|
Hey all, over the past few days I've been trying to upload data from my arduino to a google form with the arduino Wifi Shield. I can do this directly from the computer by just typing this url (or curl it from the linux terminal) https://docs.google.com/forms/d/1c0gzyIXkETkaHGN62b0BKmZ0iB4xwyxizh6pyWMKgso/formResponse?formkey=0ApzIQsGl6RoEdGVVdThrT2tyN2ZQZF82cHNfa1NFN3c&ifq&entry.860265578=1.01&entry.107732263=0&entry.1429283715=26.4&submit=Submit I just need a way of doing this from the arduino (basically just going to that website). I am a novice with using the WiFi shield so I really don't know where to start. All I have so far is the arduino connects to my network. First start a client in arduino, then do client.connect(server, 443) with char server[]="docs.google.com" (follow the wifiwebclient sample code). Then do: client.println("GET /forms/d/1c0gzyIXkETkaHGN62b0BKmZ0iB4xwyxizh6pyWMKgso/formResponse?formkey=0ApzIQsGl6RoEdGVVdThrT2tyN2ZQZF82cHNfa1NFN3c&ifq&entry.860265578=1.01&entry.107732263=0&entry.1429283715=26.4&submit=Submit HTTP/1.1"); client.println("Host:docs.google.com"); client.println("Connection: close"); client.println();
It's all theory though. I just tried it once. Did I post something on your form?
|
|
|
|
|
38
|
Using Arduino / Networking, Protocols, and Devices / Re: How to convert a string from char to ASCII
|
on: May 15, 2013, 07:51:34 pm
|
OOOPS! In example four (above) I forgot to type the single quotes. The BetaBrite.print line should read:
BetaBrite.print( 'theString' );
This gives an output on the display of: 8263
There must be some addition happening of the decimal bytes in the string.
Considering your internet background I won't laugh at you. These single quotes in C/C++ can only enclose one character, making them character literials, such as 'a', 'c', '"' (hard to read ' " '),or '\r' etc. By using 'theString' you only sent the first t in 'theString' and the result is garbage (could be consistent garbage but still garbage). If the BetaBrite.print does take String argument, you would do BetaBrite.print(theString);
|
|
|
|
|
39
|
Using Arduino / Networking, Protocols, and Devices / Re: Is iOS causing WiFi server to crash? Some speculations with numbers.
|
on: May 15, 2013, 07:24:29 pm
|
I don't know what really changed between the stock firmware in wifi shield R3 and the "latest" firmware. Same can be said about the arduino wifi library. Anyway. I reverted to the original wifi shield R3 since I have one other shield that I didn't upgrade firmware. I had to remove the latest arduino wifi library and revert to a previous version (again unable to mention version numbers cause there is NONE!). Now the iOS works nicely. I can repeatedly load web pages and there is no extra delay calling the server.available() anymore. Whatever the firmware dev guy did, didn't solve a few problems I had and only created more. Remember (to self mostly since nobody has replied so far) that when I said TWO chrome loads but actual log I posted has 4 logs from chrome all asking for "/"? How weird? Now with the original R3 and older library, the two duplicate GET from chrome turned out to be first "/" then"/favicon.ico". ew client GET / HTTP/1.1 Host: 192.168.1.14 Connection: keep-alive Cache-Control: max-age=0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 User-Agent: Mozilla/5.0 (Windows NT 6.0; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31 Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
client disconnected -- New client GET /favicon.ico HTTP/1.1 Host: 192.168.1.14 Connection: keep-alive Accept: */* User-Agent: Mozilla/5.0 (Windows NT 6.0; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31 Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
client disconnected ------- Time in server.available():0 ---------- Time in server.available():0 ---- Something is definitely wrong with current version of firmware and library!!!
|
|
|
|
|
41
|
Using Arduino / Networking, Protocols, and Devices / Re: Is iOS causing WiFi server to crash? Some speculations with numbers.
|
on: May 15, 2013, 06:41:57 pm
|
More clues: I added a simple if statement to restart server with server.begin() if the delay to call server.available() goes beyond 10ms. What happens is very disappointing. The server may have failed to restart (remember the time none of arduino library that has begin() has end()?). Then each subsequent restart adds more delay to the server.available() call time until it hits 100 ms. Still no way to connect to it once it becomes this state. Time in server.available():0 ---------- Time in server.available():0 ---------- Time in server.available():25 Restarting server. ---------- Time in server.available():49 Restarting server. ---------- Time in server.available():75 Restarting server. ---------- Time in server.available():99 Restarting server. ---------- Time in server.available():98 Restarting server. ---------- Time in server.available():100 Restarting server. ---------- Time in server.available():99 Restarting server. ---------- Time in server.available():99 Restarting server. ---------- Time in server.available():100
|
|
|
|
|
42
|
Using Arduino / Networking, Protocols, and Devices / Re: Is iOS causing WiFi server to crash? Some speculations with numbers.
|
on: May 15, 2013, 06:27:51 pm
|
|
I just tried every other browser including IE, chrome, firefox, tried quicktime, also android phone firefox. It was a lot of page refreshes and nothing went wrong. The server.available() while the server is idle is around 1 ms. Then I did one more with iphone 5, same thing happened as ipad2. The call to server.available() grew to 25ms each time and after that none can connect to the server.
This sample code is very simple and behavior is very persistent. So what is going on between iOS and Arduino WiFi shield? I'll get my Samsung Galaxy Tab II out for another round of test soon.
On a detailed look, the iOS HTTP request header is not particularly long (IE is longest), each line is not particular long (again IE sends longest line of request) so I don't think it is overrunning any buffers. I am not parsing the headers but just echoing on serial so they should have no effect other than size in wifi chip.
|
|
|
|
|
43
|
Using Arduino / Networking, Protocols, and Devices / Is iOS causing WiFi server to crash? Some speculations with numbers.
|
on: May 15, 2013, 05:57:17 pm
|
I have narrowed down a problem to the server.available() call. I have a skeletal program that is not much different from arduino sample code: This code will tick at one second interval to indicate it is still running by printing out a character to Serial. It will also time a call to server.available() every 10 second so it won't swamp the serial port with too many printouts. Now the interesting stuff (latest firmware and library): When the server is acting normally, the time spent with the server.available() call lasts 1-2 milliseconds (could be rounding error of millis). When the server is about to crash or no longer responds to client connection, the time spent with the server.available() call lasts about 25ms, indicating some sort of timer expired?! After this, every call to this function lasts this long and the Arduino code still runs (with the second ticking) but will not find any client anymore. A restart is needed. So what could be causing this problem? #include <WiFi.h> WiFiServer server(80); unsigned long refresher1; int status = WL_IDLE_STATUS; char ssid[] = ""; // my network SSID char pass[] = ""; // won't tell everybody my password int counter=0; void setup() { //Initialize serial and wait for port to open: Serial.begin(115200); delay(2000); unsigned long start=millis(); while (WiFi.status() == WL_NO_SHIELD) { if ((millis()-start)>30000) { Serial.println(F("WiFi shield not present")); // don't continue: while(true); } delay(500); } while ( status != WL_CONNECTED) { Serial.print(F("Attempting to connect to SSID: ")); Serial.println(ssid); status = WiFi.begin(ssid, pass); delay(10000); } server.begin(); printWifiStatus();
refresher1=millis(); } void loop() { int i=0; boolean check_time=false; if (millis()-refresher1>1000) // Ticks away { Serial.print("-"); refresher1=millis(); counter++; if (counter>=10) { counter=0; check_time=true; Serial.println(); //Serial.print("Free memory="); //Serial.println(freeMemory()); } }
unsigned long t1=millis(); // listen for incoming clients WiFiClient client = server.available(); if (check_time) { Serial.print(F("Time in server.available():")); Serial.println(millis()-t1); } if (client) { unsigned long client_connected_timer=millis(); Serial.println(F("\r\nNew client")); // an http request ends with a blank line boolean currentLineIsBlank = true; while ((WiFi.status() == WL_CONNECTED)&&client.connected()&&(millis()-client_connected_timer<2000)) { if (client.available()) { char c = client.read(); Serial.write(c); if (c == '\n' && currentLineIsBlank) { client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); client.println("Connnection: close"); client.println(); client.println("<html>Just a test</html>"); client.println(); break; } if (c == '\n') { // you're starting a new line currentLineIsBlank = true; } else if (c != '\r') { // you've gotten a character on the current line currentLineIsBlank = false; } } } // give the web browser time to receive the data delay(25); client.flush(); // Make sure nothing is left when client disconnects. // close the connection: client.stop(); delay(25); Serial.println(F("client disconnected")); } } void printWifiStatus() { // print the SSID of the network you're attached to: Serial.print(F("SSID: ")); Serial.println(WiFi.SSID());
// print your WiFi shield's IP address: IPAddress ip = WiFi.localIP(); Serial.print(F("IP Address: ")); Serial.println(ip);
// print the received signal strength: long rssi = WiFi.RSSI(); Serial.print(F("signal strength (RSSI):")); Serial.print(rssi); Serial.println(F(" dBm")); }
Here is a log: First there is no client, 1 ms spent looking for connected client. Then I used chrome browser twice, after that still looks for more client, spending 1 ms in the call. Then I tried firefox twice, same result. I then tried ipad 2, it spits out a lot of meaningless requests for its icons (can't imagine how much internet servers hate ipads cause of these meaningless traffic), and then after that the call to server.available() became 25 ms long and arduino still ticks away but won't find any clients even when I tried all 3 browsers (so the loading never gets anything back). Why is iOS making the server crash? I didn't have any of my code, just sample code with a few more sentences. Time in server.available():1 ---------- Time in server.available():1 ---------- Time in server.available():1 - New client GET / HTTP/1.1 Host: 192.168.1.5 Connection: keep-alive Cache-Control: max-age=0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 User-Agent: Mozilla/5.0 (Windows NT 6.0; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31 Referer: http://192.168.1.5/ Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
client disconnected
New client GET / HTTP/1.1 Host: 192.168.1.5 Connection: keep-alive Accept: */* User-Agent: Mozilla/5.0 (Windows NT 6.0; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31 Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
client disconnected - New client GET / HTTP/1.1 Host: 192.168.1.5 Connection: keep-alive Cache-Control: max-age=0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 User-Agent: Mozilla/5.0 (Windows NT 6.0; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31 Referer: http://192.168.1.5/ Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
client disconnected - New client GET / HTTP/1.1 Host: 192.168.1.5 Connection: keep-alive Accept: */* User-Agent: Mozilla/5.0 (Windows NT 6.0; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31 Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
client disconnected -- New client client disconnected ----- Time in server.available():1 ---------- Time in server.available():1 --- New client GET / HTTP/1.1 Host: 192.168.1.5 User-Agent: Mozilla/5.0 (Windows NT 6.0; WOW64; rv:20.0) Gecko/20100101 Firefox/20.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Referer: http://192.168.1.5/ Connection: keep-alive Cache-Control: max-age=0
client disconnected ---- New client GET / HTTP/1.1 Host: 192.168.1.5 User-Agent: Mozilla/5.0 (Windows NT 6.0; WOW64; rv:20.0) Gecko/20100101 Firefox/20.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Referer: http://192.168.1.5/ Connection: keep-alive Cache-Control: max-age=0
client disconnected --- Time in server.available():1 ---------- Time in server.available():1 ------- New client GET / HTTP/1.1 Host: 192.168.1.5 Connection: keep-alive Accept-Encoding: gzip, deflate User-Agent: Mozilla/5.0 (iPad; CPU OS 6_1_3 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B329 Safari/8536.25 Accept-Language: zh-cn Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
client disconnected
New client GET /apple-touch-icon-72x72-precomposed.png HTTP/1.1 Host: 192.168.1.5 Connection: keep-alive Accept-Encoding: gzip, deflate User-Agent: MobileSafari/8536.25 CFNetwork/609.1.4 Darwin/13.0.0 Accept-Language: zh-cn Accept: */*
client disconnected
New client GET /apple-touch-icon-72x72.png HTTP/1.1 Host: 192.168.1.5 Connection: keep-alive Accept-Encoding: gzip, deflate User-Agent: MobileSafari/8536.25 CFNetwork/609.1.4 Darwin/13.0.0 Accept-Language: zh-cn Accept: */*
client disconnected - New client GET /apple-touch-icon-precomposed.png HTTP/1.1 Host: 192.168.1.5 Connection: keep-alive Accept-Encoding: gzip, deflate User-Agent: MobileSafari/8536.25 CFNetwork/609.1.4 Darwin/13.0.0 Accept-Language: zh-cn Accept: */*
client disconnected
New client GET /apple-touch-icon.png HTTP/1.1 Host: 192.168.1.5 Connection: keep-alive Accept-Encoding: gzip, deflate User-Agent: MobileSafari/8536.25 CFNetwork/609.1.4 Darwin/13.0.0 Accept-Language: zh-cn Accept: */*
client disconnected -- Time in server.available():1 ---------- Time in server.available():1 ---------- Time in server.available():25 ---------- Time in server.available():25 ---------- Time in server.available():26 ---------- Time in server.available():25 --
|
|
|
|
|
45
|
Community / Website and Forum / Re: The Forum is Buggy
|
on: May 15, 2013, 12:14:24 pm
|
They don't do that here. "That didn't do that this time" would be more accurate, IMO. Yes, yes. I hope they do this more often than now. I do recall they announced a couple times about forum migration and some updates. They may have thought this was going to be routine stuff but it turned out it's buggy. It's like I can't say they (my university administrators) don't cancel classes due to snow storm. They did, twice this year (zero times in the past 6 years), once on an afternoon and it never snowed, another time at around 9:30am after it has snowed heavily for hours since midnight/early morning and they broke promise to announce at 6am). I think Arduino forum does better than that!
|
|
|
|
|