Thursday, June 10, 2010

Can we control more than 7,600 LEDs with just two pins?

In the last two posts (here and here), we saw how to drive 64 LEDs (in the form of a 4 digits 7-segments display) with two Arduino wires controlling an I2C bus.
But how many LEDs can we control with this architecture? Let's find out.
First what we learned. We made groups of 64 LEDs controlled each by an ICM7218a. Then, we used a PCF8574 bus expander to drive the ICM with only two pins. As we saw, we can plug 8 PCF8574 chips in the same bus and 8 additional PCF8574a. So we can have (8 + 8) * 8 = 128 outputs controlled with Arduino's analog 4 and 5.
Now, let's see how can we use all this to drive as many LED's as we can.
The ICM only checks its inputs when the WRITE pin goes from high to low. So, we can connect the 8 outputs from a PCF to the input pins of the ICM ID0 to ID7. I mean, I can take the outputs of 1 PCF and connect them to the inputs of as many ICM's as I need. With the MODE line, I do the same.
As the ICM's only take in account their inputs when WRITE goes low, the only thing we have to do is to connect a different output to each of the ICMs WRITE.
To control an ICM I use the common data and MODE lines and it's WRITE pin.
If you're lost with the explanation here is a schema of the wiring (for only 3 ICMs).



Conclusion: I only need 1 additional pin to control a single ICM. How many pins do I have left after the use of data and MODE lines? 16 * 8 - 9 = 119 pins. That is, I can control 119 ICMs. As I control 64 LEDs with each ICM, I can drive 119 * 8 = 7,616 independent LED's with two pins!
I haven't tested this "invention", but it looks feasible. Doesn't it?
And what can we do with the rest of the analog and digital pins?... Maybe we could control some leds!! ;)

No comments:

Post a Comment