RGB LED Matrix With an ESP8266




Introduction: RGB LED Matrix With an ESP8266

About: Hey everyone! My name is Brian and thanks for checking my Instructables. I'm a software developer by trade but I've recently gotten into Arduino development after discovering the esp8266 chip, a WiFi enable…

I think these RGB LED Matrix displays are one of best displays you can get for your Arduino projects, they are incredibly bright and vivid and are actually pretty easy to use too!

They can be used for displaying text, images or a combination of both

Check out some of the examples of what can be done with the display:

Displaying Text

Displaying Images

YouTube Subcriber counter

In this Instructable I'll show you how to get started with using these displays with an ESP8266.

Let's jump into it!

Step 1: Check Out the Video!

The video covers the same stuff that's in this instructable if you want to check it out!

Also I have created playlist of any live streams I have done using this display if you wanted to check them out:


Step 2: Different Types of Displays

A good first place to start would be to talk about the different types of these screens available.

The one I have is a P3 64x32 LED Matrix, which reveals two things about the display:

1) The P3 part of the name indicates that the display has a 3mm pitch. This means that between the center of one LED and the center of the next one there is a distance of 3mm

2) The 64x32 indicates how many LEDs there are on the display.

These types of displays come in a lot of different configurations of the above (I think the largest is a 64x64), but they all work pretty similarly.

These displays are actually pretty cheap too! The one I use in this Instructable starts at around $20 delivered. I bought mine off Amazon.co.uk, but all of these should be the same as mine.

Amazon.co.uk* https://amzn.to/2HyLRbD
Amazon.com* https://amzn.to/2KmsJvl
Aliexpress* http://s.click.aliexpress.com/e/EMvjy3z

*= Affiliate Links

Step 3: What Do We Need to Use the Display

EDIT: Since making this guide, I have made a PCB that makes using these displays really easy! It makes use of the wires than come with the displays for easier connections.

I sell them on tindie if you are interested. It saves some of the mess of wiring and makes it easier to power the board.

If you get the board all you need to get is an Wemos D1 mini style ESP8266 and a Power Supply (both listed below)

