Sunday, July 24, 2011

ethernetshield arduino, jeenode

This stuff is all known, and this post is just a diary, remembering how to do it all.

Arduino has its own ethernetshield.
http://arduino.cc/en/Tutorial/WebServer
We also have the ethercard from Jeelabs.com
 http://jeelabs.org/2010/05/24/meet-the-ether-card/

We have a modem, so how to connect what with what and what about IP?

http://electronics.stackexchange.com/questions/15150/what-does-the-arduino-ethernet-shield-connect-to
this link has a nice setup explanation.

I don't have a crossover cable, so I connected to the modem.
Then with the Arduino Ethernetshield, what worked was the example of the reading of the analog PINS.

With the jeenode ethercard setup of jeelabs the DHCP did not work for me, (probably the settings of the modem)
http://jeelabs.org/2011/06/19/ethercard-library-api/

but using the static IP:

// ethernet interface mac address
static byte mymac[] = { 0xDE,0xAD,0xBE,0xEF,0xFE,0x19 };
// ethernet interface ip address

static byte myip[] = { 192,168,2,77 };


and in the setup:

void setup(){
ether.begin(sizeof Ethernet::buffer, mymac);
//ether.dhcpSetup();
ether.staticSetup(myip, gwip);
}


we got the "backsoon page".

That is, we got it at http://192.168.2.77/ which is still local network.

The last hurdle is to connect to this "server" from the outside.

You can see which IP you have in ipconfig in the terminal, or using
http://www.whatismyip.com

Then in our case, you have to get to your modem using the browser, (IP number  in ipconfig)
advanced settings
internet
Address translation
port forwarding
and add the port whcih is in the arduino script, and the local ip of the arduino server.

Then you can reach the arduino internet page, from outside, and the arduino becomes a real server.
(Strange enough, no problems with the firewall....)

Working on XP, so Windows.

0 comments: