Pages: [1] 2   Go Down
Author Topic: Getting started with Arduino Ethernet  (Read 2162 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is the first time I have used an Arduino.

I have the Arduino Ethernet device.

I have a 12V PSU attached and it has lit up.

I have connected it to my network and assumed that the DHCP in my router should give it an IP address, but when I scan the network it doesnt appear. The lights on the Ethernet port are on. Do I have to do anything else??

I am a complete novice and need some simple pointers. All I want to do initially is put an example Sketch on it.

Thanks
Steve
Logged

California
Offline Offline
God Member
*****
Karma: 14
Posts: 629
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Ardu-Server is quite fun and functional.
http://sheepdogguides.com/arduino/art5serv1.htm
Logged


Austin, TX
Offline Offline
Faraday Member
**
Karma: 71
Posts: 6136
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I have connected it to my network and assumed that the DHCP in my router should give it an IP address
No, it doesn't.

All I want to do initially is put an example Sketch on it.
The Arduino Ethernet is not programmed over Ethernet.  You need a USB to FTDI style cable to program sketches on to the board.
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Worcester, Ma.
Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm with Stinsley here. . .  And no, I am not a complete noob - been doing this stuff for years, however I *AM* new to the Arduino.

My goals are as follows:
1.  Find a *GOOD* tutorial about how to use the Ethernet shield.  I've seen a number of threads where they end up using command-line commands (like ifconfig, ping, etc.), and reporting error messages - and it's not clear exactly how this is being done.  Within the Arduino?  From something else on the network?

Ideally, I would have enough information from the tutorial that if/when I find some decent code/sketches, I can follow along and try to understand what is happening.  And when, (note - "when", not "if"), something goes wrong, I would have enough of a handle on things to intelligently troubleshoot what is going on.

2.  Find some example(s) for using the Arduino + Ethernet shield to do at least SOMETHING.
Hopefully these would be both client and server examples.  I've seen any number of references to them - and some pretty heated arguments too! - but no help on actually FINDING them.

Goal 1:  Verify that my shield actually works.
Goal 2:  Find some code that I can use as a springboard for my own experiments.
Goal 3:  Make it do something that is actually useful.
Goal 4:  (Hopefully!)  Get to the point where I can contribute intelligently to the Arduino community via advice and examples



Another thing - perhaps only slightly off topic. . . .

I would like to suggest a careful re-write of a lot of the fundamental documentation on the Arduino - especially the Guide(s) - as not everyone here has been using the Arduino for the last 10 or so years.

For example, I try to find information on the Arduino Ethernet shield using a search engine and I am brought to the Arduino "Ethernet Shield" page that shows me the shield, offers me schematics and such, (which is nice!), and refers me, (via a link), to the Guide for more information.  The guide refers me to the Ethernet Library.  The Ethernet Library page confirms that, yes, there are library routines written for the Ethernet Shield, it shows one-line references to the methods used - three of them - and then refers me, (via another hyperlink), back to the original Ethernet Shield page that I started from.

I don't want to come off as an ADD poster child here, but I have been on this site, rummaging around, for almost two hours now and I am no closer to a solution than when I started.

Likewise, I don't want to come off as someone who wants to troll and rant - I think the Arduino is an absolutely AWESOME idea - but finding decent examples for some of this stuff is not easy - especially if it's not in the pre-packaged examples that come with the Arduino IDE downloads.

Can you folks:
1.  Point me in the right direction?
2.  Make it easier for others to find this information without resorting to getting annoyed on a Forum list?

Yes, it's been a long day and I'm gettin' a bit tired.  Hopefully you can excuse what might appear as me ranting or whatever - but (also hopefully), you can see the merit of what I am asking.

What say ye?

Jim (JR)
Logged

Worcester, Ma.
Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Ardu-Server is quite fun and functional.
http://sheepdogguides.com/arduino/art5serv1.htm

P.S. . . . .

I took another look at spcomputing's answer - silly me, I glossed over it the first time 'cause it looked like a spam-advertisement.  Guess I'm gettin' a bit too jaded.

I wandered around at the link he offered - made notes of a number of the URL's referenced from there so I can go back to them - and this site's author does cover a bit of ground.

Glancing at this guy's stuff, it looks like it's got more whiskers than five cats.  It's definitely going to be chewy, but it looks like it might be worth it.  This dude at least takes the time to explain what he's doing, and why.

Any other good examples of both client and server side Arduino applications?

Thanks!

Jim (JR)

p.p.s.  Now, if this was just easier for us noobs to find. . . . ( :grin: )
« Last Edit: September 21, 2012, 11:35:09 pm by jharris1993 » Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 140
Posts: 5870
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is my server code. It has 2 form fields.
http://arduino.cc/forum/index.php/topic,114461.msg867258.html#msg867258

Here is my client code. It down loads Google home every 10 seconds.
http://arduino.cc/forum/index.php/topic,116122.msg874184.html#msg874184

zoomkat has some examples on the forum too. Use the ones that suit you.
Logged

0
Offline Offline
God Member
*****
Karma: 39
Posts: 988
Get Bitlash: http://bitlash.net
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Bitlash (http://bitlash.net) comes with a web server example that may be helpful:

https://github.com/billroy/bitlash/blob/master/examples/BitlashWebServer/BitlashWebServer.ino

For a short response like a sensor reading you can define a Bitlash function to return a response to the invoking browser or server.  There's a built-in, password-protected telnet server that allows you to log in remotely and use Bitlash to make changes like this.

For longer responses you can compile in pages with arbitrary HTML and embedded Bitlash code which is executed when the page is rendered.

Good luck with your project.

-br

« Last Edit: September 22, 2012, 06:39:30 am by billroy » Logged

Worcester, Ma.
Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Billroy, (et. al.)

Within the code you referenced, there is this comment:

Quote
For debugging, connect via your favorite Serial Monitor at 57600  You can watch the web traffic and issue commands

This begs the question:  Where?  How?  With what?

Again, here is one of those chicken-and-egg scenarios - there are numerous references to a "serial terminal" - and there are even example sketches that purport to use one, but (AFAIK) there is no clear guide on how to do this.  OK, I am sure there is, but it's not exactly easy to find.

I really appreciate the help I am getting here - it is invaluable! - however it strikes me as a rather poor user experience when what should be simple, easy to find information, is hidden from view until someone like me gets on a forum like this to ask - for the zillionth time, I am sure - the same "What's a Cubit?" kind of noob questions.

If I had my 'druthers, there would be clearly written explanatory documentation in each of the example folders, explaining what is being done, how to do it, and possible additional references.

OK, you're right - I'm on my soap-box again.  smiley-grin

Thanks for all the help!

Jim (JR)
« Last Edit: September 22, 2012, 10:42:49 pm by jharris1993 » Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
If I had my 'druthers, there would be clearly written explanatory documentation in each of the example folders, explaining what is being done, how to do it, and possible additional references.

OK, you're right - I'm on my soap-box again.
Getting on your soap box is fine. But, read through this whole thread again. You haven't explained what you want to do with your ethernet shield. How anyone is expected to anticipate everything that one might want to do with every variation of ethernet shield, and cover that in a tutorial is beyond me. Why you are berating people who have spent their time and their money to develop and host a tutorial that fails to anticipate how you want to use your ethernet shield in your environment with your network/firewall/ISP provider also escapes.

OK. I'll get off my soapbox now. If you post a question like "How do I use my Ethernet shield to connect to server this-or-that and execute script these-or-those", you'll get an answer. If you post a question like "How do I configure router this-or-that to assign an IP address to my Arduino", you'll get an answer. If you post specific questions, you'll get specific answers.

Vague questions do not get good answers.

Remember that an ethernet shield is just a piece of the puzzle. By the time that you know you want/need one, you are expected to know something about networking, something about configuring your network, etc.
Logged

0
Offline Offline
Tesla Member
***
Karma: 141
Posts: 9470
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Client test code that works on my system.

Code:
//zoomkat 9-22-12
//simple client test
//for use with IDE 1.0.1
//with DNS, DHCP, and Host
//open serial monitor and send an e to test
//for use with W5100 based ethernet shields

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

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address

char serverName[] = "web.comporium.net"; // zoomkat's test web page server
EthernetClient client;

//////////////////////

void setup(){

  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    while(true);
  }

  Serial.begin(9600);
  Serial.println("Better client test 9/22/12"); // so I can keep track of what is loaded
  Serial.println("Send an e in serial monitor to test"); // what to do to test
}

void loop(){
  // check for serial input
  if (Serial.available() > 0) //if something in serial buffer
  {
    byte inChar; // sets inChar as a byte
    inChar = Serial.read(); //gets byte from buffer
    if(inChar == 'e') // checks to see byte is an e
    {
      sendGET(); // call sendGET function below when byte is an e
    }
  } 
}

//////////////////////////

void sendGET() //client function to send/receive GET request data.
{
  if (client.connect(serverName, 80)) {  //starts client connection, checks for connection
    Serial.println("connected");
    client.println("GET /~shb/arduino.txt HTTP/1.0"); //download text
    client.println("Host: web.comporium.net");
    client.println(); //end of get request
  }
  else {
    Serial.println("connection failed"); //error message if no client connect
    Serial.println();
  }

  while(client.connected() && !client.available()) delay(1); //waits for data
  while (client.connected() || client.available()) { //connected or data available
    char c = client.read(); //gets byte from ethernet buffer
    Serial.print(c); //prints byte to serial monitor
  }

  Serial.println();
  Serial.println("disconnecting.");
  Serial.println("==================");
  Serial.println();
  client.stop(); //stop client

}

Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Worcester, Ma.
Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Getting on your soap box is fine. But, read through this whole thread again. You haven't explained what you want to do with your ethernet shield.

Paul,

I absolutely agree.  Questions like "Duh, it don't work!" get us nowhere.

However - and correct me if I am wrong - I have listed very specific goals in my use of the Ethernet shield - and yes, I have received excellent answers from many people, to whom I will be forever in their debt.

Again, maybe I am wrong, but one of my "hot buttons" as a Software QA engineer of many years, is usability, and I believe that usability is one of the hallmarks of well written code and documentation.

IMHO - truly in my own very humble opinion - I appreciate these fora, and all the other fora that I have been privileged to participate in.  The ability to learn from those who have gone before is invaluable - and I honestly applaud those who take the time to answer my own silly noob questions - even if it is for the four-zillionth time.

Likewise, again IMHO, my own very humble opinion, as a newbie I can see things that - perhaps - escape the notice of those who have been working within the Arduino community for years and years.  These experts naturally know that in order to make this particular thing work you have to tweak this, nudge that, and give this other thing a little twist to the left.  They have done it so often that it is second nature to them.

Unfortunately, for those of us who are (relatively) new to the Arduino platform, these things are not self-evident.  We do what the documentation tells us to do, and slam up against that brick wall, because we don't know about the tweaks, nudges, and twists that the "old timers" know about.

Ergo, these fora.  For which, again, I am most humbly grateful.

My point is this:
If these things are more carefully explained in the documentation accompanying a piece of software - or if there is even some kind of documentation at all - the noob like myself who does not mind reading the documentation before trying to load code, will have a chance to learn these things without taking up the valuable time of the experts on these fora, explaining and re-re-re-explaining what should be obvious, and obviously documented.

These people don't get paid for this.  They do this because they have a sincere desire to support a platform they admire.  And their time is valuable.  As much as I appreciate the comments and advice that everyone has given me, I know that there are better, more worthy, questions that they should be answering.  Ergo, my comments suggesting better and more comprehensive documentation.

On the Propeller fora, I have offered to compile zipped archives of their various object libraries - for two reasons:
First:  I get a copy of everything!
Second:  Other folks like me don't have to go through a list of a hundred-or-so objects and download each and every one, one at a time.

I cannot do much there, I am still way too green, but this is my way of offering to "give back" to the community.

And as soon as I find something that I, myself, can do to help here within the Arduino community - despite my own limited knowledge - it will be my privilege to do so.

I am sorry if I appeared to come off as one simply ranting and raving - for that I apologize - however, I do believe that the gist of my comments has merit, and should be considered.

What say ye?

Jim (JR)
Logged

Worcester, Ma.
Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

p.s.

Can someone please explain what is meant by a "serial terminal" within the Arduino context?  (Oh, and yes, I know what a serial terminal is.  I also know what a keypunch, a dedicated micro-controller, firmware, and a host of other things are.)

  • Do I physically attach some kind of serial device to pins "x" and "y" of the Arduino?
  • Is there a piece of software - perhaps within the Arduino IDE, or somewhere else - that takes care of that automagically?

Again, this seems to be assumed, but I'd rather not make any more assumptions than I absolutely have to - I've been bitten in the behind too many times because of some asinine assumption I made.

Thanks again for all your help!

Jim (JR)
« Last Edit: September 24, 2012, 05:38:58 pm by jharris1993 » Logged

0
Offline Offline
God Member
*****
Karma: 39
Posts: 988
Get Bitlash: http://bitlash.net
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Any USB serial monitor or terminal program will do.

This one is built-in to the Arduino IDE:

http://arduino.cc/en/Guide/Environment#serialmonitor

It could be documented better.  I accept pull requests for the Bitlash wiki on Github.

-br
Logged

California
Offline Offline
God Member
*****
Karma: 14
Posts: 629
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Tools -> Serial Monitor

Also that little magnifying glass icon.
Logged


Worcester, Ma.
Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@ Everyone

Re:  Serial terminal.

Thanks!

I had heard / read about a "serial terminal" window in the Arduino IDE, but what I read left a lot to be desired - how to make it work, is it done automagically, etc.  So, (if I am understanding all this correctly), unless I "do something different" - whatever that is - any requests, via sketches software, hardware, or whatever, to use a "serial terminal", (using the built-in serial libraries?), automagically get routed through the USB interface to the IDE's serial terminal window.  Right?

While we're on this topic. . . (a bit off-topic, I apologize) . . . I just noticed on both my Uno and Mega boards that there are two pin-connections labeled "TX" and "RX", (on the Uno), "TX-0" and "RX-0", (on the Mega).  (I had my Uno hidden under a Seeed servo/DC Motor shield - so I did not really notice this until now.)  Do these run "in parallel" with the USB "serial" interface, or are they programmatically different?

Example:  I have a 16x2 serial display board that I bought with the other Arduino "toys" I picked up for myself.  It would be interesting to send, (at least), some status/display information to that display while the Ethernet board, (or some other shield, for that matter), is running.

You know, I used to be knee-deep in electronics and micro-controller electronics head first. ( smiley-grin )  but I've been away from it for a LOOONG time.  (since the mid '90's. . .)  This Arduino stuff is really getting me all excited about this stuff, all over again!  For which I thank all of you.

What say ye?

Jim (JR)
Logged

Pages: [1] 2   Go Up
Jump to: