Help with brightness levels on 5x7 matrix

Hi... I am testing out a 5x7 LED matrix, being driven by an MCP23018 I/O extender. Everything is working great, scrolling text and all.

The problem is... The LED's are much brighter when only one light is on in a column, and much dimmer when all seven are on.

I'm probably missing some basic electronics thing, I suppose. Any ideas?

Schematic is here, or click through for bigger:

BOM...

  • 1 604-TA12-11YWA Kingbright YELLOW DIFFUSED 5X7 DOT MATRIX LED Display $2.22 Datasheet
  • 1 579-MCP23018-E/SP I/O Expanders, Repeaters & Hubs 16B I/O Expander I2C interface $1.58 Datasheet
  • 1 652-4116R-1LF-100 Resistor Networks & Arrays 16pin 100ohms Isolated Low Profile $0.60 Datasheet
  • 5 512-2N3904BU Bipolar Small Signal NPN Transistor General Purpose $0.10 Datasheet

The LED's are much brighter when only one light is on in a column, and much dimmer when all seven are on.

That is because you have wired it up wrong. Put those resistors the other side.

Also you need resistors in the base of the transistors. And those are the wrong sort of transistors, you can't use NPN as a top switch because you don't get the full voltage out of them. They need to be PNP and the other way round, that is emitter to +.

The circuit looks good - the dimming is either an insufficient power supply or you need to beef up those 2N3904's - the Vbe may be quite large when driving 7 LEDs as that's taking the transistor close to its max rated current... In general emitter-follower circuits like this tend to droop as the current increases, it might be the cause here. The situation will be being compounded by the fact you load the chip close to its maximum sink current of 25mA (its output will be significantly higher than 0V because of this).

Try checking the voltage on one of the columns as you change the number of LEDs lit. You might want to get a higher rated transistor (at least an amp Ic). Look at the specs for the ZTX851 for instance (5A continuous current, 20A peak, 0.05V Vsat at 1A..., gain 200 at 2A) I think that's about state of the art for a small bipolar transistor.

But do stick a multimeter on it to figure out what's actually happening.

Thanks, guys! I'll try these ideas out.

MarkT:
The situation will be being compounded by the fact you load the chip close to its maximum sink current of 25mA (its output will be significantly higher than 0V because of this).

Should I also be using transistors on the rows then, too, to fix this problem?

The circuit looks good

Well I would disagree with you, there are lots of things wrong with it.

In general emitter-follower circuits like this tend to droop as the current increases,

Simply not true, emitter followers don't droop.
It could be that the outputs of the arduino are drooping because there are no base resistors and the voltage at the emitter is never going to be greater than 0.7V lower than a logic high. That's why emitter followers are no good here.

But do stick a multimeter on it to figure out what's actually happening.

This circuit is multiplexing, you will get no sensible reading with a meter, you need a scope if you are going to see something happen.

The LED's are much brighter when only one light is on in a column, and much dimmer when all seven are on

How are you driving the multiplexer? You should be enabling a row and then setting the columns. If you are then it is the fact that you are using the wrong type of transistor circuit that is your problem.

So two conflicting pieces of advice, you choose.

I'm very interested in this. I have a handful of Column Anode 5x7 matrix displays to play with.

Thanks.

Grumpy_Mike:

The LED's are much brighter when only one light is on in a column, and much dimmer when all seven are on

How are you driving the multiplexer? You should be enabling a row and then setting the columns. If you are then it is the fact that you are using the wrong type of transistor circuit that is your problem.

Ah.. Oh really? Well, the way I am driving it right now is akin to the following. It's actually in interrupts, but let me pull it out here just for simplification

