3x5 led matrix

PaulRB:
Its a myth that you are limited to one led (at any instant in time) with charlieplexing. You can light whole rows or columns at the same instant. Of course you then have the max current per pin issue just like you do with vanilla multiplexing, but you overcome that in similar way(s).

Tom's Projects: Musings on Charlieplexing

Excellent!

Perhaps I had better be careful of the combination of spending the afternoon lawn mowing, anticipating spending the next day (Saturday - ugh!) attending an all-day seminar on Pain Management as a CPD requirement, and preparing to drive 450-odd km on Sunday to be hospitalised the following Monday. :~

The use of emitter followers could be slightly troublesome driving white LEDs at 5V (clearly not practical at 3.3V) but they certainly should not require base resistors and have another substantial advantage - the collectors can be powered by a higher, unregulated supply voltage and their gain so considerably reduces the drive-high current (and consequently, the supply current requirement of the MCU in general) that the Voh loss becomes quite negligible, partially compensating for the Vbe of the transistor.

Paul__B:
The use of emitter followers could be slightly troublesome driving white LEDs at 5V (clearly not practical at 3.3V) but they certainly should not require base resistors and have another substantial advantage - the collectors can be powered by a higher, unregulated supply voltage and their gain so considerably reduces the drive-high current (and consequently, the supply current requirement of the MCU in general) that the Voh loss becomes quite negligible, partially compensating for the Vbe of the transistor.

Woah! Think I followed most of that... but the MCU still has to sink all the current, albeit spread over multiple pins, so max of ~200mA for atmega328 for example. Why would no base resistors be needed for the NPNs? What would limit the current? Excuse my ingorance, some aspects of transistors still befuddle me.

Would P(?)-channel mosfets be a suitable alternative for the NPNs for driving white leds at 5V? Obviously they would need pull-up(err, down?) resistors to stop them conducting when the MCU output pin connected to the gate goes high-Z.

Wow u guys are confusing me......crossroads guy said my diagram wil work as long as i light up one led at a time (multiplexing) which i know how to do.....i dnt think ill need a reaistor on negative sides of led to whoever said that because i have resistors on positive side that i have tried with 5v(not arduino) and it
worked fine ,but i culd be wrong ......so yea plus all i wanted was an example of code .....i am going to try something easier first but i just wanted to make i program before i got the arduino that way it wont take me forever to make it.

Well, if you haven't even got a board yet, I suggest you download and try VBB (Virtual Bread Board)

It has an Arduino (board) available to use as a component and it seems you can practise with that without either (a) waiting or (b) running the risk of producing the magic blue smoke.

www.virtualbreadboard.com

Thanks! That helps alot.

You're welcome. :slight_smile: Happy Arduino-ing!

dbutler0526:
Wow u guys are confusing me

Sorry! I hijacked your thread there...asking questions that are a little too advanced for you yet, but one day soon you will be where I am now, I'm sure.

PaulRB:

Paul__B:
The use of emitter followers could be slightly troublesome driving white LEDs at 5V (clearly not practical at 3.3V) but they certainly should not require base resistors and have another substantial advantage - the collectors can be powered by a higher, unregulated supply voltage and their gain so considerably reduces the drive-high current (and consequently, the supply current requirement of the MCU in general) that the Voh loss becomes quite negligible, partially compensating for the Vbe of the transistor.

Woah! Think I followed most of that... but the MCU still has to sink all the current, albeit spread over multiple pins, so max of ~200mA for atmega328 for example.

Indeed, but it is spread over multiple pins and the supply (Vcc) to the chip is not required to provide such current, which greatly minimises the load on the regulator.

PaulRB:
Why would no base resistors be needed for the NPNs? What would limit the current? Excuse my ingorance, some aspects of transistors still befuddle me.

It is the nature of an emitter follower. The base current is drawn only sufficient to cause the emitter to be pulled up to the Vbe drop. Not only do you not need a base resistor, but putting one in defeats the "following" action, introducing unwanted voltage drops.

