I am trying to flesh out my ideas for an electronics project and this question seems to be the main hangup. Is it possible, in the I2C protocol, to figure out the order in which the slaves are chained to the host? For example if I have 5 arduinos strung together by their serial and clock lines I want the master to be able to see that Arduino 1 is in position 1, Arduino 2 is in position 2... And so on. But if I switch Arduino 1 and 2 I want the master to know that Arduino 1 is in position 2 and Arduino 2 is in position 1.

I assume this isn't possible because all of the arduinos are connected to the same data and clock. So does anyone have any other protocols or algorithms in mind where I could do this. I was thinking I could have one Arduino talk to it's neighbors somehow and waterfall data down the line until it gets to it's destination. But I'm curious to see what y'all come up with.

  • Please tell what your project is. Why do you want to know the order ? How long is the maximum total length of the wires for the I2C bus ? What kind of cable will you use ? Perhaps it is possible with jumpers for the I2C address or with the Serial bus in a daisy chain configuration. Perhaps the I2C bus can be daisy chained by using the hardware I2C for the Arduino as a slave and a software I2C for the next I2C bus. That will probably be too complex and unreliable. I can think of more possibilities with extra hardware, but they all will get you into trouble.
    – Jot
    Aug 16, 2017 at 0:32
  • I'm trying to make something like little bits or Legos where the user is able to stack the pices in whatever order and it runs sequentially from device to device.
    – Logan
    Aug 16, 2017 at 0:44
  • That is typically a daisy chain with the Serial bus.
    – Jot
    Aug 16, 2017 at 0:47
  • @jot please explain... As far as I understand it serial really only works for two devices
    – Logan
    Aug 16, 2017 at 0:50
  • Suppose you want to send data down and up the chain, then each Arduino should have two serial busses. It can be a software serial bus, but not the standard Arduino SoftwareSerial. One bus connects up and the other bus connects downward the chain. The Arduino boards mainly passes on the information between the serial busses (changing one byte to indicate that it has become one level further down the chain), and the Arduino only takes the command that is for the current Arduino. Each Arduino will know how far it is down the chain. You need a well described and preferably fault-tolerant protocol.
    – Jot
    Aug 16, 2017 at 0:58

1 Answer 1


This is indeed not possible. I2C was meant for short on-the-same-board communications and though it's sometimes also extended to near-board communications, it still has no facility for position sensing. Each slave simply listens for an address and then responds to commands sent for that address.

Slaves can "stretch the clock" to slow down things, but cannot otherwise make themselves known so long as they are not mastering the bus. In any case, even if bus mastering is assigned round-robin, only presence can be determined, not the position in any chain.

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.