Introduction: D.I.Y SMART RGB MATRIX 8x16
In this project, I’ll show you how to make your own 8×16 RGB LED Matrix using Arduino Uno/ Nano. An LED Matrix can show scrolling messages, display animations, music spectrum analyzer … With integrating NodeMCU, it can be used as small screen to show weather information from internet or any process values when it connect to Ethernet PLC system.
So, let's watch my videos below and follow my instructables to start with building your own RGB LED Matrix.
- Auto-rotate scrolling message test (update on November 6th, 2018): Using MPU-6050 with Kalman filter to calculate the angle when we rotate Led Matrix.
- Animation Test
- VU meter test: It shows music
volume unit by
using fix FFT transformation. Led Matrix will be connected to music player by audio jack 3.5mm.
- Smart Display Test: Connecting to PLC system
- Smart Display Test: Showing weather information from Internet
Step 1: PARTS LIST & TOOL
Electronic components & tools can be purchased from ebay as links below:
1. Electronic components:
2. Tools
Screwdriver
Step 2: SHEMATIC DIAGRAM
My RGB matrix panel with 128 x RGB LEDs is arranged in 8 rows and 16 columns, including:
- Led Matrix Board: is built on a single-side copper prototype PCB 9x15. With my instructables, Led Matrix can be plugged on top of the Driver Board, like a Shield.
- Driver Board: are built on a double-side copper prototype PCB 9x15. Driver Board handle column & row scanning to control Led Matrix Board above.
- Column scanning: is done through 2x 74HC138 cascading connection to build 4 to 16 line decoder as diagram above. With this combination, it can accept 4 bit binary coded decimal number on its 4 inputs and can select one of its 16 outputs. And then it drive 16 corresponding PNP transistors (A1013).
- Row scanning: through 3x 74HC595, 3 x ULN2803 for 3 colors: RED, GREEN, BLUE .
To control an individual color of common anode RGB LED, you set its column HIGH and its corresponding color row LOW.
We know that the brightness of a LED can be controlled by switching it on and off very rapidly. To do that, Pulse Width Modulation (PWM) is often chosen by using PWM pins on Arduino, beside that B.A.M is a another method to achieve the same thing.
For B.A.M, you can check at my instructables:
https://www.instructables.com/id/Interactive-Color...
https://www.instructables.com/id/BI-COLORS-MATRIX-...
Please follow next step to see my assembly for Led Matrix Board & Driver Board in detail.
Step 3: BUILD THE MATRIX
There are a lot of ways to solder a led matrix and I will share my tip to do a led matrix like a compact shield from prototype board:
- Decide to purchase RGB Led size & type: For me, I used common anode type with size 5mm. There are a lot of ways to solder a led matrix that final purpose is connecting all anode pins of the LEDs in columns and the cathode pins (pin Red, Green, Blue) in rows.
- Arrange the LEDs in the prototype board in symmetrical form.
- Then, take the R, G, B pins of the first LED in first row and bend it down to the other LEDs and solder the pins which touch each other.
- Do the same with 2nd row until finish 8th row.
- Finish rows of Led matrix and we need to check every led because at this time, it is easy to fix if there are any broken led or any short circuit between the anode/ cathode pins.
- For led matrix column, I also bent the anode pin and connected them like we did with the cathode pins. To get an isolated gap between anode and cathode pins, we padded an ABS Round Plastic Pipe when bending led pin.
- At the vertical & horizontal end of prototype, I connect anode & all R, G, B pins to long pin male header for later connecting to Led driver board.
- Testing RGB led one more time.
- Finish Matrix Board
Step 4: BUILD DRIVER BOARD
Driver Boards, including: column (layer) scanning (74HC138 + Transistor A1013), row scanning (74HC595 + ULN2803) and Arduino Uno/ Nano. Led Matrix is a shield that it can be plugged on top of the Driver Board.
- Prepare the horizontal & vertical female header at Driver Board. At this time, I also soldered 16 x A1013 transistors with its outputs is aligned with corresponding columns of Led Matrix.
- Testing whether male header of Led Matrix & female of Driver Board is matching together or not to correct it.
- Visually checked the contacting between male and female.Well, it is matching together like that.
- Following schematic below, I installed 3x 74HC595, 3 x ULN2803, 24 x 100Ω Resistors, 3 x 0.1uF Capacitors on prototype board and did soldering work. Each shift register 74HC595 will control one color so we have totally 3 shift registers for handling: Red, Green, Blue colors. Arduino pins assigned for SPI controlling:
- BLANK PIN (ENABLE) -----> 3 (PD2)
- LATCH PIN -----------------> 2 (PD3)
- CLOCK PIN (SCK) ----------> 13
- DATA PIN (MOSI)------------> 11
- For column circuit, I use 4 signals from Arduino Nano for multiplexing 2 x 74HC138 to control 16 RGB led's columns through 16 x A1013 transistors circuit. It is need to connect 560Ω resistor between pole B of transistor and 74HC138 for polarization. Arduino PORTD pins were used for multiplexing as follows:
- D4 (PD4) connect to A0.
- D5 (PD5) connect to A1.
- D6 (PD6) connect to A2.
- D7 (PD7) connect to A3.
Note: 74HC138 has active low outputs, it means this chip sets the selected pin low and all others high. Below is Truth table for this combination:
Note: Back side of above picture is the 1st version that I test with Arduino Uno with some male headers.
- Soldering DC female jack for power supply and female header for Arduino Nano.
- Installing Arduino Nano on prototype board. I also reserved space for NodeMCU for further future extension. This nodeMCU communicate to Arduino Nano through I2C protocol and it is pre-connected.
- Cleaning the boards, check again all RGB leds on Matrix board, continuity checking with a Multimeter. And then, connecting Led Matrix & Driver Board together. Here is the final results that I achieved.
Step 5: PROGRAMMING & PICTURES
- You can download full code at my GitHub
https://github.com/tuenhidiy/Smart-RGB-Matrix
- Some project pictures:
Step 6: BECOME SMART MATRIX
So, to develop this project, with existing hardware configuration I can make this RGB led matrix smarter through SPI, I2C and Ethernet interfaces.
- SPI & BAM: Arduino Nano show process values on RGB Matrix.
- I2C: Arduino Nano comunicate to NodeMCU to get raw values.
- Ethenet: NodeMCU communicate to PLC (like temperature/ pressure/ flow ... daily production, daily delay and some production KPIs...) or get values from internet, like weather information.
My testing picture with PLC is as below. You can check interface between NodeMCU and PLC S7-300 at my topic:
https://www.instructables.com/id/ARDUINO-HACK-PLC-...
Step 7: BECOME AUTO-ROTATE MATRIX
Soldering MPU-6050 on the Driver Board following schematic above (Fritzing file download here). I used MPU-6050 with Kalman filter to calculate the angle when we rotate Led Matrix. For Kalman Filter library, you can refer at address:
https://github.com/TKJElectronics/KalmanFilter
In my opinion, it works perfectly and accurately when values reading from MPU-6050 is passed through this filter.
Arduino code for Auto-Rotate RGB Matrix on my GitHub:
https://github.com/tuenhidiy/Auto-Rotate-RGB-Matri...
Please pay attention to 2 lines in the subroutine below. After reading values from MPU-6050, AngleX will be in range: -180 to 180 and I based on this to determine text direction showing on Led Matrix.
read_MPU6050();
AND
uint8_t pos = (kalAngleX >0 ? 1:0);
void hScroll_colorwheel_MPU(uint8_t y, Color Bk_color, char *mystring, uint8_t font, uint8_t delaytime, uint8_t dir) { int offset =0; Color setcolor, For_color; for ((dir) ? offset=0 : offset=((lenString(mystring)-8)*8-1) ; (dir) ? offset <((lenString(mystring)-8)*8-1) : offset >0; (dir) ? offset++ : offset--) { read_MPU6050(); for (byte xx=0; xx<16; xx++) { for (byte yy=0; yy<8; yy++) { get_colour(colourPos + 8*(yy+xx), &For_color.red, &For_color.green, &For_color.blue); uint8_t pos = (kalAngleX >0 ? 1:0); if (pos) { if (getPixelHString(xx+offset,yy,mystring)) setcolor = For_color; else setcolor=Bk_color; LED(xx,(yy+y),setcolor.red, setcolor.green, setcolor.blue); } else { if (flipbyte(getPixelHString((xx+offset),yy, mystring))) setcolor = For_color; else setcolor=Bk_color; LED(15-xx,7-(yy+y),setcolor.red, setcolor.green, setcolor.blue); } } } delay(delaytime); increment_colour_pos(2); } }
My first testing video is as below:
Thank for watching !!!

