Just as desktop computers have "expansion slots" into which you can add expansion cards for video, sound, networking, and many other things, Arduino boards have "headers" on top where you can fit "shields" to add more functionality. The big difference, however, is that computer expansion slots are finite and independent: if your computer has 6 slots, you can put in 6 cards. And because (with some exceptions) each card is totally independent, it doesn't matter what you use. It could be 6 video cards, or 1 video card and 5 network cards, or whatever. The computer sees each card in isolation and they don't conflict with each other.

With Arduino shields it's not so clear-cut. There is no specific number of "slots", and shields can be stacked on top of each other to combine their features. Most of the time you'll only have one shield at a time fitted to your Arduino, but some people really take it to an extreme!

Photo by John Boxall

Sometimes shields can be stacked together and sometimes they can't, and it's not always obvious if they'll work together or not.

So how do you know if shields are compatible with each other?

Stacking Headers

All shields except the top one will need stacking headers. Many shields are fitted with regular male break-away headers that protrude down from the shield but don't provide a place on top where another shield can be plugged in. Try to use stacking headers on your shields whenever possible because it makes life much easier for you later if you need to stack them together. You can see the stacking headers clearly on the top shield in the photo above.

Physical Clearance

Even if your shields have stacking headers they may still have parts that are physically high and can foul another shield placed on top. Ethernet shields are notorious for this because the RJ45 jack is so physically high: the stacking headers are shorter than the RJ45 jack, so if you put another shield on top it will probably not sit down flat and the jack may short out tracks on the top shield.

One handy trick to get around that problem is to keep some spare stacking headers around to use as spacers between shields.

Pin Contention

Check the pin assignments of the shields you want to use, and make sure they're not going to fight over the same pins. Sometimes this can be quite difficult to determine so you may need to go digging through the manufacturer's schematic to figure out which pins they use. Sharing the GND, 5V, 3V3, RESET, and AREF pins is fine, but if your shields try to use the same data pins you may be in trouble. At Freetronics we have a rule that all shields must have clear markings showing which pins they use so that you don't have to go looking for datasheets unnecessarily.

If your shields use SPI communications to the Arduino they can all co-exist on the same SPI bus, with the exception of the "SS" ("slave select") line (sometimes called "CS", or "chip select") which will need to be configured differently for each board. The "MISO", "MOSI", and "SCLK" pins can all be shared by multiple shields. If you have multiple shields that use SPI and they also use the same pin for SS you may need to modify one of the shields. A typical approach is to cut the track going to SS on one of the shields and use a jumper wire to connect it to an alternative pin, and then modify the software for that shield to use that pin when communicating with the shield.

One little catch is with Ethernet shields based on the Wiznet W5100 chipset, which includes the official Ethernet shield and many third-party shields. The W5100 has a design flaw that causes it to maintain control of the SPI bus even when another device has been selected, making it very tricky to combine the official Ethernet shield with other shields that use SPI. The Freetronics Ethernet Shield uses the W5100 chipset but includes a fix in hardware so it doesn't have that problem and will happily share the bus with other SPI devices.

Software Interaction

Shields that come with a decent amount of software overhead (such as large driver libraries) can sometimes be a pain to combine if they use up lots of Flash, or SRAM, or have conflicting interrupts or tight timing requirements. This is something that may be difficult for you to determine at face value unless you know the internals of all the libraries involved quite intimately.

Power Requirements

The Arduino only has access to about 500mA via either the USB connection or the external power jack, and some of that is required by the Arduino itself. That leaves a fairly small amount of power available for shields to share, so if you have shields that suck a lot of power you may run into problems when they are combined.

Sometimes it's not particularly obvious which shields have high power requirements, but common culprits are LCD shields (some backlights can consume 300mA on its own) and wireless shields.

Be particularly careful with any shields that rely on the 3.3V supply, because it has a very low current limit of just 50mA. Shields that require a large amount of current at 3.3V (such as ZigBee shields) should implement their own on-board voltage regulator rather than relying on the 3.3V supply from the Arduino, but many times they don't. Be super-careful if you have two shields that both use 3.3V from the Arduino.

Radio / Electrical Interference

If your shields use any form of RF communication it's possible that they can interfere with each other. For example, WiFi shields contain a transceiver to communicate at about 2.4GHz, so if you have another 2.4GHz device jammed right up against it on an adjacent shield you are likely to have problems.

Electrical noise may also be an issue. A worst-case situation would be to combine a shield that needs an extremely clean electrical environment (such as a high-speed, high-resolution analog to digital converter) with a shield that causes lots of electrical noise such as a motor driver shield. Fitting extra power supply decoupling capacitors to each board can often help if electrical noise is a problem.

Got a comment or suggestion about this tutorial? Shoot us an email!

Back to Tutorials