rb-ada-03 adafruit ethernet shield kit for arduino …...make sure the shield is not on the arduino....

30
RB-Ada-03 Adafruit Ethernet Shield Kit for Arduino User Guide Kit Contents ........................................................................................................................ 2 Assembly............................................................................................................................. 4 Step 1. Configure the XPort .......................................................................................... 17 Option 1. Configuring the XPort w/DHCP ............................................................... 17 Option 2. Set up the XPort using FTDI cable ........................................................... 17 Option 3. Set up the XPort using 'Arduino wire hack' .............................................. 17 Option 2 & 3. Configure the XPort with serial ......................................................... 19 Step 2. Wire the Xport to desired Arduino pins............................................................ 23 Step 3. Test.................................................................................................................... 25 Step 1. Configure XPort ............................................................................................ 25 Step 2. Compile and upload the SoftSerialTest sketch ............................................. 25 Step 3. Wire up the XPort ......................................................................................... 25 Step 3. Connect to the XPort..................................................................................... 25 Step 4. Connect! ............................................................................................................ 27

Upload: others

Post on 24-Feb-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: RB-Ada-03 Adafruit Ethernet Shield Kit for Arduino …...Make sure the shield is not on the Arduino. Then plug in the FTDI cable as shown, making sure that the Green and Black wires

RB-Ada-03

Adafruit Ethernet Shield Kit for Arduino

User Guide

Kit Contents ........................................................................................................................ 2

Assembly............................................................................................................................. 4

Step 1. Configure the XPort.......................................................................................... 17

Option 1. Configuring the XPort w/DHCP............................................................... 17

Option 2. Set up the XPort using FTDI cable........................................................... 17

Option 3. Set up the XPort using 'Arduino wire hack'.............................................. 17

Option 2 & 3. Configure the XPort with serial ......................................................... 19

Step 2. Wire the Xport to desired Arduino pins............................................................ 23

Step 3. Test.................................................................................................................... 25

Step 1. Configure XPort............................................................................................ 25

Step 2. Compile and upload the SoftSerialTest sketch ............................................. 25

Step 3. Wire up the XPort ......................................................................................... 25

Step 3. Connect to the XPort..................................................................................... 25

Step 4. Connect!............................................................................................................ 27

Page 2: RB-Ada-03 Adafruit Ethernet Shield Kit for Arduino …...Make sure the shield is not on the Arduino. Then plug in the FTDI cable as shown, making sure that the Green and Black wires

Kit Contents

Image Name Description Distributor Qty

PCB Printed circuit board Adafruit 1

IC1

MCP1700-3302E/TO

3.3V linear voltage regulator

Digikey

Mouser 1

C2, C3 0.1uF ceramic capacitor Digikey

Mouser 2

C4, C5 100uF / 6V capacitor Digikey

Mouser 2

12-position 2mm female header

Sockets for XPort Direct(+)

Digikey 2

Page 3: RB-Ada-03 Adafruit Ethernet Shield Kit for Arduino …...Make sure the shield is not on the Arduino. Then plug in the FTDI cable as shown, making sure that the Green and Black wires

3-pin female header

(Used for NG Arduinos only)

Digikey 1

R1

10K ohm 1/4W 5% resistor (brown black

orange gold)

For use with wiznet modules

Digikey

Mouser 1

2x10 pin female headers

For use with wiznet modules

2

RESET 6mm tactile switch Digikey

Mouser 1

ICSP 6-pin ICSP header Digikey

Mouser 1

36 pin male header (1x36) Digikey

Mouser 1

Page 4: RB-Ada-03 Adafruit Ethernet Shield Kit for Arduino …...Make sure the shield is not on the Arduino. Then plug in the FTDI cable as shown, making sure that the Green and Black wires

Assembly

First off, check that you have all the parts. They're listed on the kit

contents page.

Next, get ready by placing the PCB in a vise so that you can easily

place and solder the parts in!

Check also that you have all the tools you need, & warm up your

soldering iron to 650-700degF

The first section is the 3.3v regulator, which is what we use to

power the XPort/WIZnet modules. While latest Arduinos do have

a 3V line, its not nearly powerful enough to run the XPort.

Insert the MCP1700 regulator. Make sure its placed properly, such

that the round and flat halves are aligned as indicated on the PCB

silkscreen. Because the legs of the IC have to bend, it wont sit

right up against the PCB, this is OK.

Next, with your soldering iron, solder each of the thee legs of the

IC. Place the tip of the iron against both the pad (ring) and lead

(leg) and after a few counts, touch the solder in, to make a nice

joint.

Repeat for all three joints.

Page 5: RB-Ada-03 Adafruit Ethernet Shield Kit for Arduino …...Make sure the shield is not on the Arduino. Then plug in the FTDI cable as shown, making sure that the Green and Black wires

Next, clip the excess leads using the diagonal cutters. Clip right

above the top of the solder joint.

When you are done, it should look like this. If you have some

sticky stuff on the solder joints, thats OK, thats the rosin inside the

solder that protects the joints from oxidation. It isnt necessary to

clean it off.

Page 6: RB-Ada-03 Adafruit Ethernet Shield Kit for Arduino …...Make sure the shield is not on the Arduino. Then plug in the FTDI cable as shown, making sure that the Green and Black wires

The next step is the two ceramic bypass capacitors for the input

and output of the voltage regulator. They are used to get rid of

high frequency noise on the power supply.

Ceramic capacitors are non-polar. That means you can place them

"either way"

Turn over the board and solder in the 2 capacitors.

Page 7: RB-Ada-03 Adafruit Ethernet Shield Kit for Arduino …...Make sure the shield is not on the Arduino. Then plug in the FTDI cable as shown, making sure that the Green and Black wires

Then clip the leads down.

Next are the 2 electrolytic capacitors, which provide low-

frequency filtering for the 3.3v power supply input and output.

Electrolytic caps are polarized, and thus must be placed correctly

or they will not work (and possibly 'explode'!)

To place correctly, first identify which hole is for the positive lead.

On the silkscreen you will see a small + next to this hole. Next,

make sure the capacitors are inserted so that the long lead is placed

in this hole. Compare with the images to the left.

Turn the board over. Solder and clip the capacitors.

Page 8: RB-Ada-03 Adafruit Ethernet Shield Kit for Arduino …...Make sure the shield is not on the Arduino. Then plug in the FTDI cable as shown, making sure that the Green and Black wires

Next, place the tactile switch and 6-pin ICSP header. The switch

will let you reset the Arduino even with the shield on, very useful

when debugging a project! The 6-pin header will let you use a

programmer if you don't want to use the Arduino

software/bootloader.

The switch should snap in, make sure it lies flat!

Page 9: RB-Ada-03 Adafruit Ethernet Shield Kit for Arduino …...Make sure the shield is not on the Arduino. Then plug in the FTDI cable as shown, making sure that the Green and Black wires

Turn over the circuit board and solder in the switch and header.

You wont need to clip the leads, they're quite short already

Page 10: RB-Ada-03 Adafruit Ethernet Shield Kit for Arduino …...Make sure the shield is not on the Arduino. Then plug in the FTDI cable as shown, making sure that the Green and Black wires

Next, break the 36-pin header strip into smaller sections so that the

shield can be placed on the Arduino. You can use pliers or

diagonal cutters. Clip off 2-6pin and 2-8pin pieces.

If you're using a Diecimila Arduino, place the 6 and 8 pin headers

into the female sockes.

If you have an NG Arduino, you should also place the 3-pin

female header as shown, which will let you use the reset button.

Page 11: RB-Ada-03 Adafruit Ethernet Shield Kit for Arduino …...Make sure the shield is not on the Arduino. Then plug in the FTDI cable as shown, making sure that the Green and Black wires

Place the shield on top of the Arduino so that all of the headers

line up.

Solder in each pin of the header.

If you have an NG arduino, dont forget about the three pin female

header to the right.

Page 12: RB-Ada-03 Adafruit Ethernet Shield Kit for Arduino …...Make sure the shield is not on the Arduino. Then plug in the FTDI cable as shown, making sure that the Green and Black wires

This step assumes you want to use a WIZnet Module

If you are using the wiznet module, you will need to install and

solder the 10K resistor (Brown Black Orange Gold)

Resistors are non-polar so you can install it 'either way'

Page 13: RB-Ada-03 Adafruit Ethernet Shield Kit for Arduino …...Make sure the shield is not on the Arduino. Then plug in the FTDI cable as shown, making sure that the Green and Black wires

This step assumes you want to use a WIZnet Module

If you want, you can solder the WIZnet module straight in. Just

line it up so that the ethernet jack sticks out as shown and solder it

in

This step assumes you want to use a WIZnet Module

Alternately, you can use the 2x10 pin headers that will allow you

to reuse the module

Place both headers on top, use tape if necessary to keep them in

place while soldering all the pins

This step assumes you want to use a WIZnet Module

Finally, you will want to connect the Reset pin of the module to

the Reset line of the Arduino, that way it will be reset when the

button is pressed. This is necessary unless you want to reset the

module by connecting it to a 'standard' output pin.

Page 14: RB-Ada-03 Adafruit Ethernet Shield Kit for Arduino …...Make sure the shield is not on the Arduino. Then plug in the FTDI cable as shown, making sure that the Green and Black wires

The following instructions assume you want to use an XPort

Direct or Direct+

Place the 2mm 12-pin headers on the XPort Direct

With the XPort plugged into the headers, place it on the shield and

tack the four corners with a small amount of solder. This is to keep

the headers spaced properly.

Page 15: RB-Ada-03 Adafruit Ethernet Shield Kit for Arduino …...Make sure the shield is not on the Arduino. Then plug in the FTDI cable as shown, making sure that the Green and Black wires

Remove the module, and complete soldering the header in

If you're planning to use a FTDI USB cable with the shield, use

the remaining 6-pin header left over from the 36-position strip and

place it on the shield right next to the 3.3v regulator, as shown

Place the 6 pin headers so that the long part sticks up, and you can

solder it from below.

Page 16: RB-Ada-03 Adafruit Ethernet Shield Kit for Arduino …...Make sure the shield is not on the Arduino. Then plug in the FTDI cable as shown, making sure that the Green and Black wires

You're done!

Page 17: RB-Ada-03 Adafruit Ethernet Shield Kit for Arduino …...Make sure the shield is not on the Arduino. Then plug in the FTDI cable as shown, making sure that the Green and Black wires

Using your shield with an XPort

These steps are for people using the XPort series of ethernet engines, the examples won't work with WIZnet-series modules!

Step 1. Configure the XPort

There are three ways to configure an XPort

1. Telnet to port 9999 of the XPort

2. Use an FTDI cable to make a serial connection

3. Use a "wire hack" to make a serial connection

Option 1. Configuring the XPort w/DHCP

Once you have the shield assembled and the XPort plugged or soldered in, you'll want to configure it. You only have to do this once.

If you have DHCP, this is very easy. Simply plug the shield into the Arduino and an Ethernet cable into the Xport. The XPort will

automatically get an IP address. You can then configure it using the Lantronix "DeviceInstaller" software. You can figure out its IP

address and then telnet to the IP address, port 9999 to configure.

This is by far the easiest way to configure the XPort so I suggest it instead of trying to configure it with the serial port

Option 2. Set up the XPort using FTDI cable

If you dont have DHCP, you will have to connect to the serial interface.

If you have an FTDI cable, simply solder in a 6-pin header into the spot on the shield to connect the cable. Make sure the shield is not

on the Arduino. Then plug in the FTDI cable as shown, making sure that the Green and Black wires are aligned as marked

Now skip down to "Configuring the XPort via Serial"

Option 3. Set up the XPort using 'Arduino wire hack'

If you dont have an FTDI cable, you can actually just use the FTDI chip on the Arduino itself. Its a little tricky but not too hard to do.

First, gently pry the Arduino microcontroller from its socket using a small flat screwdriver or similar. Try to make sure the pins dont

get bent. Put it in a safe place. Preferably in an anti-static bag.

Page 18: RB-Ada-03 Adafruit Ethernet Shield Kit for Arduino …...Make sure the shield is not on the Arduino. Then plug in the FTDI cable as shown, making sure that the Green and Black wires

Next, solder two wires to the shield, as shown. Use different colors to make it easy to tell the difference. Solder one wire to the second

hole from the top as shown here, and the second wire to the third from the top. Make sure the wires are plenty long.

Plug the two wires into the now-empty socket of the Arduino, as shown. The white wire is in the 3rd socket hole from top. The green

wire is in the second socket hole from the top.

You can now plug the shield onto the Arduino.

Page 19: RB-Ada-03 Adafruit Ethernet Shield Kit for Arduino …...Make sure the shield is not on the Arduino. Then plug in the FTDI cable as shown, making sure that the Green and Black wires

Now go to the next step...

Once you're done configuring the XPort, remove the wires and gently re-insert the microcontroller chip

Option 2 & 3. Configure the XPort with serial

You'll need to figure out which serial port (COM) you are using. Plug in the Arduino (if you're using the wire hack) or the FTDI cable.

Under windows, check the device manager, look for "USB Serial Port"

Next you'll need to open up a terminal program. Windows comes with Hyperterminal, so just use that. Its under Start->Programs-

>Accessories->Communications->HyperTerminal.

When you open it up, it should ask you for a new connection. Lets name it "xport"

Page 20: RB-Ada-03 Adafruit Ethernet Shield Kit for Arduino …...Make sure the shield is not on the Arduino. Then plug in the FTDI cable as shown, making sure that the Green and Black wires

Next You will select the COM port from the drop down menu, in my case its COM10.

Next, set the properties. Make sure you select 9600 bps, 8 bit, No parity, 1 stop bit and no flow control. Some programs may call

this (9600 8N1). If the XPort has been configured for a different baud rate, of course, you should use that.

You will get a blank screen that says "Connected" in the bottom left corner.

Now is where you have to be a little fast!

Page 21: RB-Ada-03 Adafruit Ethernet Shield Kit for Arduino …...Make sure the shield is not on the Arduino. Then plug in the FTDI cable as shown, making sure that the Green and Black wires

• If you have an FTDI cable, unplug the cable from the shield (but not from the computer).

Wait 3 seconds. Then plug the cable back into the shield and within a few seconds type

in xxxx (4 x's) into the Hyperterminal screen

• If you are using the wire hack, its a little tougher. With the Arduino plugged into the USB

port and keeping the 2 wires in place, remove the shield. Wait 3 seconds. Then plug the

shield back into the Arduino and as soon as you can type a bunch of 'x's into the

Hyperterminal window.

If you are successful you will see the setup screen in the next step

Changing the XPort configuration

Press Enter! The Xport will send its current configuration and then provide a screen that you can change the XPort configuration

Page 22: RB-Ada-03 Adafruit Ethernet Shield Kit for Arduino …...Make sure the shield is not on the Arduino. Then plug in the FTDI cable as shown, making sure that the Green and Black wires

If you want to set the static IP address of the Xport, type in 0 and then enter in the ip address and gateway. You should be able to

telnet to port 9999 of the XPort if its setup correctly

You can also change the serial port settings. Unless you're sure you want a different configuration, you probably dont want to change

the settings.

Page 23: RB-Ada-03 Adafruit Ethernet Shield Kit for Arduino …...Make sure the shield is not on the Arduino. Then plug in the FTDI cable as shown, making sure that the Green and Black wires

March 9, 2009 14:26

Step 2. Wire the Xport to desired Arduino pins.

Errata!

V1.0 of the PCB has an error in the silkscreen, for the XPort direct labels, CP1 and CP2 are -

swapped-. The labels for the XPort side are OK.

The labels, reading down, should be #RESET, TX, RX, RTS, DTR, CTS, CP2, CP1

This will be fixed in v1.1, sorry!

Wire it up!

Since all of the XPort communcation happens with "software serial", its up to the user to decide which

pins on the Arduino to connect up to the XPort.

Since all of the examples that will be posted on this site will use the same configuration, I will show

how to wire up the XPort in the following way:

• XPort RX pin -> Arduino digital pin 2

This is the pin that the XPort uses to receive data. It is necessary!

• XPort TX pin -> Arduino digital pin 3

This is the pin that the XPort uses to send data. It is necessary!

Page 24: RB-Ada-03 Adafruit Ethernet Shield Kit for Arduino …...Make sure the shield is not on the Arduino. Then plug in the FTDI cable as shown, making sure that the Green and Black wires

• XPort Reset pin -> Arduino digital pin 4

This is the pin that is used to reset the XPort. It is necessary!

• XPort DTR pin -> Arduino digital pin 5

This is the pin that the XPort uses to tell the Arduino that the Internet connection

has ended. Its not essential but its very useful

• XPort CTS pin -> Arduino digital pin 6

This is the pin that the Arduino uses to keep the XPort from overwhelming it with

data. Its not essential but its very, very strongly recommended

• XPort RTS pin -> Arduino digital pin 7

This is the pin that the XPort uses to tell the Arduino that there is more data

available. Its not used in my examples but it might be useful for some people.

If you decide to go with something else, make sure you change the example code below in the

example sketches. If the pins are not used, set the number value to "0" (zero)

#define XPORT_RXPIN 2

#define XPORT_TXPIN 3

#define XPORT_RESETPIN 4

#define XPORT_DTRPIN 5

#define XPORT_CTSPIN 6

#define XPORT_RTSPIN 7

Simply solder plain wires between the row of pads next to the XPort and the row of pads along the

header connection

Or, if you want to get fancy and you have female socket header in your spare-parts bin, you can use

that!

Page 25: RB-Ada-03 Adafruit Ethernet Shield Kit for Arduino …...Make sure the shield is not on the Arduino. Then plug in the FTDI cable as shown, making sure that the Green and Black wires

Step 3. Test

Step 1. Configure XPort First make sure you have the Xport configured correctly. Telnet to it and verify you have the

following channel 1 setup (9600 baud, I/F mode 4C, Flow 00, Connectmode D4)

*** Channel 1

Baudrate 9600, I/F Mode 4C, Flow 00

Port 10001

Connect Mode : D4

Send '+++' in Modem Mode enabled

Show IP addr after 'RING' enabled

Auto increment source port disabled

Remote IP Adr: --- none ---, Port 00000

Disconn Mode : 00

Flush Mode : 00

Make a note of the IP address, you'll need it later

Step 2. Compile and upload the SoftSerialTest sketch Download and install the AFSoftSerial libray and then upload the SoftSerialTest sketch included

Step 3. Wire up the XPort

You will only need 2 pins for this example, the XPort RX pin goes to the Arduino's pin 2 and the TX

pin goes to the Arduino's pin 3

Step 3. Connect to the XPort

Telnet to port 10001 of the XPort, then start up the Serial Monitor. Reset the Arduino (it should auto-

reset when the serial monitor starts). After the startup delay (if there is one) You should see

"Goodnight moon!" in the Arduino Serial Monitor and "Hello world?" in the telnet window. You can

then send from the Arduino to the XPort...

Page 26: RB-Ada-03 Adafruit Ethernet Shield Kit for Arduino …...Make sure the shield is not on the Arduino. Then plug in the FTDI cable as shown, making sure that the Green and Black wires

and vice versa...

Page 27: RB-Ada-03 Adafruit Ethernet Shield Kit for Arduino …...Make sure the shield is not on the Arduino. Then plug in the FTDI cable as shown, making sure that the Green and Black wires

Step 4. Connect!

XPort library

I've written a library to make talking to the XPort devices -really- easy!

Here's the interface:

• Create an AF_XPort object at the top of your sketch, calling it with the pin

designations you are going to use. For example:

AF_XPort xport = AF_XPort(XPORT_RXPIN, XPORT_TXPIN,

XPORT_RESETPIN, XPORT_DTRPIN, XPORT_RTSPIN, XPORT_CTSPIN)

If you're not using one of those pins, like for example RTS, simply put a 0 instead

• In the setup() procedure, nitialize the device by calling begin(baudrate)

For example, xport.begin(57600)

• You can reset the XPort by calling reset()The procedure will return

ERROR_TIMEOUT (the XPort didn't seem to reset) or ERROR_BADRESP (the

XPort didn't reset properly, perhaps) or ERROR_NONE (good)

• Connect to an IP address and port with the procedure connect(ipaddr, port ),

where ipaddr is in dotted decimal format like "127.0.0.1" and port is simply a

number. The procedure will retrun ERROR_TIMEDOUT (the XPort didnt

respond), ERROR_BADPRESP (failed to connect), or ERROR_NONE

(connected)

• Once you're connected you can check to see if data is available with

serialavail_timeout(timeout) which will spend up to timeout milliseconds waiting

for data. It returns 1 if data is available, and 0 if not.

• You can read data one line at a time by calling readline_timeout(buffer, maxlen,

timeout) which will read one full line of text/data (everything up to a new line)

until either timeout milliseconds have gone by without more data or maxlen

number of characters have been read. buffer is a character array that is used to

store the line of text. Check out the examples below for detailed usage.

• You can also write data by calling print() or println() just like the Serial library.

Since you may have data that's just lots of strings (like javascript code, or HTML

or whatever) that don't change, you can use ROM_print(string) which will read

Page 28: RB-Ada-03 Adafruit Ethernet Shield Kit for Arduino …...Make sure the shield is not on the Arduino. Then plug in the FTDI cable as shown, making sure that the Green and Black wires

from PROGMEM arrays. See the webserver examples for how to use this. In

general, you can store as much data in flash as you'd like, but by default strings

are stored in RAM which quickly gets exhausted.

• When you're done, you can call flush() which will empty out all of the data

waiting on the XPort

Simple data fetching sketches

Here are some example sketches using the AFSoftSerial library and AF_XPort library to talk to the

XPort. You'll notice that most use the same chunk of XPort interfacing code and then just send data

and look for responses. These examples should get you going in the right direction...

These examples all use a local (Ardino USB) baudrate of 57600 and an xport baudrate of 57600. They

probably wont work without wiring up the xport RESET, DTR, CTS pins (RTS is indicated but isnt

actually used), the xport Channel 1 flow control should be "02"

*** Channel 1

Baudrate 57600, I/F Mode 4C, Flow 02

Port 10001

Connect Mode : D4

Send '+++' in Modem Mode enabled

Show IP addr after 'RING' enabled

Auto increment source port disabled

Remote IP Adr: --- none ---, Port 00000

Disconn Mode : 00

Flush Mode : 77

• Check email using authenticated POP and beep a piezo

speaker when new mail arrives

• Watch someone's twitter feed and print out their latest

status as it is updated

• Send a twitter using the authenticated twitter api.

Simple webserver examples

Here is an example webserver with javascript. The XPort is open on port 80 (standard http port) and

will present a webpage:

Page 29: RB-Ada-03 Adafruit Ethernet Shield Kit for Arduino …...Make sure the shield is not on the Arduino. Then plug in the FTDI cable as shown, making sure that the Green and Black wires

On the page is a color-picking javascript object. The box with #xxxxxx in it indicates the current color

of the LED (red, green, blue hex) and an approximate color representation. You can change the color

by clicking on the "..." button

which will pop up the color picking table. Select the color desired...

And then click Submit to update the LED on the arduino!

Page 30: RB-Ada-03 Adafruit Ethernet Shield Kit for Arduino …...Make sure the shield is not on the Arduino. Then plug in the FTDI cable as shown, making sure that the Green and Black wires

On the hardware side, I used a single RGB (tri-color) LED, common-anode type with the three LEDs

connected to pins 8, 9, and 10. The XPort's RX and TX are connected to pins 2 and 3. You can watch

debug output on the Serial monitor (ie each time a connection is made)

The XPort is configured thusly:

*** Channel 1

Baudrate 57600, I/F Mode 4C, Flow 00

Port 00080

Connect Mode : D4

Send '+++' in Modem Mode enabled

Show IP addr after 'RING' enabled

Auto increment source port disabled

Remote IP Adr: --- none ---, Port 00000

Disconn Mode : 80 Disconn Time: 00:03

Flush Mode : 77

Note the different port and Disconnect Time settings. If you're using a Direct+ or a normal XPort you

can avoid using the disconnect timeout to drop connections but I couldn’t get it working on the Direct.

This works just fine though.

Memory used is ~12K flash (a lot of that is the javascript code for the color picker) and maybe 512

bytes of RAM.

Using your shield with a WIZnet Good news, there are tons of examples and a fully-documented Ethernet Library over at

the Arduino.cc site: http://arduino.cc/en/Reference/Ethernet