Participated in the
Electronics Tips & Tricks Challenge

Participated in the
Optics Contest
43 Comments
Question 1 year ago
I liked it so much that I want to replicate this project, but couldn't find any 2SA1013 BJTs near my location or online. So suggest me any alternative.
And I want to make it big. Like 16*16.
2 years ago
good work with this project , what would you say could be the cost of the entire thing if I have to buy all the components. Would building a matrix with ws2812 be much cheaper .
Question 3 years ago
Can you do a tutorial on how to program animations for this?
Tip 3 years ago
good
Reply 3 years ago
Thanks, Nicole!
3 years ago
great job,,,
I want to ask about a few things, if you display the column to 24, what components should be added, and what about the program?
would you like to share knowledge, thank you
3 years ago
Really good work, but i can use another pnp or is stric use the a1013. Thanks for all
Question 3 years ago
Hi, friend. I have worked on this project. I have checked all the schemes correctly and I copied the Arduino code but the LED didn't work after I connected to the power supply. I have been confused for this project.
Answer 3 years ago
1. At first, please check every single RGB led by commands:
// Test RED color
for (byte x=0; x<16; x++)
for (byte y=0; y<8; y++)
{
delay(1000);
}
}
2. In case all Leds is OK but Matrix is not rotate as expected, you can check at lines:
"read_MPU6050();
uint8_t pos = (kalAngleX >0 ? 1:0);"
It can be changed to kalAngleY or you should compare kalAngleX with other angle (not "0") . Because maybe your MPU6050's direction is different from mine.
Reply 3 years ago
Hi, friend. I have ended this project and determined the final result like this photo. Why not match your final results. Is there any guidance from you about this led project .. I am still an amateur to test this project before, thank you very much.
Answer 3 years ago
I was forced to postpone it, because my laptop was damaged.
Question 4 years ago on Step 7
How can I change the circuit to use with Common Cathode RGB LEDs ? It would be thankful if a circuit diagram is sent to me. Email - mohamed.shaamil80@gmail.com
4 years ago
Hello,
Please share schismatic file, I want to expand it to made 16x32 RGB LED Matrix.
Thanks so much
Reply 4 years ago
Hi laserayaneh!
I've just updated Fritzing schematic on Step 7. Please check.
Reply 4 years ago
Hello,
Thank so much :-)
4 years ago
Hello,
Very nice project ...
NodeMCU is no enough ?
NodeMCU work same as Arduino Uno and WiFi client/station, Okay ?
Thanks so much for share :-)
Question 4 years ago
Hi, can this be chained to form an 8x32 panel? or more by simply adding another 2(hc138)+3(hc595) ??
Answer 4 years ago
Hi Se3ker,
Yes. It can be extended to 8x32 matrix by just adding 2x74HC138 + Transistors. In this case, we will control 32 columns by 4x74HC138 and keep the same with row scanning by 3x74HC595.
Question 4 years ago
Hello, I have a question and I've been trying to figure out but not getting any answer that convince me, why are you using transistors if you are already using the ULN? are not the transistors doing the same job? I'm using a RGB matrix with transistors (not using an ULN), working properly, so why use them? Maybe I am wrong or I am avoiding something, thanks a lot.
Answer 4 years ago
Hi Raygem,
From 74HC595 datasheet:
- Io (Continuous Output Current) = 35 mA.
- Io (Continuous Current through Vcc or GND) = 70 mA.
So if 8 ports of 74HC595 work with current 10mA (for LED it is about 20mA maximum), total consumption is: 10x8 = 80mA > Max(70mA).
With ULN2803, we can drain up to 500 mA at each port and keep 74HC595 in safe working condition.
Hope this helps!