How to get more SS pins? (RFID project)

Hey,

I have a project where I need to be able to use 10 RFID-RC522 with one Arduino Mega 2560. At the moment I'm trying to get at least 2 to work, but there's only one SS pin (pin 53). How can I get more?

Thanks in advance!

Any digital output pin can be SS, it is under user software control. The only caveat is that if you are using multiple shields you have to cut/greenwire traces.

Any digital output pin can be SS, it is under user software control. The only caveat is that if you are using multiple shields you have to cut/greenwire traces.

Are you sure ? I did a SPI project with six MCP4162s and only one of them used d10 (the default SS pin on an UNO). /The rest used 9,8,7,6, & 5 as SS.

Why do you need to cut traces ? (which traces ?) SPI is a bus oriented protocol so it would seem that as long as you have an I/O pin available you could use it as the SS pin.

If you have multiple shields with a hard wired SS pin, you need to cut traces to wire it to a different output

KeithRB:
Any digital output pin can be SS, it is under user software control. The only caveat is that if you are using multiple shields you have to cut/greenwire traces.

I’ve tried using pin 52 as the SS as well, but it doesn’t work.

surfknasen: I've tried using pin 52 as the SS as well, but it doesn't work.

Then you haven't done it correctly. Post what you have tried and we might be able to see what you have done wrong.

The SS pin on the Arduino is intended for when you want an external device to control the master/slave status of the Arduino.

It has no special significance if the Arduino is the master. In that case any I/O pin can be used to control the SS pin of other devices.

...R

I'm currently trying to do the same with 2 x 522s and an uno and am having problems. I connected the readers mosi, miso, sck together on a breadboard then a single input for each on the uno. The sda (10 and 8 ) and rst (9 and 7) have their own pins for each of the readers. One of the readers can read cards, while the other doesn't. Am I wiring this wrong?

I’m using this code.

/*


  • Example sketch/program showing how to read data from a PICC to serial.

  • This is a MFRC522 library example; for further details and other examples see: GitHub - miguelbalboa/rfid: Arduino RFID Library for MFRC522
  • Example sketch/program showing how to read data from a PICC (that is: a RFID Tag or Card) using a MFRC522 based RFID
  • Reader on the Arduino SPI interface.
  • When the Arduino and the MFRC522 module are connected (see the pin layout below), load this sketch into Arduino IDE
  • then verify/compile and upload it. To see the output: use Tools, Serial Monitor of the IDE (hit Ctrl+Shft+M). When
  • you present a PICC (that is: a RFID Tag or Card) at reading distance of the MFRC522 Reader/PCD, the serial output
  • will show the ID/UID, type and any data blocks it can read. Note: you may see “Timeout in communication” messages
  • when removing the PICC from reading distance too early.
  • If your reader supports it, this sketch/program will read all the PICCs presented (that is: multiple tag reading).
  • So if you stack two or more PICCs on top of each other and present them to the reader, it will first output all
  • details of the first and then the next PICC. Note that this may take some time as all data blocks are dumped, so
  • keep the PICCs at reading distance until complete.
  • @license Released into the public domain.
  • Typical pin layout used:

  • MFRC522 Arduino Arduino Arduino Arduino Arduino
  • Reader/PCD Uno Mega Nano v3 Leonardo/Micro Pro Micro
  • Signal Pin Pin Pin Pin Pin Pin

  • RST/Reset RST 9 5 D9 RESET/ICSP-5 RST
  • SPI SS SDA(SS) 10 53 D10 10 10
  • SPI MOSI MOSI 11 / ICSP-4 51 D11 ICSP-4 16
  • SPI MISO MISO 12 / ICSP-1 50 D12 ICSP-1 14
  • SPI SCK SCK 13 / ICSP-3 52 D13 ICSP-3 15
    */

#include <SPI.h>
#include <MFRC522.h>

#define RST_PIN 5 // Configurable, see typical pin layout above
#define SS_PIN 53 // Configurable, see typical pin layout above

MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance

void setup() {
Serial.begin(9600); // Initialize serial communications with the PC
while (!Serial); // Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4)
SPI.begin(); // Init SPI bus
mfrc522.PCD_Init(); // Init MFRC522
mfrc522.PCD_DumpVersionToSerial(); // Show details of PCD - MFRC522 Card Reader details

Serial.println(F(“Scan PICC to see UID, SAK, type, and data blocks…”));
}

void loop() {
// Look for new cards
if ( ! mfrc522.PICC_IsNewCardPresent() ) {
return;
}

// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial()) {
return;
}

// Dump debug info about the card; PICC_HaltA() is automatically called
mfrc522.PICC_DumpToSerial(&(mfrc522.uid));

}

I’ve wired:

RST to 5.
MOSI to 51.
MISO to 50.
SCK to 52.
SS to 53.

If I switch SCK and SS it stops working (SS goes on pin 52 and SCK pin 53).

bump

So, i finally managed to connect 3 readers to my uno after trying for last 2 days. After several attempts to wire this thing I found out one of the wires is not connecting/broken. I used the Iscp to connect the mosi, miso, sck, ground and vcc. Each of the readers has his own RST and SDA pins; it doesn't seem to matter which ones.

Try connecting the shared reader pins to the ISCP on the mega like on the picture. I didnt use the RST pin on the ISCP but had an individual pin for each.

Chole: So, i finally managed to connect 3 readers to my uno after trying for last 2 days. After several attempts to wire this thing I found out one of the wires is not connecting/broken. I used the Iscp to connect the mosi, miso, sck, ground and vcc. Each of the readers has his own RST and SDA pins; it doesn't seem to matter which ones.

Try connecting the shared reader pins to the ISCP on the mega like on the picture. I didnt use the RST pin on the ISCP but had an individual pin for each.

I'm gonna try this later. Could I also see your code? Thanks!

surfknasen:
bump

You need two instances of a class if you want to use two readers.
You need to post your code correctly using the </> icon.

surfknasen:
bump

It’s a bit cheeky to post a “BUMP” after 3 hours. It would be reasonable after 3 days.

Please modify your post and use the code button </> so your code looks like this and is easy to copy to a text editor. See How to use the Forum Your code is too long to study quickly without copying to a text editor.

Also, please provide some evidence that you have read and considered the replies you have already received.

…R

Grumpy_Mike:
You need two instances of a class if you want to use two readers.
You need to post your code correctly using the </> icon.

Robin2:
It’s a bit cheeky to post a “BUMP” after 3 hours. It would be reasonable after 3 days.

Please modify your post and use the code button </> so your code looks like this and is easy to copy to a text editor. See How to use the Forum Your code is too long to study quickly without copying to a text editor.

Also, please provide some evidence that you have read and considered the replies you have already received.

…R

I finally got it working.
I was unsure if people would still see it if it disappeared to the second page of the forum.
I also read all the comments and posted the reply to all who had replied.
Thanks for all the help!

So can you finally say what you were doing wrong, it will help others in the same situation.