100 LEDs

96 LEDs < 100 LEDs = 10*10 LEDs. Thus you can drive this directly without a multiplexer. The only requirement is that you do not exceed the current limit of 40 mA per IO pin. Thus either drive the LEDs with at most 4mA (actually 40mA with a 10% schedule) or use suitable drivers.

yeha like udo said you can probably do this via an LED matrix idea (though going 10x10 is probably a bit annoying also wouldnt you need more then an uno to do 10x10, well maybe if you use analogs as digital pins. yeah dont do that))
One thing you could do to easy it up, make the matrix of 96 pins with 3 shift regs, so 16 x 8 will drive up to 128 LEDs, then it would be easy enough to make each pair of control lines from one register correspond to the top, left, bottom or right side of the picture frame. Or you could bruteforce it and do 12 shift registers, in 4 banks of 3, each bank again corresponding to a side of the frame (would be easiest to code for a newbie, but I'm finding that LED arrays can be interesting, so should probably give that a try)

I'll draw out a diagram, later when i get my camera, of the 3 ways I'd set it up using shift regs, hopefully they might be a bit of help.

in response to funky though... are multiplexers liek that really a newbies thing to play with. First he'll need the breakout board for that most likely, which is almost $5 each. That or learn to surface solder which isn't really a rookie level thing to do (I sure as hell cant do it nicely yet). then on top of that, in array form he'd need 2 of them (16x16 array), or if he were driving the leds directly off the multiplexers hed need 6 to control the actual outputs (each one requiring 4 pins to run), and then hed need another 2 to control the 6 multiplexers because theres not enough arduino pins. Then the code makes my head hurt to think about. Basic shift register and a regular array are probably the guys best bet in this particular case.

You guys are going overboard. Can do this with NO shift registers, and just one ULN2803.
Uno has 20 IO.
Use 12 to Drive rows of 8 anodes.
Use 8 to drive columns of cathodes, buffered by the ULN2803.
Arduino drives anode(s) high, ULN2803 sinks current from the cathodes.
If Truly just turning on 1 LED only, can skip the ULN2803 even as only 20mA will need to be sunk at a time.

You guys are going overboard. Can do this with NO shift registers, and just one ULN2803.

Absolutely right. Only one led at a time, no brightness control. I've been busy with shift registers lately, they just stick to my mind :smiley:

CrossRoads:
You guys are going overboard. Can do this with NO shift registers, and just one ULN2803.
Uno has 20 IO.
Use 12 to Drive rows of 8 anodes.
Use 8 to drive columns of cathodes, buffered by the ULN2803.

that may be but. meh actually, don't have any of those yet, thats probably the best idea, though it will use up all of his pins, so he better not be planning on doing anything else in that setup.
btw heres the link for the ULN2803

True, you could use the digital pins 0 - 14 and the analog pins A0-A5, totaling 20 pins and could use some circuit work instead. I was merely stating my response since the OP is new to this and I figured 0's and 1's would be better instead of possibly getting confused with the HIGH's and LOW's for sink or source...although i guess that would be easier, haha.

If you're only turning on one LED at a time, this sounds like an excellent application for Charlieplexing. Requires no additional hardware (beyond current-limiting resistors) and 11 output pins.

"this sounds like an excellent application for Charlieplexing."

And that'd be oh so much easier to code too :wink:

I think it would indeed be easy to code. I believe that this will sequentially light 96 LEDs, using Arduino pins 2 through 12:

void setup() {
  for (uint8_t i=2;i<=12;i++) {
    pinMode(i,INPUT);
    digitalWrite(i,LOW);
  }
}

void loop() {
  uint8_t n = 0;
  for (uint8_t i=2;i<=12;i++) {
    pinMode(i,OUTPUT);
    for (uint8_t j=i+1;j<=12;j++) {
      pinMode(j,OUTPUT);
      digitalWrite(i,HIGH);
      delay(5000);
      n++;
      digitalWrite(i,LOW);
      digitalWrite(j,HIGH);
      delay(5000);
      digitalWrite(j,LOW);
      n++;
      pinMode(j,INPUT);
      if (n == 96) {
        break;
      }
    }
    pinMode(i,INPUT);
    if (n == 96) {
      break;
    }
  }
}

I've run this code on my Uno, and tested its operation by examining the data and direction registers for ports B and D for each virtual LED, in place of the delay function shown in this code. It looks like there's always only one LED on, and it's the one that I expect. So, I'd say that for this code, my confidence is high.

Getting the code this simple requires the LEDs to be wired in a conceptually natural way. Wiring it, though, would be a beast of a job.

I've fiddled with finding an LED arrangement that simplifies the wiring at the expense of code complexity. After all, at the worst I'd have to create an array of output patterns, and index it sequentially. But I haven't found any method that's particularly satisfying. I'd very much like to see others' experience and thoughts on wiring arrangements for charlieplexed LEDs.

this may help you... I was also working on a non-cube/non-matrix configuration too, and couldn't find anything that was linear...

So I made one.

Since I made this drawing, and then built the hardware/software to match, I have learned that the order is a bit messed up - I should have done (pins) a-b,a-c,a-d,a-f,a-g... b-c,b-d,b-e and so on...

here's some code:

// DEFINE THE PINS USED BY CHARLIEPLEX

#define A 4
#define B 5
#define C 6
#define D 7
#define E 8
#define J 9
#define G 10
#define H 11
#define I 12



// DEFINE ARRAY THAT CONTAINS CONNECTIONS

int c[72][2] = 
{
    {A, B}, {B, A}, {B, C}, {C, B}, {C, D}, {D, C}, {D, E}, {E, D}, 
    {E, J}, {J, E}, {J, G}, {G, J}, {G, H}, {H, G}, {H, I}, {I, H},
    {A, C}, {C, A}, {B, D}, {D, B}, {C, E}, {E, C}, {D, J}, {J, D},
    {E, G}, {G, E}, {J, H}, {H, J}, {G, I}, {I, G}, {A, D}, {D, A},
    {B, E}, {E, B}, {C, J}, {J, C}, {D, G}, {G, D}, {E, H}, {H, E},
    {J, I}, {I, J}, {A, E}, {E, A}, {B, J}, {J, B}, {C, G}, {G, C},
    {D, H}, {H, D}, {E, I}, {I, E}, {A, J}, {J, A}, {B, G}, {G, B},
    {C, H}, {H, C}, {D, I}, {I, D}, {A, G}, {G, A}, {B, H}, {H, B},
    {C, I}, {I, C}, {A, G}, {G, A}, {B, H}, {H, B}, {A, I}, {I, A}
};


void setup()
{
//clear all Charlipins

  pinMode( A, INPUT );
  pinMode( B, INPUT );
  pinMode( C, INPUT );
  pinMode( D, INPUT );
  pinMode( E, INPUT );
  pinMode( J, INPUT );
  pinMode( G, INPUT );
  pinMode( H, INPUT );
  pinMode( I, INPUT );
}


void loop()
{

//  do the math for timing and such.

lightLed(c[X]);   // X is the LED to be lit...

// blah blah 

}




void lightLed( int pins[2] )
{
	setup();
	
    pinMode( pins[0], OUTPUT );
    digitalWrite( pins[0], HIGH );
    pinMode( pins[1], OUTPUT );
    digitalWrite( pins[1], LOW );
    
   delay(1); 

}

now this only goes to 72 LEDs. you'd have to add another row (or 2?) to the drawing for 96 leds.

Charliplexing does make the wiring/soldering a bit of a pain in the butt, but costs are reduced and the programming is pretty simple too, once you have the array setup.

Also, I'm a bit of a noob myself, an there is probably a better way to do what I am doing, so maybe someone will chime in and set both of us straight...

Wouldn't it be far easier and cheaper to use a few decade counters and a timer? You wouldn't need any code that way!

Edit: you could even use just one decade counter if you have (# of LEDs / 10) lit LEDs, and the lit ones could even be non-sequential. This is pretty common in LED chasers, and there is a lot of info about them floating around.

using addressable LED strips might be a simple solution as well:

one problem so many solutions :slight_smile:

edit: or if your more adventurous http://www.alibaba.com/product-gs/563354372/2012_5050_SMD_Programmable_LED_Strip.html?s=p

Ok, dig this, by why do they go out of order on my breadboard? I wired just 20leds to 5pins. It blinks: 1 2 9 10 15 16 19 20 3 4 11 12 17 18 5 6 13 14 7 8

And how do I address them individually??

tmd3:
I think it would indeed be easy to code. I believe that this will sequentially light 96 LEDs, using Arduino pins 2 through 12:

void setup() {

for (uint8_t i=2;i<=12;i++) {
    pinMode(i,INPUT);
    digitalWrite(i,LOW);
  }
}

void loop() {
  uint8_t n = 0;
  for (uint8_t i=2;i<=12;i++) {
    pinMode(i,OUTPUT);
    for (uint8_t j=i+1;j<=12;j++) {
      pinMode(j,OUTPUT);
      digitalWrite(i,HIGH);
      delay(5000);
      n++;
      digitalWrite(i,LOW);
      digitalWrite(j,HIGH);
      delay(5000);
      digitalWrite(j,LOW);
      n++;
      pinMode(j,INPUT);
      if (n == 96) {
        break;
      }
    }
    pinMode(i,INPUT);
    if (n == 96) {
      break;
    }
  }
}




I've run this code on my Uno, and tested its operation by examining the data and direction registers for ports B and D for each virtual LED, in place of the delay function shown in this code. It looks like there's always only one LED on, and it's the one that I expect. So, I'd say that for this code, my confidence is high.

Getting the code this simple requires the LEDs to be wired in a conceptually natural way. Wiring it, though, would be a beast of a job.

I've fiddled with finding an LED arrangement that simplifies the wiring at the expense of code complexity. After all, at the worst I'd have to create an array of output patterns, and index it sequentially. But I haven't found any method that's particularly satisfying. I'd very much like to see others' experience and thoughts on wiring arrangements for charlieplexed LEDs.

I used:

void setup() {
for (uint8_t i=2;i<=6;i++) {
pinMode(i,INPUT);
digitalWrite(i,LOW);
}
}

void loop() {
uint8_t n = 0;
for (uint8_t i=2;i<=6;i++) {
pinMode(i,OUTPUT);
for (uint8_t j=i+1;j<=6;j++) {
pinMode(j,OUTPUT);
digitalWrite(i,HIGH);
delay(500);
n++;
digitalWrite(i,LOW);
digitalWrite(j,HIGH);
delay(500);
digitalWrite(j,LOW);
n++;
pinMode(j,INPUT);
if (n == 20) {
break;
}
}
pinMode(i,INPUT);
if (n == 20) {
break;
}
}
}

You have them wired like this:

  ---2---    ---3---    ---4---    ---5---    ---2---    ---3---    ---4---    ---2---    ---3---    ---2---   PIN#
  --   /\    --   /\    --   /\    --   /\    --   /\    --   /\    --   /\    --   /\    --   /\    --   /\
   1    2     3    4     5    6     7    8     9   10    11   12    13   14    15   16    17   18    19   20   LED#
  \/   --    \/   --    \/   --    \/   --    \/   --    \/   --    \/   --    \/   --    \/   --    \/   --
  ---3---    ---4---    ---5---    ---6---    ---4---    ---5---    ---6---    ---5---    ---6---    ---6---   PIN#

That looks a lot like the schamtic previously posted in this thread. And, that's a handy way of making a schematic, but it's certainly not the only way to wire the LEDs. When you charlieplex, you have to match your code to your wiring.

Here's the arrangement that I had in mind:

  ---2---    ---2---    ---2---    ---2---    ---3---    ---3---    ---3---    ---4---    ---4---    ---5---   PIN#
  --   /\    --   /\    --   /\    --   /\    --   /\    --   /\    --   /\    --   /\    --   /\    --   /\
   1    2     3    4     5    6     7    8     9   10    11   12    13   14    15   16    17   18    19   20   LED#
  \/   --    \/   --    \/   --    \/   --    \/   --    \/   --    \/   --    \/   --    \/   --    \/   --
  ---3---    ---4---    ---5---    ---6---    ---4---    ---5---    ---6---    ---5---    ---6---    ---6---   PIN#

Notice that it looks a lot like the code: the upper pins are the slowly-varying index, and the lower pins are the rapidly-varying index.

There's a straightforward solution that doesn't involve rewiring. Define an array, NLEDS x 2, that holds the LOW pin and the HIGH pin for each pair of LEDs. To light one, get its pins, and manipulate the outputs to light it up. A code snippet might be:

  for (uint8_t i=2;i<=NLEDS;i++) {
    pinMode(LEDArray[i][0],OUTPUT);
    pinMode(LEDArray[i][1],OUTPUT);
    digitalWrite(LEDArray[i][0],HIGH);
    delay(<something>);
    digitalWrite(LEDArray[i][0],LOW);
    digitalWrite(LEDArray[i][1],HIGH);
    delay(<something>);
    pinMode(LEDArray[i][0],INPUT);
    pinMode(LEDArray[i][1],INPUT);
  ...

If you don't get the array right the first time, trial and error will get the answer. For your wiring, this might be the array:
{2,3},{3,4},{4,5},{5,6},{2,4},{3,5},{4,6},{2,5},{3,6},{2,6}

Attached is an example of using a decade counter/divider chip for the basic principle. All you need is to scale it up for your number of LEDs and create a timer circuit for your desired timing. In this example, each LED is lit sequentially and the next one lights when the switch cycles (off-on-off). All of the components necessary for this method can be found for ~$6 on ebay, no controller necessary.

You sure about that part?

According to the datasheet, it's only good for a couple of mA output current, could struggle turning on an LED.

Hmm, I missed that. It looks like it was meant to be driven by 10-15 volts, so that would make sense. You could always tie the signal into an NPN transistor to source power (similar to a Darlington Pair), but you'd need one for each LED. I only paid $2 for a pack of 100 BC546's, which can give 100mA, but that does increase the total cost and complexity by a fair amount. I guess the CD4017BE may not be the best IC for this, but I still think that a microprocessor would be overkill and too costly for this.
Edit: updated schematic

"a microprocessor would be overkill and too costly for this."
Well, a '328P is just $2.50

If the internal oscillator is used, then only a 10K pullup and the current limit resistors are needed.