8x9 Led Matrix display problems

hello,

I'm trying to make 8x9 led matrix display using:
columns~595ic (for printing) and rows~4017ic(for scanning).

The problem is that the leds are dim and simulator tells that the 4017ic will break cause "too big current flow" at certain pins.

Also the picture is printed sideways(so I'm using the 595 to scan and 4017 to print somehow?). and first row of leds are always turned on.

Link of Project in Tinkercad:

#define reset 13 //4017ic
#define shift 10 //595ic
#define store 11 //4017 and 595ic
#define reset 13 //4017ic
#define data 12 //595ic

int Rows=0; //4017 counter

int pic[]={0,16,48,80,16,16,124,0};
/* 000000000 = 0
 000010000 = 16
 000110000 = 48
 001010000 = 80
 000010000 = 16
 000010000 = 16
 001111100 = 124
 000000000 = 0 */

void setup(){
  pinMode(reset,OUTPUT);
  pinMode(shift,OUTPUT);
  pinMode(store,OUTPUT);
  
  digitalWrite(reset,HIGH); //makes sure the 4017 value is 0
  delay(10);
  digitalWrite(reset,LOW);
}

void Store(){
  
  if(Rows>=9){ //I already have 4017 10th pin 
    digitalWrite(reset,HIGH); //connected to reset, cause this 
    delayMicroseconds(10); //loop dosent seem to resest the ic. 
    digitalWrite(reset,LOW);} //also tried diode on 10th pin wich messes everything up 
    
  digitalWrite(store,HIGH);
  delayMicroseconds(10);
  digitalWrite(store,LOW);
  delayMicroseconds(10);
  Rows++;
}

void loop(){
  
  for(int i=0;i<9;i++){
  shiftOut(data,shift,LSBFIRST,~pic[i]);
  Store();
    
  }
  
}

Thanks for posting a proper clickable link. +1 Karma. For an extra karma point, please correct the way you posted your code. Read the forum guide in the sticky post to find out how.

Did you have a question?

My comment would be that the simulator is correct. Those chip's pins are not designed to power 8 or 9 LEDs at once. The cd4017's pins can only source or sink 10mA each for example. The 74hc595 pins can source or sink up to 35mA each, but there is a 70mA limit for the whole chip.

It would help if you could draw a proper schematic so we can see how everything is connected and what pins and component values are used.

Here is a good tip so you don't have to convert binary into decimal for your characters:

int pic[]={0,16,48,80,16,16,124,0};
/*   000000000 = 0
   000010000 = 16
   000110000 = 48
   001010000 = 80
   000010000 = 16
   000010000 = 16
   001111100 = 124
   000000000 = 0   */

becomes:

byte pic[]={
   0b000000000,
   0b000010000,
   0b000110000,
   0b001010000,
   0b000010000,
   0b000010000,
   0b001111100,
   0b000000000};

PaulRB:
Thanks for posting a proper clickable link. +1 Karma. For an extra karma point, please correct the way you posted your code. Read the forum guide in the sticky post to find out how.

Did you have a question?

My comment would be that the simulator is correct. Those chip's pins are not designed to power 8 or 9 LEDs at once.

What would be the ideal chip to use?

Since I need to power 9rows, i need yo use 2x595 witch will leave 6 pins on one ic unused.

If your matrix was 8x8 then I would recommend max7219. This chip drives both the rows and the columns, performs the multiplexing, does not need series resistors, gives a bright display which you can dim down under code control. Only 2 caps and a resistor and 3 Arduino pins needed.

8x9 makes things awkward, as most chips only have 8 or 16 inputs or outputs. CD4017 is an unusual (and an old) design, having 10.

Also, most chips have similar current limitations. 9 LEDs in a column could mean up to 180mA for that column, which is beyond the limits of many chips.

How many Arduino pins can you use in your project? You could use 9 Arduino pins to source current the rows and a tpic6b595 to sink current from the columns. This would require 12 Arduino pins in total.

PaulRB:
How many Arduino pins can you use in your project? You could use 9 Arduino pins to source current the rows and a tpic6b595 to sink current from the columns. This would require 12 Arduino pins in total.

I'm trying to use as few pins as possible, since i need about 7 buttons, 3 7segments and rf transmitter(1 pin)

I thought i could make buttons run off a 595 also, same with 7segment displays

Then use 2x max 7219. One to drive 8x8 matrix LEDs and the other to drive the 9th row of the matrix and the 7-seg displays. Only 3 pins needed for all your LEDs.

PS. Code is still posted incorrectly in your original post. Please fix that.

KaurGR:
What would be the ideal chip to use?

Since I need to power 9rows, i need yo use 2x595 witch will leave 6 pins on one ic unused.

Here's the point:

You have not explained why you want nine rows. That would always be the very first thing you need to explain.

The answer is that you forget about using ICs which were never intended to be used for the purpose.

You use ICs which were designed to be used for the purpose. That is the MAX7219. But if you really want 9 rows, you clearly need two of them - they are chained so use only three control pins for one, two, three and so on.

Just buy three of these kits:

Or these ones

which used to be more expensive but are now actually cheaper and more useful if you wish to stack matrix arrays.

The point is that you do not necessarily install the matrix arrays from the kits themselves - or their socket pins - but just solder to the positions on the PCB and you have a durable and reliable assembly to drive your own matrix arrays.

Why did I say three? Well, you can fully assemble the first one as the matrix with which it comes and practice programming it. Then the others for your current project and maybe buy a fourth or more anyway - for the next! :grinning:

Mind you, I suspect without knowing your secret application, that you would actually be just as well off to buy two of the second one I cite, mount them together with the matrices supplied and just use them as a 8 by 16 instead of an 8 by nine.

PaulRB:
Then use 2x max 7219. One to drive 8x8 matrix LEDs and the other to drive the 9th row of the matrix and the 7-seg displays. Only 3 pins needed for all your LEDs.

what if i use 2x 595 and for last led rgular arduino pin to light it up. so i can still have 8x9 led matrix? so it will be 4 pins in total to drive the leds

Paul__B:
Here's the point:

You have not explained why you want nine rows. That would always be the very first thing you need to explain.

I've always seen everyone making 8x8 displays, so it got me wondering if i can make something different.
And for practical uses i can display more on the "screen" + has centre point.

Paul__B:
The answer is that you forget about using ICs which were never intended to be used for the purpose.

You use ICs which were designed to be used for the purpose. That is the MAX7219. But if you really want 9 rows, you clearly need two of them - they are chained so use only three control pins for one, two, three and so on.

yes, just happened to have 100x 595. So i would try to make things work with what i have , rather than buying another chip from china and waiting for about a month to test it.

KaurGR:
what if i use 2x 595 and for last led rgular arduino pin to light it up. so i can still have 8x9 led matrix? so it will be 4 pins in total to drive the leds

Yes, that could work. But the display would still be dim, because of the low current limits of the 74hc595.

Or use 3x 74hc595 to light your 8x9 matrix and your 3x 7-seg displays. Same problem with dimness.

What other components do you have? Some npn transistors? A uln2803? What colour are the LEDs in the matrix and the 7-seg displays?

PaulRB:
What other components do you have? Some npn transistors? A uln2803? What colour are the LEDs in the matrix and the 7-seg displays?

I dont have uln2803 but some npn transistors.
leds and 7segments are both red.

Link:
https://www.ebay.com/itm/New-30-pcs-X-PN2222-PN2222A-NPN-40-Volts-600-Transistor/160695404364?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2057872.m2749.l2649

PN2222. Good, those can be useful. What about my other question?

KaurGR:
yes, just happened to have 100x 595. So i would try to make things work with what i have , rather than buying another chip from china and waiting for about a month to test it.

OK then, the answer is dead easy! :grinning:

Use up nine of your 74HC595s chained - control with three pins - and every output drives a LED with a 150 Ohm resistor. Use SIP resistor arrays.

Much brighter! :grinning:

9x 74hc595 would work. You can use another 3x '595 for your 7-seg displays. You will need almost 100 resistors.

If you keep the matrix idea, use 3x '595, 20 resistors and 8x pn2222. 2x '595 with 12 resistors would source current to the columns/anodes of the matrix and the 3x 7-seg (assuming they are common anode). 1x '595 drives the bases of 8x pn2222 with 8 current limiting resistors. The emitters of the pn2222 sink the current from the matrix rows/cathodes and the 7-seg cathodes.

Don't forget you need a 0.1uF decoupling cap for each '595, no matter how you use them.

PaulRB:
Don't forget you need a 0.1uF decoupling cap for each '595, no matter how you use them.

ineresting, I haven't seen anyone using decoupling caps before on 595, nether have I ever applied them.

Edit:
so it is neccesary to use it for consistant voltage? do I wire it between 595's Vcc and Arduino's 5v?
I need capacitor with 104 marking on it?
Since i have small bag full of different capacitors, then I would like to know how to read their values or atleast to know witch one to apply and if needed.

I will be following this schematic from now on with my aditional changes:

Decoupling caps prevent chips from causing fluctuations in the power lines that can have unexpected effects on the chip and other parts of a circuit. They should be connected to the VCC and GND of each chip, as close to the chip as possible. If you have not seen them on schematics then that could be because you have been looking at schematics drawn by newbies, or possibly they have been omitted from schematics for simplicity, but you are meant to assume they are there. For example in the schematic you linked to, the '595 chip is shown with no Vcc or GND pins. You know it has them in reality, and you know they must be connected, so they have been omitted for simplicity.

104 is the correct marking. It means 10 X 104 pF = 100,000 pF = 100 nF = 0.1uF

In your schematic, the 1K resistors on the bases of the npn are probably ok. The 1K led series resistors are too high, you can drop those down to 330R.

To calculate the led series resistors, I assumed the forward voltage of the LEDs is 1.8V, which is typical for red LEDs. I assumed the pn2222 will drop around 0.7V. So the voltage across the series resistor will be 5.0 - 1.8 - 0.7 = 2.5V. You need to limit the total current from the '595 to 70mA, which is 8.75mA per pin. So the ideal series resistor values will be 2.5 / 0.00875 = 285R. The nearest common value above that is 330R.