sirleech/Webduino

Convert to use on WiFi Shield

Opened this issue · 19 comments

I forked your Webduino library and managed to get it working with a few changes for the WiFi shield here:

https://github.com/acarlton/Webduino/tree/wifi

Just wanted to say great work. Didn't know how to contact you except via an issue. Thanks!

OK, cool! (I think this was the first time someone forked my code and
actually did something with it. :) Unfortunately I don't have a
wifi-shield to test with.

cheers, Simon

On 03.10.2012 21:23, Aaron wrote:

I forked your Webduino library and managed to get it working with a
few changes for the WiFi shield here:

https://github.com/acarlton/Webduino/tree/wifi

Just wanted to say great work. Didn't know how to contact you except
via an issue. Thanks!


Reply to this email directly or view it on GitHub
#20.

Well, it works perfectly so far, but mostly (I think) due to the fact that
the client and server objects are either shared or identical between the
Ethernet lib and the WiFi lib. Just wanted to say thanks!

On Wed, Oct 3, 2012 at 11:30 AM, Simon Rönnqvist
notifications@github.comwrote:

OK, cool! (I think this was the first time someone forked my code and
actually did something with it. :) Unfortunately I don't have a
wifi-shield to test with.

cheers, Simon

On 03.10.2012 21:23, Aaron wrote:

I forked your Webduino library and managed to get it working with a
few changes for the WiFi shield here:

https://github.com/acarlton/Webduino/tree/wifi

Just wanted to say great work. Didn't know how to contact you except
via an issue. Thanks!


Reply to this email directly or view it on GitHub
#20.


Reply to this email directly or view it on GitHubhttps://github.com//issues/20#issuecomment-9116934.

That's funny, didn't work all that perfectly for me. I had to make the
javascript not make too frequent ajax-requests in order not to tilt the
arduino. Still if you try changing colors like crazy you'll probably
manage to tilt your arduino. I think I'm going to try implementing
something similar using a Raspberry Pi at some point, that'd offer
proper robustness and would also allow me to run both a web server (to
serve the files) and a web socket server to communicate with, an arduino
can only run either one. And web socket would really be the way to go,
but with an arduino you'd need to serve the files from some other place.

cheers, Simon

On 03.10.2012 21:39, Aaron wrote:

Well, it works perfectly so far, but mostly (I think) due to the fact
that
the client and server objects are either shared or identical between the
Ethernet lib and the WiFi lib. Just wanted to say thanks!

On Wed, Oct 3, 2012 at 11:30 AM, Simon Rönnqvist
notifications@github.comwrote:

OK, cool! (I think this was the first time someone forked my code and
actually did something with it. :) Unfortunately I don't have a
wifi-shield to test with.

cheers, Simon

On 03.10.2012 21:23, Aaron wrote:

I forked your Webduino library and managed to get it working with a
few changes for the WiFi shield here:

https://github.com/acarlton/Webduino/tree/wifi

Just wanted to say great work. Didn't know how to contact you except
via an issue. Thanks!


Reply to this email directly or view it on GitHub
#20.


Reply to this email directly or view it on
GitHubhttps://github.com//issues/20#issuecomment-9116934.


Reply to this email directly or view it on GitHub
#20 (comment).

The Webduino wifi fork works great. I took the library "as is" and it ran out of the box. From the examples, I used the "Web_Demo" sketch as a starting point. The example sketches need conversion from Ethernet to WiFi, but that is easy. First, replace the Ethernet references in the sketch to WiFi. Then redo the setup from setting up the Ethernet IP and mac address to setting up the wifi radio with ssid and password wifi (example on the official Arduino web site). Also reserve pin 53 (mega) as an output for the wifi shield to operate properly.

By the way, I used two recently purchased official Arduino wifi shields, and they both had to be reflashed with the latest firmware to work properly:

http://www.dfrobot.com/community/2012/11/how-to-upgrade-arduino-wifi-shield-firmware-on-windows/

The Web_Demo sketch had two other issues. First, the digital pins were set up as INPUT, which made their values unstable, causing the radio buttons to lose their state after an update. Just change the pinMode setting loop to OUTPUT. That makes the radio buttons work correctly.

Second, the "server << " line that sets the beginning of the HTML form for the radio buttons was content sensitive. It put out nothing instead of the "server << "

";" I narrowed it down to an inability to print "" using the "server <<" syntax, but could not fix it. I think it may be a bug in some library.

