Stacking an Arduino, Ethernet shield and an Xbee shield

October 5, 2010

As part of “Project G3H“, want the greenhouse to operate stand-alone, but also be able to log data on a remote server. To achieve this, the greenhouse will be monitored and controlled from a stand-alone, arduino based mote. This mote will monitor the environment in the greenhouse and contain the logic to control the environment based on those measurements (i.e. water the soil, switch on grow lights, etc). To implement the remote data logging capabilities an Xbee RF radio module is added by means of an XBee-shield. This allows for wireless serial communication to another Xbee radio.

That other Xbee radio is placed on top of a second Arduino board and will receive the data from the mote wirelessly. The receiver will also sport an ethernet connection to connect the whole thing to the internet.

This means that the receiver consists of an Arduino (Duemilanove), Ethernet shield and an Xbee shield. The ethernet-shield must be stacked on top or the Arduino first, as the Xbee-shield does not lead through all the pins from the Arduino. The Ethernet shield does. Another problem presents itself when you want to stack the Xbee-shield on top of the ethernet-shield though. The Xbee-shield draws its power from the 6-pin ICSP header on the Arduino, but the ethernet-shield does not lead those pins to the top.

So, I made a short cable to connect the ICSP pins from the Arduino to the ICSP header on the bottom of the Xbee shield. Below are a few photo’s to show the process:

Arduino, Ethernet shield, Xbee shield and cable

Arduino, Ethernet shield, Xbee shield and cable

The hand-made cable consists of 2x 3 female 0.1″ pitch (2.54mm) headers with 6 jumper wires soldered to them. The cable is a one-off, and not very pretty as I did not know how to cleanly cut 2 rows of 3 headers out of a long strip of 40. With a glue gun, I covered the solder points to isolate them from each other and prevent the from touching the ethernet-shield above.

Arduino with hand-made cable connected

Arduino with hand-made cable connected

To add it all together, I first put the hand-made cable on the ICSP header of the Arduino, then stacked the ethernet-shield on top of that.

Ethernet-shield on top of the Arduino

Ethernet-shield on top of the Arduino

Then connected the six ends of the hand-made cable to the ICSP female header on the bottom of the Xbee-shield.

Xbee-shield connected to the hand-made cable

Xbee-shield connected to the hand-made cable

Finally stacked the Xbee-shield on top of the ethernet-shield. Be careful though as you stack those two. The Xbee shield will not fit snugly on top of the ethernet-shield as the RJ-45 connector is so high, it blocks one corner of the Xbee shield. You can gently push the corner of the Xbee-shield next to the RJ-45 connector housing. That way, the Xbee shield can be perpendiculat to the other two shields.

Xbee shield incorrectly stacked on ethernet-shield

Xbee shield incorrectly stacked on ethernet-shield

Xbee shield correctly placed on the ethernet-shield

Xbee shield correctly placed on the ethernet-shield

Arduino, Ethernet-shield, Xbee-shield stack

Arduino, Ethernet-shield, Xbee-shield stack

And now I have a gateway device capable of wireless communication with other Xbee radio’s as well as an internet connection. The Xbee radio’s (Series 2) are capable of setting up a wireless mesh network. This means several more radio’s can be added in the future to all communicate to one coordinator-node in the network. This gateway device will be setup as a coordinator, while the greenhouse controller will be a router/end device. This means it can send its own data to other nodes, like the coordinator, but also route other mesh-nodes messages if necessary. More information on that can be found on the Digi support website.

Big thanks to Pieter Floris, from I bought the shields from him and as soon as I realised that I had to craft a cable to connect the ICSP pins and headers, he sent me a few male and female headers for free. Thanks Pieter!

15 responses to Stacking an Arduino, Ethernet shield and an Xbee shield

  1. hello, I wonder that if I buy these three products, can I connect my coordinator xbee to the internet? My school project is about xbee. coordinator xbee should connect to internet and enddevice xbee has leds. I’ll give commands through internet in my home and the first xbee (that connected to internet) understands commands, coordinates second xbee so the enddevice xbee’s leds light up. Xbees are in a building, there are 100m between them. I am writing commands far away. thank you.

  2. Hello Mehmet, I was able to indeed connect my xbee to the internet. However you would still need some other xbee with this setup. So, two Xbee’s in total.

    I have one Arduino with an Ethernet shield and Xbee shield. The Ethernet shield allows for a connection to the internet. The Xbee shield is there to receive data from another xbee. So, all together this setup receives data from Xbee’s elsewhere and via the arduino sketch, sends that data via the ethernet shield to the internet ( in my case).

    And that is where the second Xbee comes in. I have another Arduino, also with an xbee shield and several sensors and actuators in a greenhouse. That device controls the environment inside the greenhouse and periodically sends sensor data to the ethernet-enabled device for logging purposes.

    I hope this helps a bit to clear things up. I plan to write more detailed posts in the future, but right now I simply cannot find the time to do so.

    Once the sketches and documentation are ready/finalized, I will wrap it all up in a package and share it online. But again, that is not to be expected in the coming days yet.

    • Dear Arno
      I have a project to connect my VOIP server using the XBee ,I am using Arduono Lenorado with built in Ethernet and Xbee Shield .

      I really appretiate if you please send me the source code or a library for this


  3. Thanks a lot, you help of course.

    According to my project, I think one arduino and xbee shield are enough, because I only light a led that is connected to the second xbee. I only use arduino, ethernet shield and xbee shield to connect the first xbee to the internet. I send commands from far away through internet, first xbee understands them, and lights the second xbee. Am I wrong?

    best regards.

  4. hellow,, can anyone help us for our thesis? We will use
    Xbee for wireless internet connection. The Xbee will stand as
    access point.,, is there anyone could help us?.. thanks

  5. Hi, thanks for the tutorial. Isn’t the ICSP connector only used to connect 5V and GND? Wouldn’t it be much easy only to connect those pins? There are also already some soilder points on the XBee Shield for 5V and GND. Is there any need to connect the other ICSP pins?

    • Hi Jeff, also for an apology as your comment was also buried between comment-spam.

      You are right that it is not necessary to connect all ICSP header pins from the Arduino to the Xbee shield. As a minimum you should connect 5V, GND and the RESET line from the ICSP connector to the top and indeed, you could do that also with solder points on the xbee shield. But, to be honest, I had just gotten a cheap new gluegun, which I wanted to try. The gluegun worked, but the cable became a bit of a messy job. It does work though, and it leaves me with a setup that can be easily detached if I want to later.

  6. hey,
    I don’t anderstand how it’s possible to do this… RX and TX are use in the Xbee board and also in the ethernet board as light indicator. Is it possible to unactive the light indicator of ethernet?

  7. Hi,

    Excelent tutorial!

    I have the same Xbee Shield, but I have the new version of Ethernet Shield (this one

    According to Sparkfun’ description, Arduino communicates with this new ethernet shield using SPI bus (through the ICSP header).

    So, Have you any experience with this new ethernet shield? Can I combined it with xbee shield?


    • Hi,

      I believe the shield I am using communicates to its W5100 chip using the same Arduino pins (10-13), although the shield I am using has an SD card slot on the silkscreen it is not actually populated, so I think we are using the same version of the shield.

      If you look at this page: you can see the pins used to communicate with the ethernet shield. To communicate with the XBee, the Arduino uses the RX/TX ports (D0 and D1) (see:

      So, there is no conflict on the pins used between the two shields; I think you should be fine. But, the best way to find out is to try!

      Hope this helped!

  8. Hi Arno,

    I will try it soon ;-)

    Thank you

  9. hello guys ,,

    i am also trying to cooperate an xbee shield with an ethernet one..
    i have connected GND and 5V wires from the pins of the ethernet shield to the ICMP connector of the xbee and it turns on but it seams anable to connect wirelessly with my
    second arduino. Is it something that i am forgetting??

  10. vass If you use one of those ftdi basic breakout boards to test that you are getting coms successfully from the first board with a computer hooked up to the ftdi board ( and a useful board for debugging/writing interfaces in windows ) you should have some leds flickering (tx and rx) sorry for the late reply hope you found a solution :) i have a pro shield that i am trying to connect to a xref module ( xbee compatible ) here is my help on that process

  11. hi Arno , i find a problem of communication when i put xbee card in the top with ethernet card+arduino uno.
    – arduino+ethernet :they communicate normally
    -arduino+xbee:they communicate normally
    -and when i put arduino+ethernet+xbee :i find a problem !!!