Using the Nuelectronics ethernet shield as a client
Update October: Decided to change direction with this ethernet shield, the code was not as stable as I first though. I have started using andrew lindsays library, I have uploaded an example using Andrew Lindsay's library here:
Simple Client using Andrew Lindsay's Library
see Web Logging and Graphing for example code and implementation
Caution outdated code - see update above
For reference only...
The nuelectronics ethernet shield makes it possible to add web connectivity to your project for a nice £12.50. Nuelectronics give a good guide on setting up the shield as a server and client here and here, but the code is somewhat hard to follow, after coming across Simon Monks simplified server library here I was inspired to have a go at making a simplified client library.
Like Simon Monks server library the client library sits like another layer above the nuelectronics library so you will need to download and place both libraries in your Arduino/Libraries folder. Credit must go also to nuelectronics for much of the code in the library I have just rearranged it, added a few things and packaged it in the library.
Version 2 is a bit of a rebuild, It includes better verbose debugging and is more similar in the way it is used to the official ethernet library, so if you already have code using the main ethernet library it should be straightforward to port over. I will document more of it when I get time. Let me know which one works best.
Download the NUClient library: NUClient2.0.tar.gz
Download the nuelectronics etherShield library here.
For information on setting up the server side of things have a look here
Version 1 files
Hello, is this library valid
Hello, is this library valid for a ethernet 28j60 ??
From what I am aware there is the 5100 official shield and then the 28j60, but I dont know if the nuelectronics is a different one to 28j60, or it can use same library.
I finding it impossible to find a simple URL call client example for the 28j60 to pass some parameters the way we normally do
client.print("GET http://yourwebsite.org/cgi-bin/post.pl?A=");
client.print(100.0);
client.print("&B=");
client.print(120.0);
thanks for any help.
I'm trying to use the Pachube
I'm trying to use the Pachube code.
It seems to be sending data to Pachube, but the floating point numbers I'm sending appear as one-digit integers on my feed. 20.3 becomes 2, for example, and 0.3 becomes 0.
What could be causing this? Thanks.
Re: I'm trying to use the Pachube
Have you narrowed down where the error is occuring, for example, is it occuring during the array processing code immediately before being sent, or is it occuring way back in the code and maybe nothing to do with the Pachube code?
I had a similar error, and troubleshooted it by creating a reference in the setup;
float testdata=2.314; //test data to find where fault is
then substituted the 'real' feed data with 'testdata' and see what is being uploaded to Pachube.
If it is 2.314 reoccurring, then you will know that the error has occurred prior to that point. Hope it helps!
I have the Arduino
I have the Arduino Serial.print the exact variable that I'm feeding into client.print and it looks correct. I've tried feeding floats, double and integers into Pachube but they all get clipped down to 1 digit, alas.
I also tried using the example code verbatim and still see the same behavior.
Hi I have stumbled across
Hi I have stumbled across this blog and I seems the firs example is perfect for my project!
I want to upload the readings to my server using php.
However when I try to compile your example I get errors when trying to use V1
sketch_nov27a.cpp: In function ‘void setup()’:
sketch_nov27a:27: error: no matching function for call to ‘NUClient::debug()’
/home/darrell/Desktop/arduino-0021/libraries/NUClient/NUClient.h:30: note: candidates are: void NUClient::debug(int)
sketch_nov27a:41: error: ‘class NUClient’ has no member named ‘setTimeouts’
sketch_nov27a.cpp: In function ‘void loop()’:
sketch_nov27a:49: error: ‘class NUClient’ has no member named ‘connect’
sketch_nov27a:71: error: ‘class NUClient’ has no member named ‘stop’
Hello, you could try with
Hello, you could try with version 2 however I have stopped using the above code now in favour of an implementation that uses Andrew Lindsay's library which is more stable have a look at this page here for more details: http://openenergymonitor.org/emon/node/88, let me know if you have any questions with it
Thanks for your contribution
Thanks for your contribution ! I am used to "laxist" programming language like PHP and had a hard time using the original NueElectronics library, especially when I wanted to add my own values in the request sent to the server.
With your example everything seems to run smoothly.
Now I would like to get data back from the distant server when sending my Arduino makes it requests to it. I wanted the server to reply with a set of information the Arduino would then be able to use. I really don't know if and where I can find that data.
If not available I'll consider using the Arduino as a server but I'd rather not.
Hello Marc, I started to work
Hello Marc, I started to work on a version that would get data from the server and then started to come across inconsistent problems when trying to access different servers so as I mention in the note above I have switched to using andrew lindsays library. It can be downloaded here:
http://blog.thiseldo.co.uk/wp-files/etherShield_1_2.zip
I need to upload my client example using his library, will try and do that soon.
Hi Trystan, Thanks for this
Hi Trystan,
Thanks for this contribution, I succeed sending data to Pachube using your demo sketch.
http://www.pachube.com/feeds/9555
I use version 1 of the nuclient.
After that, we checked the data from the ethershield and notice a lot of ARP command in the message (every 300ms) overloading our router :)
Maybe this trouble is fixed in the NUClient release 2 ?
I have some compile problems
I have some compile problems with youre version 2.0 and the example code.
The done method/ attribute is not included in youre 2.0 version of the nuclient.
arduino compile error
In function 'void loop()':
error: 'class NUClient' has no member named 'done'
figured it out .. example
figured it out .. example code works with version 1 of the nuclient and not with version 2
Yes thats the one, sorry its
Yes thats the one, sorry its not very clear, I intend to rewrite the page to make things clearer once I get some more time. Did the library work for you?