Ethernet shield and RFID/GPS-sensors connection


for a university project I am currently working with two sensors, the MFRC522 RFID and Adafruit Ultimate GPS module, both connected to an Arduino Uno.

Until here everything works really well, yet now, since I want to send data to a database on the Internet, I am implementing the Arduino Ethernet shield and I am starting to get a few questions you can maybe answer.

From my limited understanding I understood that the advantage of a shield (probably under many more) that I can simply plug it on top of my Arduino by which it takes the pins needed to function.
I am wondering now if this can maybe interfere with the connections to other sensors, since it would require me to use some pins twice.

This is what I mean. I took the used pins from here:

Ethernet Shield:

  • 3v3
  • 5v
  • Dig 10
  • Dig 11
  • Dig 12
  • Dig 13

RFID module

  • SDA → Digital 10
  • MOSI → Digital 11
  • MISO → Digital 12
  • SCK → Digital 13
  • GND → GND
  • RST → Digital 9
  • 3.3V → 3.3V

GPS module

  • VIN → +5V
  • GND → GND
  • RX → Digital 2
  • TX → Digital 3

From this list I can see that the Digital pins 10,11,12 and 13 are used by both the RFID and the Ethernet shield.
Would it be possible to just plug on the Ethernet shield and still use those (used) pins for the RFID or would this end in some interferences or worse in breaking my components?

I also though about maybe just rewriting the pins of the RFID module to other pins (maybe dig 5-9) but in my code I extracted from examples of both libraries I can only find

#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN);

Hence I wonder where I could possibly change pins 11-13 to other ones.

I will also attach my code so you can maybe understand better what I want to do:


FinalCode.ino (6.7 KB)

You don't need to. The only pin that may interfere with the Ethernet shield is pin 10 which is the SPI slave select. If you put that to p.e. D8 and change SS_PIN to 8 in your code everything should work. You can have multiple devices on the SPI bus as long as every SS goes to a different pin. MISO, MOSI and SCKL may be share by all of them.