# Controlling 5000 LED

I'm doing a project where it requires to control 10,000 I/O.

5000 output - For 5000 LED, where only 1 LED will be light up at one time

5000 input - For 5000 sensor, where it'll sense the presence of an object.

Basically , i'm doing a storage system (something similar to pigeon hole) whereby, small box will be placed in this pigeon hole. Currently i have about 5000 boxes placed over 20 racks. Each rack has 250 hole (10 coloumns x 25 rows).

Each of this holes will have one LED and one sensor. therefore, i need 5000 LED & 5000 sensors.

all sensors and LED will be connected to a system. When i need to place the box in the pigeon hole, i'll scan the barcode of the box and register it in the system. The system will then look for empty slot in any racks and light up the LED. I'll placed the box in the pigeon hole and the LED turn off.

If i need to retrieve any box, i would then enter the box number and the LED of the exact location would light up.

Not really sure how to start. Would like to know what kind of hardware that have such quantity of I/O ports.

• How about using a laser pointer intstead, scanning the wall with the pigeon holes, remotely reading the barcode on the front of the boxes, and illuminating the required area, maybe even with some cool patterns? – posipiet May 19 '11 at 5:17
• How big do you plan to make each box? And, what for? – posipiet May 19 '11 at 5:35
• possible duplicate of Controlling 500 LEDs with PWM – Brian Carlton Aug 15 '12 at 20:20

The best approach is to place your LEDs in a 64x80 matrix. Since only 1 LED needs to be lit at any time you can use demultiplexers for both rows and columns. For the rows you want 1 line low, for the columns 1 line high.
One solution is to use ten 74HC138s for the rows, controlled by 7 address lines (2$^6$ < 80 < 2$^7$). You'll need some additional logic to derive the control inputs for each 74HC138 from this address. For the columns you'll need eight 74HC238s, which is similar to the 74HC138, but with its output active high. Here you need only 6 address lines (64 = 2$^6$). So you'll have a total of 13 address lines.

Another approach is to use a CPLD. 13 address lines in, 64 columns + 80 rows out. That's 157 I/Os. Altera has a few MAX3000 devices that fit the bill.

If you don't have a compact presentation for the LEDs like a synoptical panel, you may want to drive them with a higher current for better visibility. In that case you'll need extra transistors on the outputs.

• or a lot of 555 timers pulsing to get better light out of a cheaper LED. – Kortuk May 18 '11 at 9:42
• I'd use 72x70 for easier arithmetic. Or even 64x80, it uses the same number of 8 output ICs. – starblue May 18 '11 at 13:02
• @starblue - you're right, 64x80 makes more sense. Edited my answer. – stevenvh Jul 19 '11 at 9:34

Whooo, boy... This will not be a cheap project!

I agree with Ranieri on the general concept of breaking the project down into repeated "tiles".

Given that you have 20 racks of 10 columns x 25 rows; I suspect what you'll want is a master controller for each rack (which would also deal with power distribution) paired with a "shelf unit" for each row, responsible for driving LED's for the 10 columns and to sense the box. The master controller could also drive a master light at the top of the rack, so that the destination rack could easily be spotted.

Considering the distances involved, I don't think you should use USB as your interconnect to the racks -- USB doesn't like to drive long distances. Instead, an isolated interface like Ethernet, or opto-isolated ala MIDI is probably the better bet. Interfacing within the rack, however, could be done with pretty much any approach.

• Thanks toybuilder, I realised it is not cheap. Could you guys tell me the recommended hardware for this set-up. I need to estimate the cost involve. – Steven May 18 '11 at 9:33
• Probably less than 20 EUR per box. Certainly more than 1 EUR per box. Development might be around one engineer-month, putting it at about 10k plus hardware. If I had to place a bet, I would go for 25k - 50k Euros for the prototype. – posipiet May 19 '11 at 21:18

XMOS devices are often used to control very large arrays of LEDs. The LEDs are grouped into "tiles", with each tile controlled by an XMOS chip and suitable shift registers. The XMOS devices can be connected to each other via high-speed XLinks or Ethernet, and can communicate with a host system via Ethernet or USB. XMOS devices can implement high-speed USB and Ethernet in software, just requiring suitable PHY chips.

The 5,000 inputs can be interfaced in a similar fashion.

It's really hard to come up with clear recommendations without a more precise idea of what the entire system is supposed to be doing, or how the leds and sensors should be arranged, but I'll give it a try.

You are not going to find a single component with 10000 digital IO ports, and even if you did the driver/buffering/biasing circuitry for the leds and sensors would take up a huge amount of real estate on the board. Your best bet is to divide and conquer -- create a number of "tiles" that handle a specific subtask and connect them together.

For example, if the leds and the sensors need to be co-located, each tile could have say 100 leds and 100 sensors, (de)-multiplexers and a simple microcontroller. Then you'd assemble 50 of these tiles, bringing the total up to 5000 leds and 5000 sensors. Then you connect each of these tiles to a "mother board" that can address the individual boards, talk to the microprocessor on them and write/read the leds and the sensor values.

One of the main design decisions will be the "power" of the mother system, as well as the interconnection circuit. For example, if you are willing to control the thing from a laptop (or similar), you could use USB as interconnection. You can then run a software USB stack such as VUSB on the tiles to keep the cost down. Other options could be CAN, I2C and even Ethernet. Again, the specifics of your system dictate what to use.

For specific uses there are significant shortcuts available. For example, if the leds are used as a display, you can probably drive them from a single microcontroller using a matrix set-up and a simple frame-buffer.

• Thanks guys, I have edited my post with details on my project. – Steven May 18 '11 at 8:05

There are alternatives

• you can make separate modules for each rack, and interconnect them via LAN. Each module will control 250 LEDs.

and / or

• you can control LEDsin a 3D matrix. Since each LED has only 2 terminals, you can add a third one by using a transistor. The led will light up only if the the collector, emitter and the base are correctly powered. The 3D matrix requires only 52 I/Os (17 * 17 * 18) for controlling 5000 LEDs, instead of 142 (71 * 71).

In the meanwhile I think you can play with the Rainbowduino and the 8*8 RGB LED Matrix which controls 192 LEDs (3 * 8 * 8).

Since you need to transfer the barcode to the central computing station, you have to set up a bus. Depending on how big your boxes are, distance plays a role in selection of the bus.

Analog cabling with LED multiplexing is no good idea on large area setups where the LEDs are not near each other (cabling effort, differing cabling resistance etc).

Let's suppose you want to keep it cheap. Maybe try I2C, and make it hierarchical. There would be router nodes that talk to the master computer, and route messages to and from the leaf nodes, of which there would be one per box.

A leaf node can read the barcode, light a led, and perform various other features if needed, reading or sending messages to its router node.

This setup is probably in the same financial league as a central cabling for 5k LEDs, 5k Sensors, even if modularized. The cheapest AVR ATtiny4 with 4 GPIOs costs 0.6 EUR in numbers.