PaulRB:
Would P(?)-channel mosfets be a suitable alternative for the NPNs for driving white leds at 5V? Obviously they would need pull-up(err, down?) resistors to stop them conducting when the MCU output pin connected to the gate goes high-Z.

No, P-FETs would be the same as PNP transistors, not usable for the reason that article pointed out. N-fets substituted for the bipolar transistors would have too high a turn-on (equivalent to Vbe) voltage to be useful.

Horses for courses.

This question is going back to begining of thread, but will it work? Its got 68 ohm resistors connected to possitive legs of leds......they are white leds.......20 mAh 3.3 forward V. ?.........negatives are in colums positives in rows .......setup for multiplexing,? Sorry i know im repeating myself but im giving u more info this time. Also now with the new info can u give me a simple descriptive code. Sorry and thx.

Are 6, 7, 8 connected to anodes or cathodes?

Negatives......also do imhav to light up 1 led at a time with this setup or what else could i do? Hint i dont know which one cathose and which one anodes are.

Thx lol thats cool how u did that but whats ur answer to the question?

This is what the matrix looks like....black wires are positive .....gray are negative.....pic is attatched

:grin: Yeah, most people get a kick out of that when they see it for the first time. You simply visit lmgtfy.com and enter your search term. It will then give you a url suitable for pasting - either as-is or as an obfuscated url.

As for the question, do you have to only turn on 1 led at a time? No, but it's considerably simpler (read easier and cheaper) for quick test-projects like this one. The human vision system cant see very many distinct frames per second (lookup Persistence of Vision) IIRC it's somewhere around 40 or so. Multiplexing works just fine - just slightly reduced brightness.

Here's a pretty neat project that uses multiplexing of rgb leds. Rgb heli blades - RC Groups
Note that the whole image is visible at once.

I'll re-work the answer I gave in post #2, such that only 1 led is on at a time. You'll notice the ommission of any delay statements -
as it stands, all 15 leds should appear to be on simultaneously, albeit with reduced brightness, as compared to a single led connected
to a dc power source. Just insert delay statements where (if) appropriate.

void setup()
{
 // turn off each of the columns
 digitalWrite(6, HIGH);
 digitalWrite(7, HIGH);
 digitalWrite(8, HIGH);
}


void loop()
{
//1. Lets do the 1st row, from left to right
//---------
digitalWrite(5, HIGH);   // enable row 1
digitalWrite(8, LOW);   // allow current to flow from pin 5 to pin8, through the LED (conventional current [+ --> -], not electron flow [- --> +])
digitalWrite(8, HIGH);

digitalWrite(7, LOW);  // allow current to flow from pin 5 to pin7
digitalWrite(7, HIGH);

digitalWrite(6, LOW);  // allow current to flow from pin 5 to pin6
digitalWrite(6, HIGH);
digitalWrite(5, LOW);  // disable row 1


//2. Lets do the top row, from left to right
//---------
digitalWrite(4, HIGH);  // enable row 2
digitalWrite(8, LOW);
digitalWrite(8, HIGH);

digitalWrite(7, LOW);
digitalWrite(7, HIGH);

digitalWrite(6, LOW);
digitalWrite(6, HIGH);
digitalWrite(4, LOW);  // disable row 2

// etc, etc
}

Untested:

byte R1 = 6;
byte R2 = 7;
byte R3 = 8;
byte C1 = 1;
byte C2 = 2;
byte C3 = 3;
byte C4 = 4;
byte C5 = 5;

int rowstrobe;
int colstrobe;
int pixhold;      //  brightness
int repetitions; 
int scanspeed;

void setup ()
{
  pinMode(R1, OUTPUT);
  pinMode(R2, OUTPUT);
  pinMode(R3, OUTPUT);
  pinMode(C1, OUTPUT);
  digitalWrite(C1,LOW);
  pinMode(C2, OUTPUT);
  digitalWrite(C2,LOW);
  pinMode(C3, OUTPUT);
  digitalWrite(C3,LOW);
  pinMode(C4, OUTPUT);
  digitalWrite(C4,LOW);
  pinMode(C5, OUTPUT);
  digitalWrite(C5,LOW);
  
  pixhold = 1;           // brightness
  scanspeed = 200; // travel
}

