'long' distance arduino daisy chain

I have a large shelf (like 5-10meters, or 15-30 feet long) which I want to put an LED in at every level. Thing like a positional system for a mini-library. I have a litte problem to efficiently drive the LED's. So I figured wiring every LED to the main board would be a waste of cable.

I think that I could make a mini LED-driver board per self part, and then daisy chain these drivers and let them be controlled from the main board.

LED - Main Board --- LED-Self-Driver1 --- LED-Shelf-Driver2 --- ...
|- Shelf1, Row1      |- Shelf2, Row1       ...
|- Shelf1, Row2      |- Shelf2, Row2       ...
|- ...               |-  ...


A - or | should indicate the cable connection in the 'diagram' above. That would save me a lot of cable. :)

My question: What would be a good way to daisy chain these Arduino's? The space between the shelf parts (and the drivers) would be at most one meter and the chain connection should include the powering of the drivers. The connection speed should be around 1kbit's.

Would SPI do it? Maybe a Software SPI with slower frequency? How would you do it? Or is the connection scheme a stupid idea?

Thanks for reading and happy X-Mas :)

• I'm not completely sure what you're asking (even thought you gave good detail.) You should only use 1 Arduino, no need to waste the money/Arduinos. Do you want each shelf's lights to be on at the same time, or what? – Garrett Fogerlie Dec 24 '12 at 16:24
• have a look at BlinkM: thingm.com/products/blinkm – vicatcu Dec 24 '12 at 18:01
• @ma-ver-ick +1 for the design idea. Do the Arduinos have to be specifically daisy chained? Would a multidrop bus like RS-485 or CAN work? There's nothing fundamentally wrong with the daisy chain approach,though. – Nick Alexeev Dec 24 '12 at 20:59
• @GarrettFogerlie I don't know when all the lights will be on/off. I would like to experiment a little bit with that. One LED should point to the location, but it would be nice if the LED's light the "path" from the terminal to the shelf place. – Augunrik Dec 24 '12 at 21:12
• @NickAlexeev Thanks for the +1! That's the question. But it would be nice if the Shelf-DriverN would be very cheap. I like the Wouter von Ooijen-approach to use a daisy chained LED driver. That would make the Shelf-DriverN really cheap and simple. – Augunrik Dec 24 '12 at 21:13

2 Answers

My approach would be to

• put the LEDs in a matrix (with resistors on one of the axis of course),
• run a continuous flatcable from the arduino and between the LEDs
• crimp a flatcable connector onto the cable at each LED position
• plug the LED into the fatcable connector (might be a bit unreliable because the LED pins are too thin), or put a boxed header onto the connector and solder the LED onto its pins

An N-wire flatcable and associated connectors can drive (N/2)^2 LEDs in a normal matrix. 10-wire flatcable gives you 25 LEDs, 40-wire is good for 400 LEDs.

Charlieplexing gives you (N-1)^2 LEDs for N wires, but at the expense of more complex software and the requirement that you can not easily use buffers, so I would consider that only as a last resort.

If in this scheme cable cost would be dominant you could do some clever things with with the cabling so unused cables are not run to the places where they are not needed. More details are needed (number of LEDs, distances)

If you realy need distributed-drivers approach I would consider the Microchip MCP23017 or MCP23S17. They provide 16 I/O pins (enough for 64 LEDs in a matrix!) via a SPI or I2C intercae. 8 such devices can share a common bus.

• Are you really sure to put in a matrix? Have you thought about the cable lengths? I don't think the matrix approach would considerably cut down the lengths. Don't forget the "columns" which would have to be connected trough the complete shelf. I could make every shelf part a matrix, but I didn't calculate that through. But you are completely right about daisy chaining LED drivers, somehow I forgot about this! – Augunrik Dec 24 '12 at 21:07
• Would the SPI/I2C LED drivers handle the distance? I searched the internet and didn't find something a non electrical engineer could understand... – Augunrik Dec 24 '12 at 21:14
• MCP23S17 is a nice recommendation and cheap (1€), nice :) Thanks. – Augunrik Dec 24 '12 at 21:32
• The shelfs are 1m/3feet width, and 2m/6feet (if I converted correctly) high. I think a combination of the two idea's (matrix, MCP23017) is a good idea. – Augunrik Dec 24 '12 at 21:36
• But how many LEDs per shelf, and how many shelfs? This is a design choice between communication (acble) cost and node cost, with various compromises inbetween, so we need the full data to give a meaningfull solution. – Wouter van Ooijen Dec 24 '12 at 22:27

While you can use extra arduinos as the led controllers, 1, I would hope you are using single chips instead of entire platforms (barebone arduino clones could be had for like 5 bucks, compared to full featured boards like the Uno at 50 bucks), and 2, you will have to deal with programming them all to work together. It's an expensive, frustrating and high effort way to do what you want.

What you really want is simple port expanders or led drivers. These can be had for cents. Various manufacturers make them, like microchip, Texas Instruments, Linear tech, etc. They can be accessed via 2 wire (i2c), 3 wire (spi), 4+ wires (shift registers), 1 wire types (annoying to code, libraries are useful).

Some allow for simple on/off control (port expanders) while others offer current control (no need for resistors) or pwm (brightness control). Some have inputs as well (you can wire a button on a module, and then figure out when it is pressed over the same wire that you run from the arduino down to the shelf).

Arduino has examples of this http://arduino.cc/en/Tutorial/LEDDriver

Another option is to get smart led strips (or modules). These basically combine the leds with internal control chips using spi or i2c or 1 wire, and allow for controlling each led individually (or in sets of 2~3 depending on the technology used). You can do it all with just two or three cables from the arduino to the led strips. Examples: http://learn.adafruit.com/digital-led-strip

• Port expanders with PWM? Could you suggest one, or do you have one in mind? I like the port expander idea. Somehow I didn't think that way (I'm a software engineer, so software solutions come to my mind first). Shift registers are a nice idea, if the length is a problem I could just 'shift slower'. Have you an idea if the length between the daisy chain elements would pose a problem? I have no experience. – Augunrik Dec 24 '12 at 21:17
• playground.arduino.cc/Learning/TLC5940 – Passerby Dec 24 '12 at 21:20
• The TLC5940 is a bad choice, as it needs to be driven by a high frequency clock signal from the Arduino (the PWM steps come from the clock which have to be synchronized with the 'row' signal for the single LED's). I seriously doubt that I can get that frequency with my experience across 30 feet. – Augunrik Dec 24 '12 at 21:29
• Sorry, edit timeout.The TI TLC5940 is a common used one, arduino has a library. playground.arduino.cc/Learning/TLC5940 It's kinda a spi/shift register hybrid (you need to pulse a clock to it). I prefer i2c myself, and am planning on getting a tlc59116 to play with (16 current controlled leds with pwm, over i2c). Adafruit also has a similar one, adafruit.com/products/815 which uses the NXP/Phillips PCA9685. It's cheaper to get the chip and a tssop adaptor board, most led drivers don't need anything more than a few resistors and a bypass cap. – Passerby Dec 24 '12 at 21:34
• I'll try that, thanks! I would like to accept both main answers, but I could only accept one. The other commentor came first, sorry! – Augunrik Dec 24 '12 at 21:37