Thanks for doing all of the work on this. I have now successfully run the official wifi shield with a Mega 2560 for four days and over 500 page loads.

Hi DonKnowlton I am new to webduino and found your comment about exactly what I was trying to tackle. Can you instruct how exactly you convert the ethernet to wifi? thank you

Here are a few thoughts to establish a baseline of where my project stands.

My goal is a stand alone web server to control digital functions remotely and return analog and digital data upon request through a web browser. I want to be able to leave the server unattended for at least three months.

I tried various web servers sketches from the arduino web site and other sources, but they usually hung up in short order, especially trying to handle rapidly occurring requests from multiple clients.

The Webduino had two main advantages. First, the Webduino library handles the mechanics of the server-client communication, so I could focus on my application and a little HTML. Secondly, it seemed reliable, I had it on the external internet for ten days and loaded over 300 pages with no problem. I was able to view my pages from over 100 miles away with Firefox, iPad Safari, iMac Safari, and IE.

Since my previous post I have found a reliability problem, but I don't think it is because of Webduino. At ten days, I had a power failure that affected both my arduino and my LAN. When power came back, the arduino could not be reached from a client. After a few experiments, I determined that the wifi shield does reconnect, but the sketch just stays in void loop() and does not see the client request. If the project does not see an operating LAN when it powers up, it eventually connects but can't handle a client request. In my case the ATT Uverse router takes about two minutes to start up so the arduino does not see a valid network because the arduino/wifi shield returns from a power failure in less than 20 seconds.

I suspect the problem is either the wifi shield firmware or the wifi shield library. The firmware is clearly in flux and has been updated two days ago and three weeks ago. I reflashed my firmware, but that was way back in early December. As shipped, the shield was extremely unreliable before reflash of the firmware.

So, first priority is to be sure your firmware is current. I plan to reflash my shield next week and see if that fixes the above problem.

You are new to Webduino, do you have arduino and/or C++ experience? I am new to all of these. I don't see a way to put my sketch up on this forum. If you request, I will send it to you by email and would appreciate hearing back if you solve the power recovery problem.

Otherwise, my advice is to use the forked Webduino library:

https://github.com/acarlton/Webduino/tree/wifi

And:

Observe the pin restrictions in the wifi shield documentation. Some of them conflict with the pins in the Webduino examples. The Webduino examples at this link have not been converted from ethernet to wifi.

Add the wifi connection setup to the sketch. Put it in the void loop(), not void setup() if you think your wifi might ever need to reconnect after the initial connection. Set up sequences are in the web server examples on the arduino web site.

Take out mac address and lan address setting instructions. Ethernet shields need this, the wifi shield gets these automatically.

Be sure to reflash the firmware!!

By the way, some of my text in the previous comment was garbled because I was trying to send text describing my HTML. My comments were interpreted as HTML and not printed literally. I don't know how to avoid that.

Thank you for your thorough reply.

I don't have much experience in arduino and C/C++. It would much
appreciated if you can send
me your code showing how you make the conversion from ethernet to wifi .

On Sat, Jan 19, 2013 at 1:44 PM, DonKnowlton notifications@github.comwrote:

Here are a few thoughts to establish a baseline of where my project stands.

My goal is a stand alone web server to control digital functions remotely
and return analog and digital data upon request through a web browser. I
want to be able to leave the server unattended for at least three months.

I tried various web servers sketches from the arduino web site and other
sources, but they usually hung up in short order, especially trying to
handle rapidly occurring requests from multiple clients.

The Webduino had two main advantages. First, the Webduino library handles
the mechanics of the server-client communication, so I could focus on my
application and a little HTML. Secondly, it seemed reliable, I had it on
the external internet for ten days and loaded over 300 pages with no
problem. I was able to view my pages from over 100 miles away with Firefox,
iPad Safari, iMac Safari, and IE.

Since my previous post I have found a reliability problem, but I don't
think it is because of Webduino. At ten days, I had a power failure that
affected both my arduino and my LAN. When power came back, the arduino
could not be reached from a client. After a few experiments, I determined
that the wifi shield does reconnect, but the sketch just stays in void
loop() and does not see the client request. If the project does not see an
operating LAN when it powers up, it eventually connects but can't handle a
client request. In my case the ATT Uverse router takes about two minutes to
start up so the arduino does not see a valid network because the
arduino/wifi shield returns from a power failure in less than 20 seconds.

I suspect the problem is either the wifi shield firmware or the wifi
shield library. The firmware is clearly in flux and has been updated two
days ago and three weeks ago. I reflashed my firmware, but that was way
back in early December. As shipped, the shield was extremely unreliable
before reflash of the firmware.