uint8_t row_bits = { 0x7f,0x41,0x41,0x41,0x7f }; // Perfect square
int col = 5;
while(col--)
{
  port_extender.SetPorts(0x80>>col,row_bits[col];
  delay(3);
}

My 'SetPorts' method sends the first out to the 'A' port, where the columns are connected (with pullup resistor enabled), and sends the second out to the 'B' port where the rows are connected.

Would you mind explaining why it should be driving one row at a time? This would help my understanding.

I'll try driving it by rows first, because that's the easiest thing to change... It's only software :slight_smile:

Grumpy_Mike:
So two conflicting pieces of advice, you choose.

That's ok! The more advice the better. I can try both.

I'm very interested in this. I have a handful of Column Anode 5x7 matrix displays to play with.

I shall post the entire thing on my blog when it's working. You can see the schematic and BOM I'm using above. If you want the code in the meantime, I'll post that too.

My next step is going to be to hook up 8 of these next to each other for a bigger display. 8 is the max port extenders I can have active on the I2C bus at once without driving the address pin with software.

Ok, I swapped the multiplexing to "by rows", and left the electronics alone, just to see what would happen. The problem is still there (as we can imagine), but the impact is lessened considerably. Probably because the instance of long swaths of horizontal lights is much less than the instance of long vertical swaths, especially with lowercase letters.

Next up, the joy of rebuilding the circuit.

Thanks Bug. I'm watching to see how this goes.

Thank you.

Ok,I now moved the resistors to the columns. That, along with multiplexing by rows, seems to have fully SOLVED the problem. Yay.

Here's the new circuit.


LED_Matrix_5x7_Test_V2.sch by maniacbug, on Flickr

Still, in the interest of learning what the heck I'm doing, I'm trying to understand transistor circuits, and trying to figure out how to get it actually 'right'. I tried simply putting in PNP resistors, flipping C/E, and flipping the 1/0 logic on my outputs to the base. Thought that would do it, but no. Darkness. Next up... Trying to understand all the Vbe Hfe gobbledygook.

Bug, thank you. I'm still new to the Arduino and this sort of stuff really helps keep my interest up.

I visited your blog and really liked what I saw. The first thing I noticed was the purple PCBs. I know where they come from! (Even before I found the link to Dorkbot in one of your posts!)

I'm looking forward to building one of these. I have a pile of like 8 or 9 column anode 5x7 displays I want to tinker with. thus far most of the similar posts use the (admittedly nice) MAX7219/22 which is Common Cathode.

Thank you.

MS,
You should get yourself a MAX6953, drives 4 common cathode displays.
You could wire up inverters basically to drive current out when the cathode control lines went low, and pull the cathodes low when the anode control lines went high.

I don't know about the OP, but, I have a handful of column anode 5x7 displays. I'd like to play with them. Also, the schematic and BOM provided by the OP is a pretty low cost deal. The IC used is $1.58 Q1 from Mouser. The MAX6953 is $13 in Q250 from Mouser.

Other than cost I suppose the point I am trying to make is while there may be 'easy' ways to implement a project, perhaps part of the fun is making what you have work? And learning something along the way too.

I'm very grateful that the OP has started this thread. Thank you Bug.

I see your point, I cannot locate them in qty 1 anyplace.
Got an e-mail from AVNET.com, claim to be local distributor for maxim. Browsed their website, NO STOCK of any of the 52 part numbers listed for display drivers.
So I guess 2 shift registers per part is the way to go.

If it was obtainable, it controls four 5x7 displays. vs (MPC21018 + 5 NPN transistors + 5 base resistors + 5 current limit resistors) x 4, plus larger board to put it all on, plus debug time for wiring errors, plus increased coding time, vs $13 and some I2C commands, possibly using a library.

I have 2 that I was able to obtain as samples from Maxim.

Here's what I would do: get a part like 74AC299 from Newark (I just bought 20 in DIPs for 56 cents each) to drive the anodes, and something with more current sink capability like a ULN2003 on arduino outputs to pull the cathodes low. Then put a bunch of them in parallel, make a 25x7 display.

I hope I did not come off as snarky....

If I were designing a commercial product and needed low part count, small board size etc, (ie minimizing costs) I'd be right there with you. (Or if I were going from idea to parts order.)

I cannot speak for the OP here, however speaking for -me- hacking this stuff is a source of enjoyment in my otherwise crud world. Assembly, debug and code writing are part of the learning process. I have a lot to learn!

For fun, I have sat down with Eagle and drew up a schematic and board layout using the above and an ATMEGA328 in an MLF32 package etc.

Sometimes the road to a destination is not the shortest/fastest route.

No, not snarky at all. I do the same. I even made up my own7-segment displays because I couldn't find the size I wanted :slight_smile:

Ok, that -is- cool. Kick ass even.

OP, sorry for the thread hijack!

:grin:

CrossRoads:
If it was obtainable, it controls four 5x7 displays. vs (MPC21018 + 5 NPN transistors + 5 base resistors + 5 current limit resistors) x 4, plus larger board to put it all on, plus debug time for wiring errors, plus increased coding time, vs $13 and some I2C commands, possibly using a library.

For me, the part count, wiring errors, and coding time are preferable. For one thing, the learning is kind of the point here, not the finished product. So the route that causes more learning is the better one.

Number 2, one of my guiding principles is BOM cost. My goal in Arduino is to understand the world of my EE colleagues (I am a software engineer). We make consumer electronics. These guys will sacrifice pretty much anything for pennies in BOM cost, particularly 'coding time' :slight_smile: So paying extra money to make things easy goes against that goal.

CrossRoads:
Here's what I would do: get a part like 74AC299 from Newark (I just bought 20 in DIPs for 56 cents each) to drive the anodes, and something with more current sink capability like a ULN2003 on arduino outputs to pull the cathodes low. Then put a bunch of them in parallel, make a 25x7 display.

Looking at the ULN2003 and trying to understand it, there are a few things I am wondering...

  • In my case, could I use it instead of the transistors to control the columns?
  • Does it work like a set of PNP transistors? Or NPN? Or totally unlike that?
  • Does it still need base resistors?

With the 25x7 setup you described, if you're controlling them through Arduino pins that tells me you don't have 5 of them. Do you connect ALL the rows together then? In that case, you do have to sink 500mA, right? Because each light is 20ma * 25.

And yeah the custom digits are awesome! Now I'm wondering if I should just do that :slight_smile:

Yes, use the ULN part to sink the current row by row. The 25 columns are setup with the 74AC299 shift registers,then a row pulled by an arduino pin buffer by the ULN2003.
So shift to 74AC299s, OE on to source 20mA out to the anodes, up to 500mA into the ULN2003, one row at a time so the 74AC299s are not overloaded.