Arduino Ethernet Shield — first impressions

I received my Ethernet Shield last week from DealExtreme. Today I did some preliminary tests using my Arduino Uno Rev3 board and running the WinXP version of Arduino IDE under VirtualBox 4.1.18 under FreeBSD 8.3-PRERELEASE #1 r232754.

What I ordered

Ethernet Shield with Wiznet W5100 Ethernet Chip / TF Slot — roughly $18USD at the time (link here). The dx.com website says it supports a TF card up to 16GB, and has dimensions: 2.87 in x 2.17 in x 0.59 in (7.3 cm x 5.5 cm x 1.5 cm) with weight: 0.95 oz (27 g). I have not experimented with the TF card yet.

The unit arrived with some pins a little bent underneath (due to the fairly compact way DealExtreme pack items for shipping), but easily resolved with small pliers.

First sketch: WebServer (example)

Opened up Files->Examples->Ethernet->WebServer into the IDE, and tweaked the IP address to 10.1.1.177 (because my home LAN is 10.1.1/24). This demo sketch provides a very simple web server that returns the current state of the Uno’s six analog ports each time the server receives a GET request.

Compiled the sketch and transferred to my Uno on port COM3.

Immediately the Uno responded to http GET requests as intended:

[gja@gjadesktop]/home/gja(101)% wget -qO- http://10.1.1.177
<!DOCTYPE HTML>
<html>
<meta http-equiv="refresh" content="5">
analog input 0 is 344<br />
analog input 1 is 339<br />
analog input 2 is 346<br />
analog input 3 is 360<br />
analog input 4 is 349<br />
analog input 5 is 349<br />
</html>
[gja@gjadesktop]/home/gja(102)%

The “refresh” line sent by the demo sketch means that when queried by a browser (rather than wget) the browser will auto-refresh every 5 seconds, retrieving a new set of values from the analog inputs each time.

While running the WebServer sketch the Ethernet shield also responds to ICMP ping packets.

[gja@gjadesktop]/home/gja/Documents(104)% !p
ping 10.1.1.177
PING 10.1.1.177 (10.1.1.177): 56 data bytes
64 bytes from 10.1.1.177: icmp_seq=0 ttl=128 time=0.125 ms
64 bytes from 10.1.1.177: icmp_seq=1 ttl=128 time=0.095 ms
64 bytes from 10.1.1.177: icmp_seq=2 ttl=128 time=0.105 ms
^C
--- 10.1.1.177 ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.095/0.108/0.125/0.012 ms
[gja@gjadesktop]/home/gja/Documents(105)%

The MAC address can also be configured.

[gja@gjadesktop]/home/gja/Documents(106)% arp -an |grep 10.1.1.177
 ? (10.1.1.177) at de:ad:be:ef:fe:ed on re0 expires in 598 seconds [ethernet]
[gja@gjadesktop]/home/gja/Documents(107)%

Second sketch: ChatServer

Opened up Files->Examples->Ethernet->ChatServer into the IDE, and tweaked the IP address to 10.1.1.177. This demo sketch enables a telnet server that echoes back to a remote client anything sent by the client.

Compiled the sketch and transferred to Uno on port COM3.

I was then able to telnet to 10.1.1.177, and whatever I typed  was echo’d back to me (and also copied to the Arduino’s serial output, observed via the IDE’s Serial Monitor)

[gja@gjadesktop]/home/gja/Documents(111)% telnet 10.1.1.177
Trying 10.1.1.177...
Connected to 10.1.1.177.
Escape character is '^]'.
Hello, client!
why hello
why hello
this line will be repeated
this line will be repeated
[...etc...]
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: