25 - 8x8 LED Matrix
25 - 8x8 LED Matrix
Matrix
LED displays are often packaged as matrixes of LEDs arranged in rows of common
anodes and columns of common cathodes, or the reverse. Here's a typical example,
and its schematic:
These can be very useful displays. To control a matrix, you connect both its rows and
columns to your microcontroller. The columns are connected to the LEDs cathodes, so
a column needs to be LOW for any of the LEDs in that column to turn on. The rows
are connected to the LEDs anodes, so the row needs to be HIGH for an individual
LED to turn on. If the row and the column are both high or both low, no voltage flows
through the LED and it doesn’t turn on.
To control an individual LED, you set its column LOW and its row HIGH. To control
multiple LEDs in a row, you set the row HIGH, then take the column high, then set
the columns LOW or HIGH as appropriate; a LOW column will turn the
corresponding LED ON, and a HIGH column will turn it off.
Tip - Pins set to OUTPUT by use of the PinMode command are set to LOW if not
otherwise stated
Although there are pre-made LED matrices, you can also make your own matrix from
64 LEDs, using the schematic as shown above.
It doesn’t matter which pins of the microcontroller you connect the rows and columns
to, because you can assign things in software. Connected the pins in a way that makes
wiring easiest. A typical layout is shown below.
1 5 - 13
2 7 - 12
3 - 2 11
4 - 3 10
5 8 - 16 (analog pin 2)
6 - 5 17 (analog pin 3)
7 6 - 18 (analog pin 4)
8 3 - 19 (analog pin 5)
9 1 - 2
10 - 4 3
11 - 6 4
12 4 - 5
13 - 1 6
14 2 - 7
15 - 7 8
16 - 8 9
Hardware Required
1. Arduino or Genuino Board
2. 8 x 8 LED Matrix
3. 2 10k ohm potentiometers
4. hook-up wires
5. breadboard
Circuit
The 16 pins of the matrix are hooked up to 16 pins of the Arduino or Genuino board.
Four of the analog pins are used as digital inputs 16 through 19. The order of the pins
is assigned in two arrays in the code.
Two potentiometers, connected to analog pins 0 and 1, control the movement of a lit
LED in the matrix.
Schematic
Code
#define ROW_1 2
#define ROW_2 7
#define ROW_3 19
#define ROW_4 5
#define ROW_5 13
#define ROW_6 18
#define ROW_7 12
#define ROW_8 16
#define COL_1 9
#define COL_2 8
#define COL_3 4
#define COL_4 17
#define COL_5 3
#define COL_6 10
#define COL_7 11
#define COL_8 6
float timeCount = 0;
const int speedChange = 100;
void setup()
{
// Open serial port
Serial.begin(9600);
void loop() {
delay(5);
timeCount += 1;
if(timeCount < speedChange) {
drawMatrix(smileFace);
}
else if(timeCount < 2*speedChange) {
drawMatrix(sadFace);
}
else {
// back to the start
timeCount = 0;
}
}
https://xantorohara.github.io/led-matrix-editor/
byte CLEAR[] =
{B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B111111
11};
byte EX[] =
{B11111111,B11101111,B11101111,B11101111,B11101111,B11111111,B11101111,B111111
11};
byte A[] =
{B11100111,B11000011,B10011001,B10000001,B10011001,B10011001,B10011001,B100110
01};
byte B[] =
{B10000111,B10000011,B10011011,B10000111,B10011011,B10011011,B10000011,B100001
11};
byte C[] =
{B11000011,B10000001,B10011101,B10011111,B10011111,B10011101,B10000001,B110000
11};
byte D[] =
{B10000111,B10000011,B10011001,B10011001,B10011001,B10011001,B10000011,B100001
11};
byte E[] =
{B10000011,B10000011,B10011111,B10000011,B10011111,B10011111,B10000011,B100000
11};
byte F[] =
{B10000011,B10000011,B10011111,B10000011,B10011111,B10011111,B10011111,B100111
11};
byte G[] =
{B11000011,B10000001,B10011111,B10010000,B10011001,B10011001,B10000001,B110000
11};
byte H[] =
{B10011001,B10011001,B10011001,B10000001,B10011001,B10011001,B10011001,B100110
01};
byte I[] =
{B10000001,B10000001,B11100111,B11100111,B11100111,B11100111,B10000001,B100000
01};
byte J[] =
{B10000001,B10000001,B11111001,B11111001,B11111001,B10011001,B10000001,B110000
11};
byte K[] =
{B10011101,B10011011,B10010111,B10001111,B10000111,B10010011,B10011001,B100111
00};
byte L[] =
{B10011111,B10011111,B10011111,B10011111,B10011111,B10011001,B10000001,B100000
01};
byte M[] =
{B10011100,B10001000,B10000000,B10010100,B10011100,B10011100,B10011100,B100111
00};
byte N[] =
{B10011100,B10001100,B10000100,B10010000,B10011000,B10011100,B10011100,B100111
00};
byte O[] =
{B11000011,B10000001,B10011001,B10011001,B10011001,B10011001,B10000001,B110000
11};
byte P[] =
{B10000011,B10000001,B10011001,B10011001,B10000011,B10011111,B10011111,B100111
11};
byte Q[] =
{B11000011,B10000001,B10011001,B10011001,B10011001,B10010001,B10011001,B110000
10};
byte R[] =
{B10000011,B10000001,B10011001,B10000011,B10000111,B10010011,B10011001,B100111
00};
byte S[] =
{B11000111,B10011011,B10011111,B11000111,B11100011,B11111011,B10010011,B110001
11};
byte T[] =
{B10000001,B10000001,B11100111,B11100111,B11100111,B11100111,B11100111,B111001
11};
byte U[] =
{B10011001,B10011001,B10011001,B10011001,B10011001,B10011001,B10011001,B110000
11};
byte V[] =
{B10011100,B10011100,B10011100,B10011100,B10011100,B11011101,B11101011,B111101
11};
byte W[] =
{B10011100,B10011100,B10011100,B10011100,B10011100,B10010100,B10001000,B100111
00};
byte X[] =
{B10011100,B10011100,B11001001,B11110111,B11101011,B11011001,B10011100,B100111
00};
byte Y[] =
{B10011001,B10011001,B10011001,B11011011,B11100111,B11100111,B11100111,B111001
11};
byte Z[] =
{B10000001,B10011001,B11110001,B11100011,B11001111,B10011101,B10000001,B100000
01};