7
\$\begingroup\$

I have multiple users on seats (50), each with a small keypad for input. I need to collect inputs from all the users; I want to use Arduinos for each user, which will also display responses on a 7 segment display. I intend to connect all Arduinos using I2C but I fear the signal might drop due to long distance and fan-out limitations, so I'm considering daisy-chaining them.

Is this a good idea, or is there a better approach to do this?

\$\endgroup\$
6
  • 3
    \$\begingroup\$ Very large I2C-bus systems and long buses \$\endgroup\$ Jun 13, 2016 at 10:35
  • 1
    \$\begingroup\$ Are you going to power them all over this cable as well? \$\endgroup\$
    – pipe
    Jun 13, 2016 at 11:09
  • 1
    \$\begingroup\$ Someone in the middle cutting a cable or otherwise fiddling with the data. Literally a man-in-the-middle attack \$\endgroup\$ Jun 13, 2016 at 13:20
  • 2
    \$\begingroup\$ Why not handle multiple seats with each Arduino? A single Arduino should be fast enough to poll multiple keyboards and drive multiple displays (especially with appropriate latching buffers at each seat), then instead of 50 devices on the bus, you might have only 5 or 10. \$\endgroup\$
    – Johnny
    Jun 13, 2016 at 20:49
  • \$\begingroup\$ For the price of an arduino, why not use a Raspberry Pi with a wifi dongle? You'll probably come out cheaper for not having to buy all that cable! If this isn't an absolutely real-time critical application it sounds like this is the wrong tool for the job. \$\endgroup\$
    – J...
    Jun 14, 2016 at 11:56

5 Answers 5

21
\$\begingroup\$

The application note AN11084 (Very large I2C-bus systems and long buses) posted by RedGrittyBrick says:

Because the original I2C-bus applications were internal to a piece of equipment, for example in a PC or radio/TV/audio equipment, I2C-bus is rarely considered for systems when long distances with large numbers of drop-off points are required.

The solutions in the application note is to use specific driver circuits to convert the signals into something that can be driven over longer distances.

Since you will require driver circuits anyway, let me instead suggest that you take a look at RS-485. This is a tried and trusted standard for bidirectional transmission over long cables. It uses a normal UART on your Arduino, and the driver circuits can be found in many shapes and forms. If you don't want to make your own PCB there are adapter boards available that takes a TTL RX/TX signal from an UART and converts it to RS-485 levels.

\$\endgroup\$
5
  • 4
    \$\begingroup\$ RS485 is conceptually a good category of solution, though 50 nodes may start to exceed the drive capability of some RS485 implementations, at least it is an issue which would need to e checked. \$\endgroup\$ Jun 13, 2016 at 18:23
  • \$\begingroup\$ Worst case (RS-485) is a A/B selector that toggles between two groups of 25 nodes. A pin from the Arduino would do the toggling so it is synchronized to the last EOT marker. Since each node has a unique ID and built-in collision detect it should work. \$\endgroup\$
    – user105652
    Jun 13, 2016 at 23:34
  • \$\begingroup\$ The application note link is dead. It is archived here \$\endgroup\$
    – JolonB
    Dec 8, 2022 at 9:57
  • \$\begingroup\$ @JolonB Thanks, I updated the answer with a new link. \$\endgroup\$
    – pipe
    Dec 8, 2022 at 10:15
  • \$\begingroup\$ +1 for RS-485. It's much easier to use than many alternatives, is cheap, and very flexible. It can be confusing because there are so many drivers available, here are some tips: always use 75176-pinout, find driver which runs on your voltage, and has 1/4 or 1/8 unit load. (A good general purpose one would be MAX3471) Don't use "A" and "B" to label signals, use "DATAPOS" / "DATANEG". Use the lowest signalling rate you can get away with. Always send checksums. Convert to UDP on master, easy to simulate with UDP/IP server. Ask if you want reasons. \$\endgroup\$
    – jonathanjo
    Dec 8, 2022 at 10:55
8
\$\begingroup\$

