Page 1 of 2

Ethernet. shield or module.

Posted: Fri Feb 14, 2014 4:47 am
by sabo
Ive read the other threads on the ethernet module. Just wondering as I heard someone else mention its easier than the wiznet shield. I dont need the extra pwm bits, and was thinking that the code for that module should pretty much work for the shield, or am I missing something? I understand the module is its own micro controller, but not understanding why not to just use the shield if it does what I need, which is to simply use ethernet.

Also in that thread, roberto, you had one didnt you? there was talk of supplying them, I guess that idea died a death?

Hmm, ok, due to it not using the serial pins, i guess is why to use the modle?

Re: Ethernet. shield or module.

Posted: Fri Feb 14, 2014 10:01 am
by rimai
You still need the mcu. Just the shield won't do anything.
The easiest is to get the arduino ethernet board. It is already made to be a direct replacement for the wifi attachment.
You even use the same cable :)
http://arduino.cc/en/Main/ArduinoBoardEthernet

Re: Ethernet. shield or module.

Posted: Fri Feb 14, 2014 5:35 pm
by sabo
Yeah, a bit of further reading and it seemed quite more complicated with the shield. Module it is then.

Re: Ethernet. shield or module.

Posted: Fri Feb 14, 2014 6:23 pm
by rimai
This is the code I used on my tests.

Re: Ethernet. shield or module.

Posted: Fri Feb 14, 2014 8:01 pm
by lnevo
That was a product page to purchase. How much does the arduino one go for? I've had a lot of people ask for ethernet...would it just be getting one of those and loading that code up?

Re: Ethernet. shield or module.

Posted: Fri Feb 14, 2014 8:02 pm
by rimai
Yeap, load the code and plug it in.

Re: Ethernet. shield or module.

Posted: Tue Feb 25, 2014 10:41 am
by Francois
Does that code work for the android app? I'm still getting the parsing error with the android app and the ethernet module only works updating from the portal.

Re: Ethernet. shield or module.

Posted: Wed Feb 26, 2014 10:46 pm
by sabo
I haven't had a chance to try mine yet as I'm away at work. François, I vaguely recall in the original thread something about a parsing error. And I'm pretty sure it was resolved. Something to do with XML tags iirc.

Re: Ethernet. shield or module.

Posted: Tue Mar 04, 2014 2:20 am
by sabo
Finally got home to play with the ethernet module. Im getting the XML SAX parser error from the android app too. Its updating the portal. If I go to the local address:2000/wifi, I get the normal web page and can turn ports on and off. Any ideas?

Edit: iphone app works, can turn relays on or off, but also get xml parsing errors. And I can also turn ports off and on, but not get current status with the android app. I read warpigs old thread on the wiznet module, and he said increasing the serial wait time to 3000ms seemed to fix the android app. Tried changing what I thought was that in the ino file and still no luck.

Another edit: it seems to update using the apps update interval semi consistently, but whenever I press the refresh buttun it always gets the xml parse error.

Re: Ethernet. shield or module.

Posted: Tue Apr 01, 2014 9:45 pm
by Piper
Sabo, Did you manage to get to get your ethernet module working?

Re: Ethernet. shield or module.

Posted: Tue Apr 01, 2014 10:22 pm
by sabo
Its works, but I get the XML sax parser error with the android app. The app works, as in I can turn things on and off, but the info never refreshes. Portal works OK. I haven't managed to find a fix for the parse error yet. :(

Re: Ethernet. shield or module.

Posted: Wed Apr 02, 2014 9:23 am
by rimai
I think Curt found something that is causing this issue.
He didn't have anyone to test the fix.
If you PM him, he may be able to coordinate with you to test his fix.

Re: Ethernet. shield or module.

Posted: Wed Apr 02, 2014 4:29 pm
by Piper
I'll shoot him a PM. I'm getting the sax error with the wifi module and the app which is why I was looking into this. If the fix might work for the wifi as well maybe I can help him test it.

Re: Ethernet. shield or module.

Posted: Thu Apr 03, 2014 9:49 pm
by sabo
I read an old thread where the consensus was that the packet size was too small and that's why the app didn't like it. I tried researching how to fix that but as I've been setting up the tank I didn't find a fix as I've been a bit distracted. ;)

Re: Ethernet. shield or module.

Posted: Fri Apr 04, 2014 7:07 am
by Piper
I spoke to Curt and it looks like he will have an updated version of the app available in a few weeks that will greatly help with the sax errors.

Re: Ethernet. shield or module.

Posted: Fri Apr 04, 2014 7:43 am
by sabo
Awesome :D Though Im interested in whether its the module or the app causing the issue?

Re: Ethernet. shield or module.

Posted: Fri Apr 04, 2014 9:45 am
by Piper
From what Curt said it may have something to do with how the app reads the XML. I started to do a little research before speaking with Curt and from what I read so far it sounded like it might be malformed XML (CRLFs before the header) or possibly "bad" characters in the XML. I don't think that is the case here though.

Re: Ethernet. shield or module.

Posted: Fri Apr 04, 2014 10:08 am
by binder
Piper wrote:From what Curt said it may have something to do with how the app reads the XML. I started to do a little research before speaking with Curt and from what I read so far it sounded like it might be malformed XML (CRLFs before the header) or possibly "bad" characters in the XML. I don't think that is the case here though.
i think the problem had to do specifically with my app. i was reading in the entire data into a string before processing it. i think the data coming in would get interpreted differently in the string form or run out of buffer space and error out the parser. i am not 100% certain though because it is a tricky bug to track down. i have switched the way i process and read the data and it now appears to have fixed the problem. it's kind of hard to get into lots of details while im using my ipad to reply. :-)


