6x8 LED Matrix

2,473

29

4

Introduction: 6x8 LED Matrix

This is an LED matrix based off of Nova Technologies' 5X3 LED Matrix, but because the resources I have access to are limited, I have changed a lot of how this matrix works. Instead of using individual LEDs with another controller, I have used RGB LED strips with individual ICs on each of them, connected into 8 columns of 6 LEDs. Not only does this make the matrix bigger, it also allows us to use CRGB colors instead of just one color.

*Note: I know the code can be simplified if the LEDs are all chained together, but I wanted to try something new, so I separated the LED strips into 8 strips of 6.*

Sources:

Original Project: https://www.instructables.com/id/Arduino-5X3-LED-Matrix-to-Run-Alphabets/

CRGB colors: https://github.com/FastLED/FastLED/wiki/Pixel-reference

Step 1: Supplies

You will need:

  1. Jumper wires: these are needed to connect the LED matrix to the circuit board so you can control it.
  2. Single-strand wire (optional): used to create more distance between the LEDs on the LED strip. My LED strip has the LEDs only about 1 centimeter apart, but because my matrix is designed with the LEDs 3 centimeters apart, I had to use single-strand wires to connect them at a distance. These are cheaper than jumper wires to get.
  3. Neopixel LED strip (or any other LED strip with ICs)
  4. Wire cutters/wire strippers (optional): if you are using the single-strand wires to get more distance between the LEDs, then you need the wire cutters to cut the wire apart to be soldered onto the LED strip.
  5. Arduino UNO board: used to control the matrix. Without it, nothing will work!
  6. Breadboard (optional): used to connect the ground and 5V to a uniform ground and 5V. See below for more information.
  7. Soldering iron: used to solder the jumper wires onto the LED strip. Also used to solder the single-strand wires to each other if needed.

The breadboard is optional because the jumper wires can be connected directly to the circuit board, but it is easier to connect the ground and 5V wires to a breadboard before being connected to the circuit board.

Step 2: Soldering and Connecting the LED Strips

After getting the required supplies, we first start by connecting the LED strips. I have cut the LED strip into lengths of 6 LEDs, connected at the input end with 3 jumper wires to connect to the UNO board. My design also has the LEDs slightly spaced apart.

  1. Cut the LED strip into lengths of 6, or if you want to make the matrix bigger, then cut the LED strip into individual LEDs into groups of 6. You will need 48 LEDs for this project.
  2. Solder them together. This part can be time-consuming, if you are inexperienced with soldering (like me), but after a while, you will get the hang of it. If you are using the LED strip with the distance it was designed with, then solder three jumper wires to the end of the length of 6. Otherwise, solder the LEDs together, with the jumper wires at one end, and single-strand wires all through the middle.
  3. Repeat for the other 8 strips.
  4. Connect the GND and 5V to the GND and 5V on the UNO board. If you are using a breadboard, just connect the GND and 5V to the positive and negative holes at the top or bottom of the breadboard. Remember to connect those to the 5V and GND of the UNO board.

Step 3: Putting the Box Together

For this project, I have created a custom box and grid to contain the matrix. The grid pattern is to contain each LED's light to its own space, making sure they don't mix. LEDs emit a lot of light!

For this matrix I used laser cutting to create the box. The box design is attached below.

Step 4: The Code

For this project, one library has to be installed, which is the FastLED.h library. It can be downloaded here.

Online editor:

https://create.arduino.cc/editor/aaronhung1128/f0d9eb4e-cb63-40f2-9fd1-4b0d091b90b7/preview

https://create.arduino.cc/editor/aaronhung1128/0d7a11ff-2965-4f1d-9833-ed10dc871ffc/preview

From the original project, Nova Technologies has created a running alphabet, which I have recreated and optimized for this matrix. Using bytes to store how to write each letter, the code will iterate through each of the 26 letters. The code works like this:

#include <FastLED.h>
#define NUM_LEDS 6

These lines tell the program I am using the FastLED.h library. It is the only library included in this project, and it allows us to control the led strips.

#define DPIN_1 2<br>#define DPIN_2 3
#define DPIN_3 4
#define DPIN_4 5
#define DPIN_5 6
#define DPIN_6 7
#define DPIN_7 8
#define DPIN_8 9 

These define the digital output pins used to connect to the LED strips. They may change depending on which pin they are connected to on the Uno board.

CRGB ledsA[NUM_LEDS];<br>CRGB ledsB[NUM_LEDS];
CRGB ledsC[NUM_LEDS];
CRGB ledsD[NUM_LEDS];
CRGB ledsE[NUM_LEDS];
CRGB ledsF[NUM_LEDS];
CRGB ledsG[NUM_LEDS];
CRGB ledsH[NUM_LEDS];

These are CRGB arrays containing the data for each of the LED strips. They tell the LEDs what color they should be showing.

<p>CRGB color = CRGB::Orange;<br>CRGB notColor = CRGB::FireBrick;</p>

These are the colors that select which colors go where. The variable color is the color of the English letter itself, while the variable notColor is everything surrounding the letter.

bool getBit(unsigned char byte, int position) {  
  return (byte >> position) & 0x1;
}

This is a function that gets the specific bit from a byte. It tells the LED where the light should be on, and where it should be off.

byte letters[26][6] = {<br>  {B00000000, B00011000, B00100100, B00111100, B00100100, B00100100}, //A
  {B00000000, B00111000, B00100100, B00111000, B00100100, B00111000}, //B
  {B00000000, B00011100, B00100000, B00100000, B00100000, B00011100}, //C
  {B00000000, B00111000, B00100100, B00100100, B00100100, B00111000}, //D
  {B00000000, B00111100, B00100000, B00111000, B00100000, B00111100}, //E
  {B00000000, B00111100, B00100000, B00111000, B00100000, B00100000}, //F
  {B00000000, B00111100, B00100000, B00101100, B00100100, B00111100}, //G
  {B00000000, B00100100, B00100100, B00111100, B00100100, B00100100}, //H
  {B00000000, B00111000, B00010000, B00010000, B00010000, B00111000}, //I
  {B00000000, B00111000, B00001000, B00001000, B00101000, B00010000}, //J
  {B00000000, B00100100, B00101000, B00110000, B00101000, B00100100}, //K
  {B00000000, B00100000, B00100000, B00100000, B00100000, B00111100}, //L
  {B00000000, B01111100, B01010100, B01010100, B01000100, B01000100}, //M
  {B00000000, B00100100, B00110100, B00101100, B00100100, B00100100}, //N
  {B00000000, B00011000, B00100100, B00100100, B00100100, B00011000}, //O
  {B00000000, B00111000, B00100100, B00111000, B00100000, B00100000}, //P
  {B00000000, B00111000, B00101000, B00111000, B00010000, B00001000}, //Q
  {B00000000, B00111000, B00100100, B00111000, B00100100, B00100100}, //R
  {B00000000, B00011100, B00100000, B00011000, B00000100, B00111000}, //S
  {B00000000, B00111000, B00010000, B00010000, B00010000, B00010000}, //T
  {B00000000, B00100100, B00100100, B00100100, B00100100, B00011000}, //U
  {B00000000, B01000100, B01000100, B01000100, B00101000, B00010000}, //V
  {B00000000, B01000100, B01000100, B01010100, B01010100, B01111100}, //W
  {B00000000, B01000100, B00101000, B00010000, B00101000, B01000100}, //X
  {B00000000, B01000100, B00101000, B00010000, B00010000, B00010000}, //Y
  {B00000000, B00111100, B00000100, B00001000, B00010000, B00111100}, //Z
};

This is the code for all 26 of the letters. In here, the first byte is for the first row of the matrix, the second byte is for the second row, and so on. In each of these bytes, the 0s tell the computer the light should be off, whereas the 1s tell the computer the light should be on in these locations.

void setLEDs(char c){
  /*
  ...
  code omitted
  ...
  */
}

This is the code used to set each of the LEDs. I have omitted it here because of its length, but in the download file this code is visible. At the beginning, the character c is reduced by 65 to turn the ASCII character into the number values the byte array uses. Then, for each of the for loops, one column of LEDs are processed.

void loop() {
  for (int i = 0; i < 26; i++) {
    setLEDs(i + 65);
    FastLED.show();
    delay(1000);
  }
}

This is the final piece of code in this program. Using a for loop, I am iterating through all 26 letters of my array, sending the value (with an additional 65 to change to the ASCII value). Then, the line FastLED.show() lets the program display the lights so it will update the matrix. Finally, the line delay(1000); waits for one second before showing the next letter so each of the letters can be seen individually.

Apart from the changes in the original code, I have also created another code, for fun, to show what other creations this matrix can do. This code runs a rainbow color through the 48 LEDs diagonally, with a smooth transition that is somewhat mesmerizing. The code will be attached below, but without the explanations in the top section (unless in the comments wants me to?).

RGB_LED.ino

//改 Changed: Not using the libraries because the display is different from the original
#include<FastLED.h>
#defineNUM_LEDS6
//改 Changed: Using led strips
#defineDPIN_12
#defineDPIN_23
#defineDPIN_34
#defineDPIN_45
#defineDPIN_56
#defineDPIN_67
#defineDPIN_78
#defineDPIN_89
//改 Changed: Add 8 LED strips
CRGB ledsA[NUM_LEDS];
CRGB ledsB[NUM_LEDS];
CRGB ledsC[NUM_LEDS];
CRGB ledsD[NUM_LEDS];
CRGB ledsE[NUM_LEDS];
CRGB ledsF[NUM_LEDS];
CRGB ledsG[NUM_LEDS];
CRGB ledsH[NUM_LEDS];
voidsetup() {
//改 Change: Use LED strips instead of just one
FastLED.addLeds(ledsA, NUM_LEDS);
FastLED.addLeds(ledsB, NUM_LEDS);
FastLED.addLeds(ledsC, NUM_LEDS);
FastLED.addLeds(ledsD, NUM_LEDS);
FastLED.addLeds(ledsE, NUM_LEDS);
FastLED.addLeds(ledsF, NUM_LEDS);
FastLED.addLeds(ledsG, NUM_LEDS);
FastLED.addLeds(ledsH, NUM_LEDS);
ledsA[0] = CRGB::Blue;
unsignedint rgbColour[3];
// Start off with red.
}
//改 Changed: added code to set color of each individual LED
voidsetLEDs() {
ledsH[0] = ledsG[0];
ledsG[0] = ledsF[0];
ledsF[0] = ledsE[0];
ledsE[0] = ledsD[0];
ledsD[0] = ledsC[0];
ledsC[0] = ledsB[0];
ledsB[0] = ledsA[0];
for (int i = 5; i >0; i--) {
ledsA[i] = ledsA[i - 1];
}
for (int i = 5; i >0; i--) {
ledsB[i] = ledsB[i - 1];
}
for (int i = 5; i >0; i--) {
ledsC[i] = ledsC[i - 1];
}
for (int i = 5; i >0; i--) {
ledsD[i] = ledsD[i - 1];
}
for (int i = 5; i >0; i--) {
ledsE[i] = ledsE[i - 1];
}
for (int i = 5; i >0; i--) {
ledsF[i] = ledsF[i - 1];
}
for (int i = 5; i >0; i--) {
ledsG[i] = ledsG[i - 1];
}
for (int i = 5; i >0; i--) {
ledsH[i] = ledsH[i - 1];
}
}
voidloop() {
//改 Changed: added code to accomodate new LED matrix
unsignedint rgbColour[3];
// Start with red
rgbColour[0] = 255;
rgbColour[1] = 0;
rgbColour[2] = 0;
for (int decColour = 0; decColour < 3; decColour += 1) {
int incColour = decColour == 2 ? 0 : decColour + 1;
// Cross-fade the two colors
for (int i = 0; i < 17; i += 1) {
rgbColour[decColour] -= 15;
rgbColour[incColour] += 15;
ledsA[0].r = rgbColour[0];
ledsA[0].g = rgbColour[1];
ledsA[0].b = rgbColour[2];
setLEDs();
FastLED.show();
delay(50);
}
}
}
view rawRGB_LED.ino hosted with ❤ by GitHub

Step 5: Putting It All Together

Now comes the moment of truth - whether your soldering works all comes down to these few moments.

  1. After putting the Uno board and the breadboard in the box, put a piece of cardboard on top of all of it and stick the LED strips on top of that.
  2. Make sure the wire is stuck onto the Uno board with the USB end coming out of the hole cut into the side of the box. This allows you to get power to the board to power the matrix on.
  3. Make sure the LED strips are aligned with the grid on top, allowing the light to come through, but only in the specified spots.
  4. After putting the grid on top of the box, you have to put a sheet of paper over that, and glue the paper in place. The paper will allow the light to show as a square instead of just one spot, while the grid restrains the light and keeps it from blending in with surrounding squares.

And then you're done.

Step 6: Completion!

And now you're done. Above I have attached some of the photos I took before I added the grid and the paper, which, if I may say so myself, looks fantastic. Those are photos from the shifting RGB which can be seen a lot easier than the letters before the grid and the paper is put in.

I have also recorded a video of the matrix in action if you want to see the complete results. Feel free to make your own creations based off of this project, and remember to share them below!

Be the First to Share

    Recommendations

    • Arduino Contest

      Arduino Contest
    • Fandom Contest

      Fandom Contest
    • Colors of the Rainbow Contest

      Colors of the Rainbow Contest

    4 Comments

    0
    chanhui2000
    chanhui2000

    1 year ago

    Compared to paper, seems use translucent box, will be better?

    0
    aaronhung1128
    aaronhung1128

    Reply 1 year ago

    A translucent box would probably work, but because paper is more easily accessible, and as it works well enough, I thought just using the paper would suffice. Using a translucent box would probably work great too though. Thanks for the suggestion!

    0
    Penolopy Bulnick
    Penolopy Bulnick

    1 year ago

    Nice job putting this together :)

    0
    aaronhung1128
    aaronhung1128

    Reply 1 year ago

    Thank you!