If you're not particularly tied to the idea of using Arduinos for this, you could try some other microcontroller boards. I'm quite fond of the various boards that are based on the ESP8266 chip; these would have the advantage that they have an integral wireless networking connection so they can all talk directly to your central system that stores the input.

\$\endgroup\$
2
  • \$\begingroup\$ If the additional (really, a different) cost isn't a problem, wireless would be very advantageous. In particular, no need for 50+ different cable connections and designing the signal wiring for the space. \$\endgroup\$ Jun 14, 2016 at 16:25
  • 1
    \$\begingroup\$ @user2943160 Right - the cost isn't actually an issue unless you already have the equipment. A module like the ubiquitous ESP12 board (sold by numerous chinese vendors) plus a breakout board (because it's a surface-mount module, and you're likely to want pins to connect to) costs only a small amount more than a chinese clone arduino, and somewhat less than a genuine arduino. And certainly less than an arduino + an ethernet shield or other external hardware. \$\endgroup\$
    – Jules
    Jun 14, 2016 at 16:58
5
\$\begingroup\$

Have you considered arduino Ethernet with PoE? Solves the powering the devices issue and allows 2 way comms

\$\endgroup\$
10
  • 1
    \$\begingroup\$ THis is practically what Power over Ethernet was invented for. Excellent suggestion. You can even implement it yourself with different voltages from the standard, since Ethernet does not use all of the pairs in the cable. \$\endgroup\$
    – Dan
    Jun 13, 2016 at 16:04
  • 5
    \$\begingroup\$ An Arduino is a rather poor fit for Ethernet, both requiring an external network adapter that likely costs more than the base board, and not having much memory to handle packets (though in this case they need not be long). For the application in question there is the additional problem that most Arduino-compatible Ethernet adapters are point-to-point UTP requiring that a hub port be provided per node, which at 50 nodes adds up to an absurd amount of wiring. To make this at all practical, you'd need to find embedded 10Base2 adapters. \$\endgroup\$ Jun 13, 2016 at 18:30
  • 2
    \$\begingroup\$ @psmears if you can find me a arduino use case that needs gigabit I'll be impressed \$\endgroup\$
    – hardillb
    Jun 13, 2016 at 19:46
  • 1
    \$\begingroup\$ @hardillb: Haha, true - I just didn't want people getting the impression that you can get away with two of the four pairs for any Ethernet setup :) \$\endgroup\$
    – psmears
    Jun 13, 2016 at 21:16
  • 4
    \$\begingroup\$ @jpaugh: The power and signals are sent over the same wires - roughly speaking the signals are sent using AC, and the power is sent as a DC offset, and filtered out at the receiver. \$\endgroup\$
    – psmears
    Jun 13, 2016 at 22:10
2
\$\begingroup\$

If the distance between your nodes is not great, and you do not need to get particularly rapid communication, a daisy-chain where messages are propagated from one to the next via serial UARTs is likely one of the few things you can do without adding hardware. There is no limit to the length of the chain you can achieve if each board regenerates the signal it passes on, however each node will add some delay before it passes on a message - in the simplest implementation, the per-node delay might equal the transmission time of the message contents.

It sounds however like you may need to pass messages in both directions along the chain. The challenge in that would be the presence of only one hardware UART on each board. You can augment that with a software uart, though to get more than one of those you have to use a more sophisticated implementation than the default which ships with the IDE. Or if you can keep any on-board USB-serial out of the way, you can use the hardware UART to communicate in one direction and the software one in the other.

\$\endgroup\$
2
  • \$\begingroup\$ Or of course you could use a Mega 2560, which has 4 UARTs rather than just 1 like other Arduinos. \$\endgroup\$
    – Jules
    Jun 14, 2016 at 7:08
  • \$\begingroup\$ Yes, but the cost for 50 ATmega1284/2560 nodes would add up rapidly. Software Serial actually should work for this, or there are mulitple-UART parts that cost less than at ATmega328p. \$\endgroup\$ Jun 14, 2016 at 7:27
1
\$\begingroup\$

You can overcome I2C limitations by using DS28E17 1-Wire to I2C bridge.

Of course, the solution will depend on your budget and the required bandwidth.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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