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 enab...

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!

Teacher Notes

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

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

2 People Made This Project!


  • Made with Math Contest

    Made with Math Contest
  • Multi-Discipline Contest

    Multi-Discipline Contest
  • Robotics Contest

    Robotics Contest

45 Discussions


Question 7 weeks ago

Just received a RGB LED Matrix 64x32 panel, I bought it from Aliexpress from SRYLED seller. I don't know if the panel is defective or I am doing something incorrectly... the panel won't turn on certain parts of the screen. I have posted a photo for a better explanation. Is there any way I can fix this?
Any other who have idea about thia problem pls help me...

4 answers

Answer 4 days ago

same issue here. I have a nodeMcu v0.9 and tried all combination of Display Pins C, D, E (only C; only D; only E; C and D but not E; C, D and E - and so on). I also measured the possibly E and D Display Pins. But both are connected to Ground internally. I tried the PxMatrix library Version 1.3 and 1.2. I don't know what to do next :/ @witnessmenow Do you have any idea to this?


Answer 15 days ago

I use P2.5 and P3 it's like this . but no problem with P4


Answer 4 weeks ago

Having the same issue. Tried earthing the C d and E pins yet no difference.


4 weeks ago

The PXMatrix Library by 2Dom can no longer be compiled for ESP8266 (1.3.0), looks like it has been updated to support ESP32, and has lost compatibility with ESP8266 (Issue #126). ̶I̶f̶ ̶y̶o̶u̶ ̶s̶t̶i̶l̶l̶ ̶h̶a̶v̶e̶ ̶t̶h̶e̶ ̶o̶r̶i̶g̶i̶n̶a̶l̶ ̶l̶i̶b̶r̶a̶r̶i̶e̶s̶,̶ ̶p̶l̶e̶a̶s̶e̶ ̶a̶d̶d̶. Thank you. P.S.: Library version 1.2.0 can be compiled with ESP8266 (use library manager to regress version)


Question 8 weeks ago

Awesome tutorial, it worked like a charm. But now I have an issue: I wanna do an animation similar to the banana dance but with 19 frames. Obviously, using your method this lead to me running out of memory. So it seems I could circumvent this issue with the flash memory by using progmem. Is there any chance you could explain how to do this?


2 months ago

Awesome tutorial!!! Thanks a lot for your time!

I have a question, I have two RGBmatrix of 32x64, i want to join and get one of 64x64, and i have two questions:

- How can i wire it both? i don't found any schema of these connections
- The code i think should be something like:
PxMATRIX display(64,64,P_LAT, P_OE,P_A,P_B,P_C,P_D,P_E);
This will work?

Thanks a lot!


2 months ago

awesome. i am gonna try it


10 months ago

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

1 reply

Reply 3 months ago

yeah, am also using four 32x32 panels i.e, 128x32 but am getting only red colorand other colors are not....,
and you have to declare that the no of panels you are using, in the code as


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

3 months ago on Step 4

Birian, Have you tried the Morphing Clock from HariFun yet? If so did it work for you? I have been working on it for a week and all I get on the screen are the colons, between the hours and minutes and the ones between the minutes and seconds. I have watched your 3 hour video, and still cannot get the time on my 32x64 matrix. Thanks "lctexas@comcast.net"


Reply 3 months ago

I've gotten several of these matrix boards. It seems that the mounts are not always included. The ones I have are actually magnetic mounts.


Question 8 months 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!


1 year ago

if i want dot RGB 128x32 ,need to change the code? and how to connect RGB module 1 to RGB module 2

1 reply

Reply 10 months ago

It works.
Just change the settings:
PxMATRIX display(128,32,P_LAT, P_OE,P_A,P_B,P_C,P_D,P_E);


10 months ago

Great tutorial!
I had a few of these running on Raspberry Pi, but this is much leaner and faster.

Just wanted to mention for those who install the examples that you must comment the "display.displayTestPattern(70);" line and uncomment the "display.display(70);" line.
If not the example will stay in test pattern mode.

#ifdef ESP8266
// ISR for display refresh
void display_updater()
// display.displayTestPixel(70);