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



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 !!!



    • Toys Contest

      Toys Contest
    • Safe and Secure Challenge

      Safe and Secure Challenge
    • Cardboard Challenge

      Cardboard Challenge

    31 Discussions


    5 days ago

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

    Thanks so much

    2 replies

    Reply 3 days ago

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


    8 days 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 2 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 2 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 2 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 2 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 2 months ago

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


    Question 2 months ago on Step 1

    Very nice project. Would you be able to post a picture of the back side of the driver board?

    1 answer

    Answer 2 months ago

    Thanks ! I've just updated the back side picture of Driver Board on Step 4.
    Note: This back side picture is the 1st version that I tested with Arduino Uno with some male headers.


    2 months ago

    Nice project, great pictures too!!

    I have just two questions -
    1 - Why not save yourself some headache and extra wiring and use a single 74154 instead of the two 74138?
    2 - You went to all the work laying out your circuitry, why not go the extra step and send out the PCB file to get fabricated boards inexpensively? I know you knocked yourself out with all the LED wiring, the transistors, chips and header wiring, and that is SO time-consuming. It's also very easy to make a mistake that's really tough to track down. Don't you think it would be so sweet to save yourself all that, and simply stuff your components into professionally-made boards? That would take you an evening instead of a week.

    You are probably the type, as I once was, where you are so in love with electronics that you would make your own pencils if you had to... and the hard stuff is part of the fun. Right?

    Great job anyway, however you choose to do it.

    1 reply

    Reply 2 months ago

    First of all, thanks for your constructive comment and I would like to answer your two questions:
    1 - The problem is I just use some ICs what I have in my hand, although I know that 74HC154 is easier for 4 to 16 line decoder.
    2 - Every day, I go home late and play with my kids until they go to sleep. After that, this is my time, and I have started to do the things that I want to see final result. Accumulated works will be done day by day because my time is limited, as well as, my job & knowledge is a other field, not electronic. If I do etching PCB, I also do it by myself, as some projects that I posted on Instructables.
    Another thing, when I make my own circuits on PCB prototype, I can customize it or sometimes have some adjustments. I think it would be easier.
    Anyways, next time I should consider to only design PCB and send to some manufactures to do fabricating job.
    Thank you for your remind & being interest in my project.


    Reply 2 months ago

    Yes, we can. If I had a bigger PCB prototype matching with 16x16 matrix size, for sure it will be better.