Is a special order necessary

Hi there,

I've got a question: I'm working on a school project with Arduino.

My components are:

  • Arduino UNO R3
  • Arduino Ethernet Shield
  • Sparkfun RFID-Shield 13.56 MHz
  • 2x16 character 5V display

My question is: I have to use all these components at once. Do I have to keep to a special order when implementing them into the code? Or do you have other tips concerning the problem with working with more different components?

Thanks in advance

Yours
Dominik

When you are dealing with multiple shields, you need to read the data sheet/instruction manual on each shield to see what pins are used, and what pins are passed through. If your shields all use unique pins, that is great. If the only pins that are used by both shields are I2C pins (SCL/SDA or A4/A5), that probably is also ok. If both shields try to use the same pin for different purposes, then you have a problem.

Other problems might be whether both shields assume they are the top shield, and don't support stacking any shields on top of them. Even if they support stacking, they might not have provided stacking headers, and you would need to make sure you buy the headers elsewhere. Depending on how much power each shield uses, I could imagine multiple shields using too much power for the device. Finally, if the shields were designed for earlier Uno's, they might not have the extra pins (SDA/SCL as a separate breakout, AREF, etc.), and it might be a problem mounting a new shield on top of an old design.

If both shields try to use the same pin for different purposes, then you have a problem.

I already had and solved that problem but thanks :slight_smile: :slight_smile:

I've already connected all the stuff and the display which is on top worked after I solved the problem with the pins.

Now I only need to combine the shields in the code. Do you think there could be other problems?
Do I have to stick to a certain order in concerns of initializing the different components in the code?

Now I only need to combine the shields in the code. Do you think there could be other problems?
Do I have to stick to a certain order in concerns of initializing the different components in the code?

You will be initializing the peripherals in setup(), so if there are issues, it is very simple to change the order. The only hard rule that I am aware of comes when one shield depends upon another; so, you would want to initialize a parent device before a child. However, from inventory of shields you are using, I do not think there should be an issue...
maybe LCD, Ethernet, RFID ... that way, you can display a status message in startup order, maybe "LCD initialized", "Initializing Ethernet", "Ethernet Initialized," "Initializing RFID", "RFID Initialized", 'Beginning main routines..."

Ray

Thank you for your answer. That really makes sense. :slight_smile:

Additionally, I recommend that you tackle the different hardware subsystems separately. Connect each one in isolation and write a minimal test harness to learn how to interact with it and confirm it does what you want, then add in the other hardware and confirm that your test harness still works as you want. Do this separately for each hardware subsystem, so you know all the hardware works and you know how to interact with each one before you try to combine those different software functions into your project.