How can I change the orientation for an 5x7 LED matrix? [CLOSED]

Hi! I have a few pieces of small 5x7 led matrix and I would like to use them somehow. I am running a basic sketch for text scrolling:

int data[] = {
  0b11111111,  0b11111111,  0b11111111,  0b11111111,  0b11111111,  0b11111111,  0b11111111,  0b11111111, // full
  0b00000000,  0b00000000,  0b00000000,  0b00000000,  0b00000000,  0b00000000,  0b00000000,  0b00000000, // blank  
  0b00000000,  0b00011110,  0b00110011,  0b00110111,  0b00111011,  0b00110011,  0b00110011,  0b00011110, // 0
  0b00000000,  0b00001100,  0b00011100,  0b00001100,  0b00001100,  0b00001100,  0b00001100,  0b00111111, // 1  
  0b00000000,  0b00011110,  0b00110011,  0b00000011,  0b00000110,  0b00011000,  0b00110000,  0b00111111, // 2  
  0b00000000,  0b00011110,  0b00110011,  0b00000011,  0b00001110,  0b00000011,  0b00110011,  0b00011110, // 3
  0b00000000,  0b00000110,  0b00001110,  0b00010110,  0b00100110,  0b00111111,  0b00000110,  0b00000110, // 4
  0b00000000,  0b00111111,  0b00110000,  0b00111110,  0b00000011,  0b00000011,  0b00110011,  0b00011110, // 5
  0b00000000,  0b00011110,  0b00110011,  0b00110000,  0b00111110,  0b00110011,  0b00110011,  0b00011110, // 6
  0b00000000,  0b00111111,  0b00110011,  0b00000110,  0b00000110,  0b00001100,  0b00001100,  0b00001100, // 7
  0b00000000,  0b00011110,  0b00110011,  0b00110011,  0b00011110,  0b00110011,  0b00110011,  0b00011110, // 8
  0b00000000,  0b00011110,  0b00110011,  0b00110011,  0b00011111,  0b00000011,  0b00110011,  0b00011110, // 9
  0b00000000,  0b00011110,  0b00110011,  0b00110011,  0b00111111,  0b00110011,  0b00110011,  0b00110011, // A
  0b00000000,  0b00111110,  0b00110011,  0b00110011,  0b00111110,  0b00110011,  0b00110011,  0b00111110, // B
  0b00000000,  0b00011110,  0b00110011,  0b00110000,  0b00110000,  0b00110000,  0b00110011,  0b00011110, // C
  0b00000000,  0b00111110,  0b00110011,  0b00110011,  0b00110011,  0b00110011,  0b00110011,  0b00111110, // D
  0b00000000,  0b00111111,  0b00110000,  0b00110000,  0b00111110,  0b00110000,  0b00110000,  0b00111111, // E
  0b00000000,  0b00111111,  0b00110000,  0b00110000,  0b00111110,  0b00110000,  0b00110000,  0b00110000, // F
  0b00000000,  0b00000000,  0b00000000,  0b00000000,  0b00000000,  0b00000000,  0b00000000,  0b00000000, // blank
};
void setup ()
{
  //set pins to output
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
}
void loop()
{
  for (int n = 0; n < 144; n++)
  {
    for (int t = 0; t < 10; t ++) //Show repeated 10 times
    {
      int dat = 0x01;
      for (int num = n; num < 8 + n; num++)
      {
        shiftOut(dataPin, clockPin, LSBFIRST, data[num]); //control ROW of dot matrix
        shiftOut(dataPin, clockPin, LSBFIRST, ~dat); //control COL of dot matrix
        //return the latch pin high to signal chip that it
        //no longer needs to listen for information
        digitalWrite(latchPin, HIGH); //pull the latchPin to save the data
        //delay(1); //wait for a microsecond
        digitalWrite(latchPin, LOW); //ground latchPin and hold low for as long as you aretransmitting
        dat = dat << 1;
        delay(2); //wait for a microsecond
      }
    }
  }
}

The fact is that this sketch was written for an 8x8 led matrix, and the 5x7 is different, and I would need to reverse the orientation. At this point, the orientation is vertical, like this:

0

1

2

...

And I would like to make it horizontal, like this:
0 1 2 ...
because the 5x7 matrix is rectangular, therefore narrower, and I want to change the direction on the wider side.


8x8 LED Matrix Pinout
LEDM57G_Circuit

There is little work to be done. The circuit is for an 8x8 matrix that has anodes on the row and cathodes on the column. The 5x7 matrix is opposite, it has anodes on the column and cathodes on the row. I followed the anodes and cathodes from the circuit, so my circuit for the 5x7 matrix is like this:
U2 (Anodes)
Q0 _
Q1 _
Q2 col6
Q3 col5
Q4 col4
Q5 col3
Q6 col2
Q7 col1

U3 (Cathodes)
Q0 row1
Q1 row2
Q2 row3
Q3 row4
Q4 row5
Q5 row6
Q6 row7
Q7 _

It could be that no code changes are needed, and you just need to wire your matrix differently.

Post a schematic showing how the 8x8 matrix/matrices were wired for that code, and a second schematic showing how your 5x7 matrix/matrices are wired.

Computing, and the internet, is old. I suggest doing what I did, instead of fighting with the wrong font definition, just search and find one that is in the right format. Files like this have been regurgitated and recycled through thousands of projects. You can find them.

You are right.

I keep looking. Thanks.

There are some errors in the schematic for 8x8 matrix, which could damage both the 74hc595.

If all 8 LEDs in a row are lit, assuming the LEDs in your matrix have a forward voltage of 1.8V, typical for red LEDs, a current of (5-1.8)/220 = 14.5mA would flow through each led in the row, a total of 116mA.

The maximum current a 74hc595 can draw from Vcc or sink to ground is 70mA. So both U1 and U2 are overloaded to almost double their maximum.

Also, the maximum current any Qn output pin can source or sink is 35mA. For U1 that is not a problem, because each only needs to source 14.5mA. but for U2, all the current from 8 LEDs must be sunk by just one of its output pins, so that is three times over the maximum limit.

These limits are given in the 74hc595 data sheet.

You could replace U2 with a tpic6b595. This chip is very similar to 74hc595 in almost all ways. But it's pins can sink much more current, and can sink more current overall, so won't be overloaded. Unfortunately, tpic6c595 pins cannot source any current at all, so can't be used as a replacement for U1. To prevent overloading U1, increase the serial resistors to at least 390R.

Another error is that there are no bypass capacitors. There should be one for each chip, connected closely to the Vcc and GND pins of each chip. Without these caps, the chips can misbehave in strange ways, or cause other chips in the circuit to misbehave. These caps should be 0.1uF ceramic type.

I'm in the testing phase, I'm working on a breadboard. If I end up making a PCB, the scheme will definitely be different.

I came back from vacation. Well, I tried something, made some changes in the wiring, reversed the order of connecting the wires for the cathodes and anodes, but the orientation does not change. The anodes will make a mirror, while the cathodes change direction, from up to down or down to up (as I said, the 5x7 led matrix is rectangular).
Also in the code I will have to look to make changes.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.