I am making a system for measuring whether or not there is vacuum present in big steel containers. They are located up to 100 meters from the control cabinet.

The question is, how many SPI sensors can I successfully use at the same time with an Arduino Mega?

I have two main concerns, and there are probably more things I didn't think about.

Signal strength The shared lines for CLK, MOSI and MISO will need to be split up at several junction boxes and led to the different sensors. Since the voltage out from the Arduino is fixed, I'm fearing instability because the signal is weaker for some sensors, has someone done something similar? What is the greatest acceptable voltage loss for these lines to an ordinary sensor?

Processing Will the SPI library be fine coping with this many sensors?

The refresh rate can be set to extremely low, thinking 0.3Hz.

The alternative to all this is to go for 4-20mA sensors and have a 0-5V converter circuit for each sensor, near the controller.

Any inputs would be greatly appreciated!

  • 1
    The spi bus is ment to be used on the same board, or else for a very short distance. The i2c bus is also for short distances (because of its weak pullup signals). The rs485 is for longer distances. Which board to you use? The arduino mega 2560 is not the same as the esp8266. The 4-20mA sensors will work but when such long cables are connected to the arduino, that might damage the arduino. Do you use shielded cables? Perhaps there is a module for multiple 4-20mA isolated inputs and with a digital interface to the arduino.
    – Jot
    Mar 15, 2019 at 8:53
  • I'm thinking of using the Arduino Mega 2560 to receive and convert all signals, and then transmit data lines to an ESP8266 ESP07, which sends all data via MQTT over Wifi. I haven't bought the cables yet, but I was thinking to use individually shielded cables, yes. The supplier says the 4-20mA sensors will be fine for 100m. The arduino is the digital interface here really, if there's something else better suited, let me know. I'd like to use the Arduino IDE to program in, because I know it well already. Mar 15, 2019 at 12:59
  • the user has declared that he is no longer interested in the question and did not upvote any of the answers. it is a noteworthy subject which should get community attention regardless.
    – tony gil
    Sep 11, 2019 at 19:40

3 Answers 3


You can control as many SPI devices as you can set the CS line for. You can even control all the CS lines from a SPI device. A SIPO register will help a lot there.

However you are probably better off using a proxy board to actually connect to the sensors and then connecting the mega to the proxy to communicate the measurements using a connection that is more robust over long distances.

  • Since the Arduino Mega 2560 has a lot of DI/DO, that's why I wanted it to control many CS lines. I'm new to SIPO, is that a good solution for communicating over several cables? A proxy board can be a solution, wires need to be run anyway... but I would of course want to keep the complexity as low as possible. What kind of board would be suitable for that, another arduino, and which cable between them? Mar 15, 2019 at 13:04
  • Relevant suggestion, UPVOTED. :)
    – tony gil
    Sep 11, 2019 at 19:41

You need to drive SCK, MOSI, and 20 chip select lines long distance, and then receive MISO back long distance.

The number 20 for slaves is not a problem. Long distance and maintaining signal integrity will be a problem.

I would suggest a bussed newtwork and send serial data to/from 20 slaves (like ProMini) and let the slaves do the SPI data gathering and then pass that data back to the Master Mega in a polled fashion: #1 send your data, #1 here it is. #2 send your data, #2 here it is. Etc. Then you just need to connect up a 3 wire bus (RS485+, RS485-, Gnd) from device to device to device with termination resistors at the end of the run. Power each device seperately vs running power to all of them. Maxim has some nice tutorials on connecting up RS485.

  • Hi and thank you for your reply, however this was half a year ago, and I've since completed the project using 4-20mA sensors with separate wires. It turned out to be a flexible and rugged way of doing it, despite using many cables. Aug 13, 2019 at 6:32

I would recommend using multiplexer(s) for the task.

enter image description here Originally from this tutorial.

enter image description here

Or this tutorial by Sparkfun

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.