Along with the actual display you will also get the following:

  • A ribbon cable - this can be used to chain displays together (which is supported by the library we will be using, but I only have one display so I won't be able to advise on it)
  • 4 screw mounts - these screw into the back of the display and have magnets on the bottom of them so you could attach this display to something metal
  • Power connecting cable - This cable connects to the power connection of the display and exposes two terminals for you to power it with (more about this in the next step)

Power Supply

The first thing we'll need is a pretty large 5v power supply, Adafruit suggest that 64x32 matrix can require up the 8 Amps! This is worst case scenario (all LEDs set to white) so in reality you probably won't need one that big, but there is no harm in having the head room. There are two different types of power supplies that you can get:

Types of PSUs - Laptop style on the left

One is similar to a laptop and has a 2.1mm jack as its output and there other is more similar to type that comes with 3d printers.

I much prefer the laptop style as the other requires you to connect mains voltage wires to it, and working with mains voltage is something I like to avoid as often as possible! Here is a link to the same type of one I used (5v 8 amp laptop style)

Amazon.co.uk* https://amzn.to/2JBauB2
Amazon.com* https://amzn.to/2Ko5WiX (This seems to come with the adapter for connecting to the power cables)
Aliexpress* http://s.click.aliexpress.com/e/vzJ2rnE

Other Components

The only other things we need are

Step 4: Software Setup

There are a couple of things you will need to have setup before you can start using these displays.

Installing Arduino IDE & ESP8266

If you have never used the ESP8266 or Arduino before, we will need to a little bit of software setup. I have a dedicated video for this. It's only 5 minutes long and goes through everything you need to setup.

If videos are not really your thing, check out lesson 2 of Becky's awesome IoT Class, it goes over everything you need as well.

Before you move to the next section you should be able to upload a simple sketch to your ESP8266 (such as the blink example mentioned in both the video and Becky's lesson)

Installing libraries

To use the display we are also going to need to install some libraries.

The first one we need to install is the PXMatrix Library by 2Dom. It is in the process of being released to the library manager but at the time of writing this Instructable the library is only available through Github. Try search for "pxmatrix" inside the library manager (Sketch -> Include Library -> Manage Libraries), but you might need to just download the zip file from Github and add to Arduino IDE that way. (Sketch -> Include Library -> Add .ZIP Library)

We also need to install the Adafruit GFX library. To install this you can search for it on the Arduino library manager.

Step 5: Wiring It Up

Connecting Up The Power Supply

First thing we need to do is connect the power supply up to the wires that came with the display.

The Adafruit learn guide recommends connecting up the wires like this:

I couldn't get this to make a solid connection (physically), but who am I to question what Adafruit suggest! If you do go down this route make sure to use some insulating tape or heatskrink to give it some strength.

I ended up using a couple of screw terminals and piece of perfboard to make a small board for connecting the power supply to the wires, I was happy with how it turned out!

Connecting Up The Data Wires

Next we'll hook up the the data wires for the display. The library github lists a couple of different pin layout examples, but only the labels seem to change between the different ones and mine didn't have any labels at all! I wired the board as follows:

Full Size available here

You'll notice on the back of the display that there are two connectors, the one you want to wire to is the one where the arrows are moving away from it

Some of the pins are not needed depending on what display you have, these are the C, D and E pins. The library lists instructions for when you need to connect up these pins based on the scan rate of your display:

Display PinESP8266 PinNote
C15 (D8)Only for 1/8, 1/16, 1/32 scan
D12 (D6)Only for 1/16, 1/32 scan
E0 (D3)Only for 1/32 scan

Although my display is a 1/16 display and I needed to for E connected up. This is what it looked like without it:

The best way to check if they are required for your display is they seem to be connected to ground on displays where they are not needed. Get your multimeter in continuity mode and check these pins against the ground pin, if the pin is connected to ground you don't need it

Some Wiring Notes

It is also possible to power the ESP8266 off the same power supply as the display, but the simplest and safest way is to power them separately.

If you do want to power off the same supply, on the Wemos D1 mini board we can connect the 5v of the display power supply directly to the 5v pin. Two things to be careful about:

  1. If you plug in just the USB and not the larger power supply then display will try run off the USB power and it could cause overload your USB supply. You could fix this by putting a diode between the display power supply and 5v pin (so current can only flow towards the esp8266)
  2. If you are not using an Wemos D1 mini make sure whatever pin you are connecting to has a voltage regulator connected to it (Don't connect directly to the 3.3v pin!)

One other note. If you are using a ESP8266 that doesn't use pins labeled with a "D" in front of it (e.g. D1, D2 etc) you can use the following Diagram to map the pins to the ESP pins. For Example D1 is connected to GPIO pin 5, so if your board uses the GPIO pin numbers connect that connection to 5.

Step 6: Using the Display

We are now ready to start using the display. First we are going to use on the examples from the library to test everything is working ok.

In your Arduino IDE, go to File -> Examples -> Px Matrix and open the pixeltime example.

The first thing we need to update is the configuration for what type of display we have. The following default configurations are in the example:

PxMATRIX display(32,16,P_LAT, P_OE,P_A,P_B,P_C);

//PxMATRIX display(64,32,P_LAT, P_OE,P_A,P_B,P_C,P_D);

//PxMATRIX display(64,64,P_LAT, P_OE,P_A,P_B,P_C,P_D,P_E);

Enable the one that matches your display based on what pins are needed (as described in the previous step), mine had the C, D and E pins so I would remove comment from the last one and comment out the rest.

Next we want to set the resolution of the display, this is the two numbers at the start. Taking the "32,16" one as an example, 32 is the amount of pixels wide it is and 16 is the amount of pixels tall it is. Change this to match the display you have. Mine was 64 x 32 display so my configuration ended up like this:

PxMATRIX display(64,32,P_LAT, P_OE,P_A,P_B,P_C,P_D,P_E);

Next we want to set the scan rate of our device, this is normally found on the product listing of where you bought the display. Mine was a 1/16 display

In the setup of the example you will see the following line:


This indicates that display is a 1/8 scan display, so change this line to whatever your display is. Mine would be display.begin(16)

That is all the code changes required, one last configuration change that the author of the library recomends is to set your CPU Frequency of your ESP8266 to 160MHz, this will make your ESP8266 run faster which will improve how the display works. You can do this easily in the Arduino IDE, go to Tools -> CPU Frequency and set it to 160MHz.

You can now upload the example sketch to the board.

The example is quite good and shows off couple of different features available when using the display, such as writing text, drawing shapes and displaying images

PixelTime example

Step 7: More Examples

Just as a bit of fun I decided I'd add a couple more examples of things you can do with the display.

The first couple of examples are displaying an image on the screen. One example is a picture of Mario and the other is the instructables robot. Code for these examples can be found here:


Both of these were drawn up in paint.net (setting the image size to be how many pixels I wanted, e.g. 64 x 32) and then converting the image using this converter: http://www.rinkydinkelectronics.com/t_imageconvert...

The last example is a more dynamic one, it uses my YouTube API library to display your live YouTube subscriber count on screen. Code for this example can be found here:


Hopefully you found this instructables useful. As mentioned at the start I think this is one of the most impressive displays available for an Arduino project at the moment. As always if you have any questions I would be happy to try help!

If you want to see more stuff from me:

Videos: Check out my YouTube channel for more Videos

Live Streams: I live stream working on electronics projects every Monday on Twitch

And I talk electronics and other random stuff on twitter - @witnessmenow

All the best!


Microcontroller Contest

Second Prize in the
Microcontroller Contest

3 People Made This Project!


  • Battery Powered Contest

    Battery Powered Contest
  • Plywood Challenge

    Plywood Challenge
  • Plastic Contest

    Plastic Contest

64 Discussions


Question 3 months ago

Hi Brian, very nice project!
I have a ESP8266, a ESP32 board and two matrix units P3 64x32.
The working matrix runs with both boards setting D and E "on".
But with the D1 board I had to add "MuxDelay" in the code, because some lines
where missing. The ESP32 board runs Tetris clock on that matrix.
The other matrix, from another seller, looks axactly like the first one, but I never
saw a LED lite. Ok, in the lower left corner there is a LED missing (got already a
refund). Tried different settings, but nothings helps. Measuring pin D and E gave
me something about 3 kohm to GND, strange.
Any sugestions?


5 months ago

I've recently bought a 64x32 unit (P3-(2121)-64x32-16S-D1.0) from amazon
uk and like many displays out there the 2x8 connectors were unmarked.
From what I have read, the general consensus is that unmarked 64x32
displays use the HUB75-D layout (see table). I am currently using a
Feather M4 express with an RGB matrix FeatherWing and programming in
Circuit Python. To power the RGBmatrix FeatherWing I am using a 2.4A supply which seems enough so far. To run the display you need to use 14 of the
Feather's pins. One of the things I have found is that if I am running a simple text scrolling program the display will run using just 3.3V from the Feather (I measured the voltage to confirm this).

I am slightly confused as to how / why you need to wire some connections from the panel output to the input when using a D1 mini.


Reply 5 months ago

quick update ... I am runiing the feather from a 1A power bank (display at 3.3v) and according to my USB Detector the current use is varying between 0.06A to 0.19A. I think that is pretty good


Question 7 months ago

I was able to get this up and working. Great tutorial! Is there a way to adjust the brightness? I would have thought that changing the RGB value for a specific color would change the brightness. Take green for example, 0,100,0 should be dimmer than 0,255,0. But I'm seeing no difference until I get to 0,19,0 in which case the green area disappears completely. Any thoughts?

Never mind, I just saw the line showing that display_draw_time can be used to adjust the brightness. The change is subtle but it does change. This will work well enough for my purposes. Just posting the update in case it can help someone else.


Question 7 months ago

Hi Brian, my name is Panus and i use RGB panel 32x16 with arduino uno as microcontroller for my final project. I have some questions that i want to ask
1. I have used the library and modified the code (change the CLK, OE, LAT' port number), but i have error about the Ticker.h. It said that Ticker.h does not exist. But when i download ticker library on Github, it was still error. It said that it need callback (i forget the full of error).
2. Is it possible to control the RGB Panel's brightness? I will explain about my project. i use LDR sensor to control RGB Panel's brightness, when lux value is high, the brightness is high. If lux value is low, the brightness is low.


Question 9 months ago on Introduction

hi , any chance that you have more D1 Mini Matrix Shield for sale


Answer 9 months ago

I am expecting parts for more stock to come next week, so I recomend signing up to be notified on Tindie!


9 months ago

Very nice project. I purchased a 32x32 P6 model. Listing says it is 1/8 scan. I measure and my E pin is ground, so I connected A-D as per your diagram and set it as PxMATRIX display(32,32,P_LAT, P_OE,P_A,P_B,P_C,P_D);. I am getting one of the pixel flashing blue in the last column when I upload the firmware and a few very brief blue flashes when the sketch starts. Any ideas what I should be changing?


Question 1 year ago

hi Brain,am using three 32x32 P6 panels with PxMatrix.h and esp8266 and configured the program as usual,as width 128 and height 32. but while running the program am getting only red color and am not getting other colors.
if am using four 32x32 P6 panels the data which is on first line of every panel will be skipping down by 8 leds.

Answer 9 months ago

Hi, did you manage to resolve this? I also have a 32x32 P6. I figured that E is ground and does not need to be connected. So I am using definition PxMATRIX display(32,32,P_LAT, P_OE,P_A,P_B,P_C,P_D); and 1/8 scan line. But nothing gets display. A single blue flashes when I upload the firmware. Did you get this working for yours?


Question 10 months ago on Step 7

I have a 32x64 display & I am using pixeltime.ino to use the display.
It lit the pixels, but not in the sequence you mentioned.
According to this blog, it should 1st turn ON the LEDs of 1st row, in group of 8 LEDs, & then that of row 9th or 17th, depending on the scan rate of the display. Right ?

But, with me, its not the case.
Instead, the sequence in my case is:
Row 1: 1st set of 8 pixels -> 2nd set of 8 pixels
Row 9: 1st set of 8 pixels -> 2nd set of 8 pixels
Row 1: 3rd set of 8 pixels -> 4th set of 8 pixels
Row 9: 3rd set of 8 pixels -> 4th set of 8 pixels and continue until the all the LEDs in the 1st & 9th row is ON.
It then continues the above mentioned sequence with Rows 17th & 25th.

Can you figure out what should be wrong in my setup ?
I have attached a link below to show you mentioned LED sequence. Hope it helps.
I am testing Pattern_test.ino, not pixeltime.ino.


Answer 9 months ago

This looks like you need to be using the C and D lines as described above.


Reply 9 months ago

Hi doug.gaff,
Thanks for your reply.

I have updated my question. I am testing Pattern_test.ino, not pixeltime.ino.

For pixeltime.ino example, Initially the display was not printing "Pixel", mentioned in setup(). Instead it was only printing "Time".
I changed text color of "Pixel" to myMAGENTA, & it worked.
It also displays "Welcome to PxMatrix!"

But after that, it can't display 'weather_icon' properly.
According to this blog, it should print some lines in 3 different colors, Red, Green and Blue.
But my set up displays just few lines in Red color only.
I have attached 2 images for your reference, where one image shows expected result & the 2nd one shows result from my setup.

Do you have any idea, what should be wrong with the setup ?


Reply 9 months ago

Sorry, I'm not sure why that's happening. I just got my display working, and I'm not sure what the failure cases are yet. Things I've had to play with: 1) The C, D, and E lines - make sure I've connected the ones required for my panel and then updated the constructor call to match my setup, e.g. PxMATRIX display(64,32,P_LAT, P_OE,P_A,P_B,P_C,P_D); and 2) making sure the display.begin(16); is correct. For my panel, it needs to be 16.


9 months ago

Great project! I just finished assembling it and trying out your sample programs. I'm getting a really weird flickering, though, as seen in the video below. Any guess on the cause of this?



Question 1 year ago

Hey, just made my P5 64x32 display work, thanks to you and 2Dom!
Anyway, what about power consumption? I get 1.35 A with all LEDs in white at maximum brightness, which is quite low. It’s not possible to get the LEDs even more bright? It was rated for several amps at full power…

EDIT: Tweaked my program and I now get a bit more than 3.55 A so not that bad! It’s quite bright!


Answer 10 months ago

I‘m having the Same issue. How did you Fix your Problem?


10 months ago

hi!, nice project !
I bought matrix shield v1.3. I get a bit lost. Have a 64*64 panel ( https://nl.aliexpress.com/item/33043875146.html?sp... ) Output is like on the picture. I read you're instructions.......[quote]Although my display is a 1/16 display and I needed to for E connected up...... [/quote] using youre shield, should i add some extra connections to ground ? thanks !


1 year ago

I want to create a 128x64 display out of 4x 64x32 LED Panels.
But it will not work.
displays stay black
Any sugestions?

Poppy Ann
Poppy Ann

Reply 1 year ago

Hi there, did you ever manage to get your panels working correctly? I am about to try the same project once my panels arrive I ordered 4 of 32x64 and want to have them set up as a 128x64 display mine is not for any commercial use just for a sign in my window or a sign in the rear window of my car if you managed to sort out your sign could you give me any pointers?

Regards Poppy Ann.