So, first priority is to be sure your firmware is current. I plan to
reflash my shield next week and see if that fixes the above problem.

You are new to Webduino, do you have arduino and/or C++ experience? I am
new to all of these. I don't see a way to put my sketch up on this forum.
If you request, I will send it to you by email and would appreciate hearing
back if you solve the power recovery problem.

Otherwise, my advice is to use the forked Webduino library:

https://github.com/acarlton/Webduino/tree/wifi

And:

Observe the pin restrictions in the wifi shield documentation. Some of
them conflict with the pins in the Webduino examples. The Webduino examples
at this link have not been converted from ethernet to wifi.

Add the wifi connection setup to the sketch. Put it in the void loop(),
not void setup() if you think your wifi might ever need to reconnect after
the initial connection. Set up sequences are in the web server examples on
the arduino web site.

Take out mac address and lan address setting instructions. Ethernet
shields need this, the wifi shield gets these automatically.

Be sure to reflash the firmware!!

By the way, some of my text in the previous comment was garbled because I
was trying to send text describing my HTML. My comments were interpreted as
HTML and not printed literally. I don't know how to avoid that.


Reply to this email directly or view it on GitHubhttps://github.com//issues/20#issuecomment-12461722.

I am attaching the sketch. If you do not get it this way, send me your real
email address and I will send it there.

The sketch is a work in progress and has some things for temperature, real time
clock and SD logging included. The web server part is working.

It is sent "as is".

Here it is "onggenewu@gmail.com".
interesting I have been reading and commenting via my email without logging
into github. Sorry for the trouble and I am looking forward to your
sketch.

On Sun, Jan 20, 2013 at 8:15 AM, DonKnowlton notifications@github.comwrote:

I am attaching the sketch. If you do not get it this way, send me your
real
email address and I will send it there.

The sketch is a work in progress and has some things for temperature, real
time
clock and SD logging included. The web server part is working.

It is sent "as is".


Reply to this email directly or view it on GitHubhttps://github.com//issues/20#issuecomment-12472726.

DonKnowlton or bedfordking, could you send me that sketch? Im too having difficulty adapting the webduino library to my wifi... I get some compilation errors...

I never got the wifi shield to work reliably. The best it ever ran was for a week or so and then it locked up. Many times it failed within a few hours. Since then I have gone to using the webduino library with the ethernet shield. It requires a wired connection, but it has never failed. I have about 12 weeks of continuous operation. My conclusion is that there are problems with the official arduino wifi shield and its software that have never been fixed. Other people in various arduino forums have had similar experiences.

If you still want it, I can email the wifi webduino sketch to you. That requires a slight modification to the webduino library to run with wifi instead of ethernet. Do you still want it?

Don Knowlton

On Thursday, December 18, 2014 10:03 AM, jenriquecerda notifications@github.com wrote:

DonKnowlton or bedfordking, could you send me that sketch? Im too having difficulty adapting the webduino library to my wifi... I get some compilation errors...

Reply to this email directly or view it on GitHub.

Yes please send me the sketch. I have touched my arduino project for a
while. This discussion resume my interest to see if I can figure out
where the problem is. Thanks.

On Saturday, December 20, 2014, DonKnowlton notifications@github.com
wrote:

I never got the wifi shield to work reliably. The best it ever ran was for
a week or so and then it locked up. Many times it failed within a few
hours. Since then I have gone to using the webduino library with the
ethernet shield. It requires a wired connection, but it has never failed. I
have about 12 weeks of continuous operation. My conclusion is that there
are problems with the official arduino wifi shield and its software that
have never been fixed. Other people in various arduino forums have had
similar experiences.

If you still want it, I can email the wifi webduino sketch to you. That
requires a slight modification to the webduino library to run with wifi
instead of ethernet. Do you still want it?

Don Knowlton

On Thursday, December 18, 2014 10:03 AM, jenriquecerda <
notifications@github.com
javascript:_e(%7B%7D,'cvml','notifications@github.com');> wrote:

DonKnowlton or bedfordking, could you send me that sketch? Im too having
difficulty adapting the webduino library to my wifi... I get some
compilation errors...

Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
#20 (comment).

I cant believe what a piece of crap the shield resulted to be. 80 bucks thrown to the trash.

Ive also seen this is a persistent problem in other forums.

Enviado desde mi iPhone

