About: PLC, Arduino - Do it yourself project

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

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.



My RGB matrix panel with 128 x RGB LEDs is arranged in 8 rows and 16 columns, including:

  1. 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.
  2. 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:



Please follow next step to see my assembly for Led Matrix Board & Driver Board in detail.


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


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.



  • Some project pictures:


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:



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:


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:


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.

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--)
      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);
                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);


My first testing video is as below:

Thank for watching !!!

Optics Contest

Participated in the
Optics Contest

Electronics Tips & Tricks Challenge

Participated in the
Electronics Tips & Tricks Challenge

Be the First to Share


    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    37 Discussions


    26 days ago

    Really good work, but i can use another pnp or is stric use the a1013. Thanks for all


    Question 3 months 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.

    3 answers

    Answer 3 months ago

    Hi Emphijali.
    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++)
    LED(x, y, 15, 0, 0);
    //..... Do the same with GREEN and BLUE color.
    2. In case all Leds is OK but Matrix is not rotate as expected, you can check at lines:
    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 26 days 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 months ago

    I was forced to postpone it, because my laptop was damaged.


    9 months ago

    Please share schismatic file, I want to expand it to made 16x32 RGB LED Matrix.

    Thanks so much

    2 replies

    Reply 9 months ago

    Hi laserayaneh!
    I've just updated Fritzing schematic on Step 7. Please check.


    9 months ago


    Very nice project ...

    NodeMCU is no enough ?

    NodeMCU work same as Arduino Uno and WiFi client/station, Okay ?

    Thanks so much for share :-)


    Question 11 months ago

    Hi, can this be chained to form an 8x32 panel? or more by simply adding another 2(hc138)+3(hc595) ??

    1 answer

    Answer 11 months 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 11 months 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.

    1 answer

    Answer 11 months 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!


    Reply 11 months ago

    Hi Arbomakes,
    Thank you! I've just entered to "Optics Contest" following your advice.