I want to connect multiple (exactly 64) RFID-RC522 modules to one Nodemcu ESP8266. I already know, that it is possible to connect multiple RC522's by just using different pins for the SDA pin, while the rest of the RC522 pins can be connected to the same pins on the ESP8266. But not that many, of course.

My research on "how do I get more pins", got me to the MCP23017 port expander. Further research is not exactly clear, if I can use these pins as ChipSelect/SlaveSelect pins for the RC522. The two libaries I found for MCP23017 (blemasle/arduino-mcp23017 and Adafruit-MCP23017 seem not to support this, when I use miguelbalboa/rfid (which I have to use, as there seems to be no alternative), because the MCP-Libs do not provide a "Pin Number" for the MFRC522 constructor(?).

So, is this just a "software" thing, or a technical limitation, and what I want is simply not possible? My research was not exactly clear about this, but I'm also very new to electronics and might be researching in the wrong direction.

  • For a chip select pin you just need a digital HIGH or LOW. Any digital pin on any expander can do that. You can connect multiple of those expanders to the same SDA and SCL pins as long as they have different addresses. I'm not sure how many possible addresses there are for those chips. If there are at least 8 possibilities then you can get this all from two pins on the Arduino. – Delta_G Jul 10 '20 at 2:03
  • You will probably suffer from bus capacitance and fanout issues long before you get to 64 devices regardless of expanders. Think outside the box. – Majenko Jul 10 '20 at 7:36

Sure, you can use IO expanders for the chip-select pins of SPI devices. You will have to modify the device libraries to support them, though, because no one is going to do that by default unless it's a very very specific library.

However you will probably not have much luck with your project anyway, since you will more than likely run into problems with fan-out and bus capacitance before you even remotely approach 64 devices on your bus.

You would need to be adding extra bus drivers and partition your bus to reduce and spread the load - at which point it would be simpler and cheaper to just use multiple microcontrollers with just a few RC522s one each.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.