El 20/12/2014, a las 9:47 p.m., bedfordking notifications@github.com escribió:

Yes please send me the sketch. I have touched my arduino project for a
while. This discussion resume my interest to see if I can figure out
where the problem is. Thanks.

On Saturday, December 20, 2014, DonKnowlton notifications@github.com
wrote:

I never got the wifi shield to work reliably. The best it ever ran was for
a week or so and then it locked up. Many times it failed within a few
hours. Since then I have gone to using the webduino library with the
ethernet shield. It requires a wired connection, but it has never failed. I
have about 12 weeks of continuous operation. My conclusion is that there
are problems with the official arduino wifi shield and its software that
have never been fixed. Other people in various arduino forums have had
similar experiences.

If you still want it, I can email the wifi webduino sketch to you. That
requires a slight modification to the webduino library to run with wifi
instead of ethernet. Do you still want it?

Don Knowlton

On Thursday, December 18, 2014 10:03 AM, jenriquecerda <
notifications@github.com
javascript:_e(%7B%7D,'cvml','notifications@github.com');> wrote:

DonKnowlton or bedfordking, could you send me that sketch? Im too having
difficulty adapting the webduino library to my wifi... I get some
compilation errors...

Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
#20 (comment).


Reply to this email directly or view it on GitHub.

I bought three of them. None worked properly. That's $250 down the toilet. I recommend Webduino with the Ethernet shield. Bedfordking, I previously sent this sketch to you. It has not changed.

Jenriquecerda, do you still want the wifi sketch? I can pretty much guarantee it is not reliable. If so, please send your private email address to me at fpga6@yahoo.com.

Don

On Dec 21, 2014, at 12:53 PM, jenriquecerda notifications@github.com wrote:

I cant believe what a piece of crap the shield resulted to be. 80 bucks thrown to the trash.

Ive also seen this is a persistent problem in other forums.

Enviado desde mi iPhone

El 20/12/2014, a las 9:47 p.m., bedfordking notifications@github.com escribió:

Yes please send me the sketch. I have touched my arduino project for a
while. This discussion resume my interest to see if I can figure out
where the problem is. Thanks.

On Saturday, December 20, 2014, DonKnowlton notifications@github.com
wrote:

I never got the wifi shield to work reliably. The best it ever ran was for
a week or so and then it locked up. Many times it failed within a few
hours. Since then I have gone to using the webduino library with the
ethernet shield. It requires a wired connection, but it has never failed. I
have about 12 weeks of continuous operation. My conclusion is that there
are problems with the official arduino wifi shield and its software that
have never been fixed. Other people in various arduino forums have had
similar experiences.

If you still want it, I can email the wifi webduino sketch to you. That
requires a slight modification to the webduino library to run with wifi
instead of ethernet. Do you still want it?

Don Knowlton

On Thursday, December 18, 2014 10:03 AM, jenriquecerda <
notifications@github.com
javascript:_e(%7B%7D,'cvml','notifications@github.com');> wrote:

DonKnowlton or bedfordking, could you send me that sketch? Im too having
difficulty adapting the webduino library to my wifi... I get some
compilation errors...

Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
#20 (comment).


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub.

I'm using a few Arduino Ethernet shields (not WiFi) to upload data to sites like Weather Underground, Xively, Twitter etc. I'm not using the Arduino as a web server. I find the sketches hang from time to time. Is there anything in webduino what would make this more reliable, or is Webduino only good for serving web pages?

I have not tried a client mode project. I don't know if Webduino supports that.

Don

On Dec 21, 2014, at 5:30 PM, Scott Goldthwaite notifications@github.com wrote:

I'm using a few Arduino Ethernet shields (not WiFi) to upload data to sites like Weather Underground, Xively, Twitter etc. I'm not using the Arduino as a web server. I find the sketches hang from time to time. Is there anything in webduino what would make this more reliable, or is Webduino only good for serving web pages?


Reply to this email directly or view it on GitHub.

For improved reliability, have you tried the watchdog timer?

http://www.megunolink.com/how-to-detect-lockups-using-the-arduino-watchdog/

Thanks for the link, I haven't seen a version of the WDT that outputs to the serial port where it hung, that's pretty cool. I've been intending to add WDT to my sketches. I've heard that it doesn't work properly on all Arduino's and some may need a new bootloader installed.

I have updated the most recent version of Webduino to be compatible with Arduino IDE v1.6.0+, if anyone is having problems with @acarlton's Wi-Fi fork.

https://github.com/struct78/Webduino/tree/wifi