I’m building a device that requires 60+ serial distance sensors spread out a great distance, all communicating back to a central controller.

I could go with existing I2C distance sensors, but my options there are limited, expensive and (possibly) overkill for what I need.

To get data from 60 cheap IR distance sensors into an arduino or similar along a serial line, it seems I will need a microcontroller for each sensor to get its data onto the bus at the right time.

Is this right? Or is there a cheaper/better way to turn 60 dumb sensors into one smart sensor, without requiring 60 wires all coming back into one controller?

  • \$\begingroup\$ A low end MCU isn't a bad idea, but you might want to consider something like multi-drop serial (via tristate) instead of I2C. You can potentially even make it half duplex using a single data wire. If you want to get really fancy you can probably multiplex it with power, eg look at one wire or the DCC stuff the model train people do. \$\endgroup\$ Commented Jul 27, 2020 at 17:32
  • \$\begingroup\$ There are plenty of low-cost, low pin count MCUs out there that would be ideal for such a task. For example, see the 3-cent microcontroller series on EEVblog. \$\endgroup\$
    – Dave Tweed
    Commented Jul 27, 2020 at 17:33
  • \$\begingroup\$ Not sure what you mean by “great distance” but you may need something like CAN to handle the long bus wires. I believe MCUs with CAN ports have arbitration built in for data collisions. \$\endgroup\$
    – Joe Mac
    Commented Jul 27, 2020 at 17:46
  • 1
    \$\begingroup\$ Sounds like you want 1 wire not i2c. I2c os meant for on a board not over long wires. \$\endgroup\$
    – Passerby
    Commented Jul 27, 2020 at 17:52
  • \$\begingroup\$ i came across this a few months back ... looks promissing ... should work with ATtiny85 ... have not tested though ... pjon.org/SoftwareBitBang.php \$\endgroup\$
    – jsotola
    Commented Jul 27, 2020 at 18:21

1 Answer 1


If each sensor has a small micro controller you can have them addressable via UART. All sitting in RX mode until they get their addressed command, and then they respond. Pretty standard method.

To be clear, the sensors would all be "daisy chained" together in parallel, power, ground RX and TX.

UPDATE: The max distance for both I2C and RS232 (or any transmission really) depends on the cable capacitance. The maximum cable length is 50 feet, or the cable length equal to a capacitance of 2500 pF. Using CAT5 cable you get this:

RS232 cable length according to Texas Instruments
Baud rate   Maximum cable length (ft)
19200        50
9600         500
4800         1000
2400         3000


You haven't mentioned baud rate requirements, but 500ft @ 9600 looks pretty good.

Also, RS232 drivers are push-pull whereas I2C is only pull down with a resistor pull up. So it degrades faster with a cables capacitance, unless you lower the pull up resistance which increases power draw.

If you need faster baud rate, then you can look at RS-485 (differential) instead. It pretty much the same from the CPU perspective, you just use a different driver chip.

  • \$\begingroup\$ You’re recommending UART instead of I2C? The total distance will be around 100 feet, with the 60 sensors sprinkled throughout, each on a custom printed board joined to the others serially via jumper cables. Is 100ft too long for i2c? The sensors are for real-time interaction with the piece via gesture detection, but I imagine either protocol will consistently get the 60 signals back to the main controller fast enough for that. \$\endgroup\$ Commented Jul 27, 2020 at 19:08
  • \$\begingroup\$ @MikeMiller are you sure you can't do this with a video camera or something like a kinect? \$\endgroup\$ Commented Jul 27, 2020 at 19:38
  • \$\begingroup\$ @Aaron a multi-drop scheme may well be dominated by the loads, not the cable \$\endgroup\$ Commented Jul 27, 2020 at 19:51
  • \$\begingroup\$ @ChrisStratton I agree. It all depends on the interface he selects. \$\endgroup\$
    – Aaron
    Commented Jul 27, 2020 at 19:55
  • \$\begingroup\$ @MikeMiller 100 feet is way too long for I2C. Even though 128 addresses are possible, 60 devices may be too much as well due to capacitive loading on TOP of the that of the long cable. All this limits speed, and the fact I2C uses a master clock limits your speed even if none of the above were issues since the clock pulse must be slow enough that a pulse can travel from master-to-slave, slave to process, and slave to send another pulse back to the master, all within the same clock cycle. \$\endgroup\$
    – DKNguyen
    Commented Jul 27, 2020 at 20:03

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.