I am working on a setup that needs to have multiple devices communicating over a network. There will be 1 Master device and numerous Slave Arduino devices (possibly 40-50).
I wanted to setup as an intranet, but looking at the infrastructure cost, I don't think its preferable to have all that cost of extra equipment if the network won't span beyond a few meters. And then I'll have to stick to HTTP or TCP/UDP if I choose to go with intranet.
Coming to SPI, from my past experience, I know that there are 4 connections (for data transfer) between a Master and a Slave where 3 can be common for multiple devices - MSIO, MOSI, CLK while the fourth connection is CS, that will be unique per slave. Looking at the number of Slave devices I will surely have issues with limited number of GPIO on my Master device.
I came up with a hypothetical setup. Please refer to the attached screenshot with block diagram.
I have added multiple shift registers (for example 74HC595 - can control 8 slaves with 1 such chip), that would be used over SPI0 of Master, and would be responsible for handling the CS (Chip select for the Slaves), while SPI1 of Master will be used to send data to all the Slaves. The one with Chip Select set to low will communicate with the Master. So technically, I will be using 4 pins for SPI0 and 4 pins for SPI1 for all the communication, instead of 50 (CS)+4(SPI) for a 50 slave device network.
I wasn't able to test with a practical setup, since I don't have enough MCUs handy to hook them up for the test, and I'm yet to decide on the network.
I know I shouldn't be asking for an opinion on this forum so I will limit my questions to below:
- Has anyone seen a practical implementation of such a network?
- Is this even possible (using Shift registers for chip select).
- Is synchronized communication between multiple SPI ports is even possible? Can I use the same SPI for switching between Shift registers and Slaves, if there is a sync issue.
- Are there any other tradeoffs of using SPI communication over such a network (with devices over 40-50). One would of-course be the data transfer speed.