void loop ()
{

  for (repetitions=0; repetitions < scanspeed; repetitions++)
  {
    digitalWrite(C1,HIGH);
    workrows();
    digitalWrite(C1,LOW);
  }
  for (repetitions=0; repetitions < scanspeed; repetitions++)
  {
    digitalWrite(C2,HIGH);
    workrows();
    digitalWrite(C2,LOW);
  }
  for (repetitions=0; repetitions < scanspeed; repetitions++)
  {
    digitalWrite(C3,HIGH);
    workrows();
    digitalWrite(C3,LOW);
  }
  for (repetitions=0; repetitions < scanspeed; repetitions++)
  {
    digitalWrite(C4,HIGH);
    workrows();
    digitalWrite(C4,LOW);
  }
  for (repetitions=0; repetitions < scanspeed; repetitions++)
  {
    digitalWrite(C5,HIGH);
    workrows();
    digitalWrite(C5,LOW);
  }
}


void workrows ()
{
  for (rowstrobe=0; rowstrobe<3; rowstrobe++)
  {
    digitalWrite(R1,LOW);
    delay(pixhold);
    digitalWrite(R1,HIGH);
    digitalWrite(R2,LOW);
    delay(pixhold);
    digitalWrite(R2,HIGH);
    digitalWrite(R3,LOW);
    delay(pixhold);
    digitalWrite(R3,HIGH);    
  }
}

To enhzflep the code, y dont u put a delay inbetween would it affect it in some way? And i like the helicopter rgb that was awesome.

Yeah, wasn't the helicopter video just something else? :grin:

As I think I mentioned in my answer, I didn't use a delay so that all of the lights would appear to be lit simultaneously, due to POV - hence the link to the helicopter blades.

The only effect a delay would have is to allow a visible pause between lighting each led. If you'd like each led to remain illuminated until the next one is lit, insert delay statements like this:

digitalWrite(7, LOW);  // allow current to flow from pin 5 to pin7
delay(250);  // light led for 0.25s
digitalWrite(7, HIGH);

If, on the other hand you'd like the display to remain off, with each led being lit(flashed) for a micro-second or so, do this:

digitalWrite(7, LOW);  // allow current to flow from pin 5 to pin7
digitalWrite(7, HIGH);
delay(250);
digitalWrite(6, LOW);  // allow current to flow from pin 5 to pin7
digitalWrite(6, HIGH);

Naturally, you may wish to turn on for 0.25s, turn off for 0.25s then turn on the next led for 0.25s, the following would be more appropriate:

digitalWrite(7, LOW);  // allow current to flow from pin 5 to pin7
delay(250);  // keep illuminated for 0.25s
digitalWrite(7, HIGH);

delay(250);  // 0.25s with no leds lit

digitalWrite(6, LOW);  // allow current to flow from pin 5 to pin7
delay(250);  // keep illuminated for 0.25s
digitalWrite(6, HIGH);

@Runaway Pancake: Nice example! +1 :thumbsup:

Can some one give me a code for my matrix (pic displayed at pegining of thread) of how to like countdown i got it to light up and jchase leds and light up 1 letter or one number but when i try to do 2 numbers like 1 and tthen a second later 2 it conjoins the numbers and lights almost all the lights up.

You will need to be more deliberate and specific with your use of language.

"how to like countdown" is a statement that will meaningless to many, other than yourself. If you can describe accurately what you wish to achieve, you will be putting readers of the forum in a position where they are able to help you. Indicating what steps you have taken towards your goal will often inspire people to want to help you.

But in either case, until what you want to achieve is clear you will receive little if any assistance.

Perhaps you wish to light the leds in a pattern that resemble the images of numbers?
I.e


--x--
-xx--
--x--
--x--
-xxx-

Perhaps you wish to light the rows one after another?







xxxxx






I don't know!! I cant read your mind, see your screen or hard-drive. You should assume that we know nothing of your project or intentions other than those details you decide to share with us.