I've got an Arduino Uno and 9 RFID sensors. Is there any way I would be able to run each of the 5 inputs/outputs through a single Digital on the board? I'd like to be able to have the RFID sensors in a 3x3 grid and have them be able to relay to the board an RFID chip is placed above each one. Not sure if that is possible. Thanks in advance for any help!
What type of module is your and what signals connect it to Arduino?
Are they inputs, outputs, or both?
I'm using the RFID RC522 modules, and I am using the 3.3v, GND, the Reset pin, Master-In-Slave-Out (MISO/SCL), Master-Out-Slave-On (MOSI), Serial Clock, and the Signal Input (SS/SDA).
Everything that could be found on this issue.
In theory, you can connect multiple devices via the SPI interface. In this case, the MOSI, MISO and SCK lines are common, but the SS must be separate for each device.
In practice, there can be problems in the form of mutual interference.
- Connect MOSI, MISO and SCK to pins 11, 12 and 13, respectively.
- For SS (CS) use any pin except 10, 11, 12 and 13.
- Do not connect anything at all to pin 10.
A port expander or shift register can be used to increase the number of SS lines.
So the max RFID readers I'd be able to connect is right, due to the 3 pins connected to 11, 12, and 13, and that 0, 1, and 10 cannot be used?
Pin 10 is designed to work with one device. If you have multiple devices, use different pins. Do not use pins 0 and 1 either, because this is a hardware Serial port.
Read any article on SPI to get started. Like next one.
How to Connect Multiple SPI devices to an Arduino Microcontroller
If the Arduino board acts as a Master, it can use any digital pin as SS (Slave Select) to select one of the external devices. This pin is used in OUTPUT mode.
If the Arduino board acts as a Slave controlled by an external Master, pin 10 of this board is used as the SS input.
To my knowledge, pin 10 can be used as an output (and it can be one of the SS signals); it can not be used as an input.
As explained by @Boffin, it's wise to stay away from pins 0 and 1 on an Uno/Nano/Micro/Mega till you have no other option. Remember that analogue inputs can also be used as digital pins.
Use a 74HC42 decoder to make any three output pins produce up to 10 SS pins for your chip select lines.
What is your application?
I did make this project with a lot of RFID detectors, an 8 by 4 matrix, but I built them out of discrete components.
Small clarification. Each three inputs can give up to 8 outputs, and 4 inputs up to 10 outputs.
Right now I have the MOSI, MISO, and SCK of each running through a breadboard and back through to the 11, 12, and 13 digital pins on the Uno. The RST are through the breadboard and to the 9 digital pin, and the SS are run individually from 2-8, A0, and A1. Right now, I can somewhat get them to scan properly, but it is very random on which ones decide to scan. I have gotten all 9 scanning simultaneously exactly one time, but the best I can get otherwise is 7 at a time. The firmware versions almost always scan as unknown, which, despite the firmware scan being unknown or v2.0, it doesn't mean they will scan or not.
Nevermind. I had my readers too close for proper use, so I had to initialize and halt them before moving on to the next one. Thank you all for the help, though!