I have a project in hand where I need to connect 5 arduinos as slaves to Raspberry Pi. Load Cells, Reed Switch, Solenoid lock will be connected to each of the arduino. The arduinos need to send the weight readings when a communication is started by the raspberry pi(master). Only a single arduino will be activated at a time. The arduinos will be placed at a maximum of 6ft distance from the raspberry pi. I need advice regarding how to make this connection. I read that I2C cannot be used for long distances so I am unsure if 6 ft is a long distance for I2C. Next, I am trying to see if a USB would work for my case but the issue is the Pi has only 4 USB slots. So can I use a external USB hub with an external power supply and connected each of the arduinos to the USB hub and provide individual power supply to the arduinos? Will this arrangement work or should I be looking at any other protocol apart from I2C and USB?? Any advice on this will be much appreciated. Thanks a lot for your time.

  • Hi @Shiny, Ah, let me see. (1) Yes, I2C 6 feet is too long, (2) Rpi4B has 4 built in USB sockets, but you can add USB hubs to expand to many more than 4 channels. (3) Rpi4B has 6 built in UARTs. You can also use USB to serial UARTs apapters/cables (search this forum). So you can easily make 20+ USB/UART/TTL channels (again, search this forum). (4) You can use RS485 etc, but need hardware adapters and make things too complicated. So, start with RS232/TTL, and upgrade to RS485 later. – tlfong01 Oct 11 '19 at 4:57
  • USB repeater cable, 5 meters – user2497 Oct 12 '19 at 11:09

6 feet should be doable for I2C with decent cable, serial over USB (you can use a hub on RPI end for more ports) should also work.

However, I recommend looking into network-enabled (MQTT and alike) communication; you could replace your arduino with things like ESP8266: it may take little learning to get going but they are cheap and the benefits of getting rid of all the wiring (unless specific latency or other relevant limitations) is truly worth it. Besides, this approach does not limit you to distance and number of devices you communicate with.

| improve this answer | |

Your Answer