Sent from my iPad mini

Re: Ethernet. shield or module.

Posted: Fri Apr 04, 2014 7:03 pm
by sabo
Ah, nice one. Have you got the apk I can try?

Re: Ethernet. shield or module.

Posted: Sat Apr 05, 2014 2:20 pm
by binder
sabo wrote:Ah, nice one. Have you got the apk I can try?
sure.
http://curtbinder.info/apps/AndroidStat ... .Beta1.apk
it will replace the existing version and can be upgraded without problems.

Sent from my Moto X

Re: Ethernet. shield or module.

Posted: Sat Apr 05, 2014 6:01 pm
by sabo
Awesome. Works a treat. :D Many thanks!

Re: Ethernet. shield or module.

Posted: Sat Apr 05, 2014 8:49 pm
by binder
sabo wrote:Awesome. Works a treat. :D Many thanks!
excellent! sounds like the problem is solved 8-)

Sent from my Moto X

Re: Ethernet. shield or module.

Posted: Thu Oct 09, 2014 3:39 pm
by tkeracer619
Is this still regarded as the best way to go ethernet?

In my last house wifi was easy but in this house there is too much concrete and it seems my signal is too weak to give a reliable connection.

I've installed power line ethernet adapters on multiple computers here with excellent results and would like to do the same with my RA. I assume I don't need the power from ethernet version.

Anyone need a discount wifi module?

Re: Ethernet. shield or module.

Posted: Thu Oct 09, 2014 4:30 pm
by rimai
Yes, that is the best and easiest way to get ethernet.

Re: Ethernet. shield or module.

Posted: Fri Oct 17, 2014 8:23 pm
by rcorbitt
I'd be interested in a discount Wi-Fi module!

Re: Ethernet. shield or module.

Posted: Thu Oct 23, 2014 12:42 am
by cody.sheridan-2008
Is it possible for someone to do up a bit of a tutorial for this? I'm keen to do it but still a bit confused...

Re: Ethernet. shield or module.

Posted: Thu Oct 23, 2014 8:28 am
by rimai
It's pretty simple.
Buy the board, load the code attached to the very first posts in this thread and connect to RA with the same cable you use for your wifi attachment. :)
If you don't have one, PM me. I can get you only the cable.

Re: Ethernet. shield or module.

Posted: Thu Jul 23, 2015 6:56 am
by topjimmy
Will this code still work with the newest libraries. I can't seem to get it to work.

Re: Ethernet. shield or module.

Posted: Thu Jul 23, 2015 8:28 am
by rimai
This is independent of the libraries.
This code goes into the Ethernet board and not on RA.

Re: Ethernet. shield or module.

Posted: Thu Jul 23, 2015 9:39 am
by topjimmy
rimai wrote:This is independent of the libraries.
This code goes into the Ethernet board and not on RA.
Hmm

It loads fine, but then I can't ping it.

If I use this test code it works. I can ping it, I can go to the ip address and see the server page the code hosts.

Code: Select all

*--------------------------------------------------------------
  Program:      eth_websrv_page

  Description:  Arduino web server that serves up a basic web
                page. Does not use the SD card.
  
  Hardware:     Arduino Uno and official Arduino Ethernet
                shield. Should work with other Arduinos and
                compatible Ethernet shields.
                
  Software:     Developed using Arduino 1.0.3 software
                Should be compatible with Arduino 1.0 +
  
  References:   - WebServer example by David A. Mellis and 
                  modified by Tom Igoe
                - Ethernet library documentation:
                  http://arduino.cc/en/Reference/Ethernet

  Date:         7 January 2013
 
  Author:       W.A. Smith, http://startingelectronics.org
--------------------------------------------------------------*/

#include <SPI.h>
#include <Ethernet.h>

// MAC address from Ethernet shield sticker under board
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(10, 0, 0, 20); // IP address, may need to change depending on network
EthernetServer server(80);  // create a server at port 80

void setup()
{
    Ethernet.begin(mac, ip);  // initialize Ethernet device
    server.begin();           // start to listen for clients
}

void loop()
{
    EthernetClient client = server.available();  // try to get client

    if (client) {  // got client?
        boolean currentLineIsBlank = true;
        while (client.connected()) {
            if (client.available()) {   // client data available to read
                char c = client.read(); // read 1 byte (character) from client
                // last line of client request is blank and ends with \n
                // respond to client only after last line received
                if (c == '\n' && currentLineIsBlank) {
                    // send a standard http response header
                    client.println("HTTP/1.1 200 OK");
                    client.println("Content-Type: text/html");
                    client.println("Connection: close");
                    client.println();
                    // send web page
                    client.println("<!DOCTYPE html>");
                    client.println("<html>");
                    client.println("<head>");
                    client.println("<title>Arduino Web Page</title>");
                    client.println("</head>");
                    client.println("<body>");
                    client.println("<h1>Hello from Arduino!</h1>");
                    client.println("<p>A web page from the Arduino server</p>");
                    client.println("</body>");
                    client.println("</html>");
                    break;
                }
                // every line of text received from the client ends with \r\n
                if (c == '\n') {
                    // last character on line of received text
                    // starting new line with next character read
                    currentLineIsBlank = true;
                } 
                else if (c != '\r') {
                    // a text character was received from client
                    currentLineIsBlank = false;
                }
            } // end if (client.available())
        } // end while (client.connected())
        delay(1);      // give the web browser time to receive the data
        client.stop(); // close the connection
    } // end if (client)
}
I am using the actual Arduino exe to upload since the RA version can't see the board.