I'm setting up a grid of 200+ slave modules which will be about 12 inches apart and the master will be anywhere from 5 to 10 meters away from the closest module. Each slave module will have a ATtiny85 to manage the sensor reading, LEDs and the network protocol.

The communication packets will be small and will probably be at 115200 baud if using ATTiny85's TTL serial or 1MHz if using SPI. In either case, the modules will be connected in a daisy chain to each other.

Each module will have a resistive touch sensor and be driving about 12 - 16 RGB LEDs (I'm making a step responsive disco dance floor). There will be 12v+ running to each module to drive the LEDs and regulated down to 5V for the ATtiny.

Which brings me to my question. With these constraints, do you think the ATtiny85's built-in serial or SPI would still work well over the 5 to 10 meters from the closest module to the master.

I know some people push towards RS422 or RS485 transceivers for distance applications, but I'd like to keep the total part count down, if possible.

  • I'm not sure SPI can work at all, since you would need 200 Chip-Select wires running from the master. – Gerben Sep 17 '14 at 10:15
  • 2
    I would daisy chained the SPI connection between modules: maximintegrated.com/en/app-notes/index.mvp/id/3947 – Jeremy Gillick Sep 17 '14 at 15:20
  • Just to be annoying... 115200 is about 10k bytes / sec. Divided by 200 is 50 bytes per second assuming your master is loading up the serial buffer and nothing else. If you have to wait for acks, etc that slows down things again. With daisy chain SPI there will be some delay getting to the 200th node, and getting a reply back. Why not try a tree topology, with routers that control a certain number of nodes. The routers can then communicate back to the master. Or instead of one ATtiny per tile, have one control multiple tiles with a led driver chip with lots of outputs, and multiplexed analog – geometrikal Sep 19 '14 at 13:23
  • inputs for the sensors. Sorry for the unsolicited opinion, I may have misinterpreted your design. :P – geometrikal Sep 19 '14 at 13:26

I have a few years working with DMX, SPI (and other serial) & LEDs. I have worked with DMX and a video dance floor for 10+ years previously. I would offer that "some people" are correct. You will get a reliable system with differential pair signalling (such as DMX). I have found from experience that over 5m of unbalanced serial starts chancing it. Over 10m and you are likely to come up with at least reliability issues, but more likely garbage.

I have used the TI SN75176B driver a fair bit and is cheap and works.

Depends on your audience. You can afford to chance it for your bedroom, but not paid business.


Sounds like a fascinating project.

It sounds like the majority of signals are driven by one ATTiny85 and received by a neighboring ATTiny85 about 12 inches away, with a good ground connection between them. Those signals can be directly connected.

If I were you, I would go ahead and get differential transceivers for the 10 meter distance. If you use daisy-chain SPI, then you need 3 differential line drivers at one end of the cable and 1 differential line driver at the other (and the corresponding line receivers to match); plus GND and +12VDC. If you use a SN75176BP as a line driver and another one as a line receiver for each SPI signal, that's a total of less than $8 for those 8 interface chips. (You need fewer line driver chips if you somehow daisy-chain TTL UART serial, since it uses fewer pins, but requires each chip to have more precise baud clock).

The software should not even be able to detect the difference between a simple wire from the output pin of one chip to the input pin of the next chip, vs. a line driver, some twisted pair cable, and a line receiver between those same two chips running the same software.

Many people use the rule of thumb that if a bit time is less than 10 times the time it takes for something traveling at the speed of light to make a round trip from the transmitter to the receiver and back, then you must use differential signaling with line termination. At 1 MHz, that gives a (1-way) cable length of 15 meters before you must use differential signaling with line termination.

So using the differential line drivers is probably overkill, but I'd rather have the first prototype work rather than cut corners on 100 things that I'm 99% sure probably won't matter, and then spend a lot of time debugging trying to figure out which one or two of those 100 things turns out that it does matter.

In addition to distance, loading might also be an issue. In particular, the "CLK" and "/CS" pins from the SPI master apparently need to drive every SPI slave. You can't really expect a single MCU output pin or even a single RS485 line receiver to be able to drive 200+ other chips. A line driver or other buffer every 10 or so chips is more than adequate.


"What if the SPI signal lines are very long?" (this experiment completely neglects the effects of interference from other noisy devices).

AN10364 "Transmitting the I2C signals as differential signals using RS-485 hardware" (Like SPI, I2C signals were never intended to be transmitted long distances over wire cables.)

"Maximum Unterminated Network Speed Calculator"

  • Keep in mind that termination and differential signaling are two different issues. Granted differential signals tend to be conceptually easier to terminate as it is obvious where the return path is, but the concept is applicable and advantageous with single-ended signals too. – Chris Stratton Oct 1 '14 at 14:41
  • @ChrisStratton: Yes. Termination helps prevent a signal from interfering with itself (round-trip bounce). Differential signaling helps prevent other stuff (including "ground noise") from interfering with the signal. Is there a better rule of thumb for deciding whether to use termination or differential signaling or both or neither? – David Cary Oct 1 '14 at 15:27

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.