ASK AN EDUCATOR! “How do I choose resistors to match a multiplexed led matrix?”

Greg asks:

How do I choose resistors to match a multiplexed led matrix?

Great question and the answer is a little elusive. Let’s at the diagram for Adafruit’s 8×8 matrix:

As you might know, there are many ways to drive a LED Matrix, and we will assume you have an 8×8. The easiest is to drive it directly from your microcontroller using 8 pins for the anodes and 8 for the cathode. With this configuration you can individually control all 64 LEDs and have a variety of methods for switching them on and off. If you look at the I/O capability of your microcontroller you will notice that they are only capable of sinking ~30-40mA per pin. If you were to were to illuminate an entire row with a common cathode, you would draw ~160mA and blow out your controller.

First the math:

If you look at the spec sheet for Adafruit’s matrix, the LEDs have a Vf of 2.2V and draw 25mA. In order to properly illuminate them with a 5V supply you would need a 112ohm (120ohm is the closest without going below) resistor. R = (5V – 2.2V) / 0.025A = 112ohm.

The problem with using a 120ohm resistor in series with the anode of each column is that when you illuminate more then one row at a time, the current available for each LED decreases…so you will get an uneven illumination of the panel.

If you run the calculation for 8 LEDs in parallel, you would need 14ohm (15ohm is the closest without going over) resistors to deliver 25mA to each LED. The problem with this is that the voltage is going to increase across each diode when less then 8 are illuminated, and you would be drawing 200mA! Far more then your microcontroller can handle.

This brings us to our control theory:

Method 1:
Since you are multiplexing the LEDs you can take advantage your processors high speed by “scanning” the grid. With just your microcontroller, you can illuminate each LED with a 60hz refresh rate so you eyes dont see the flicker. You could implement an algorithm to scan from the top left to bottom right (just like a CRT). This would allow you to run an entire panel with relatively low current draw. has a good overview, although they are not using the scan method, and don’t forget the dropping resistors.

Method 2:
You can use your microcontroller to control more then one row at a time by controlling the anodes and cathodes with MOSFETs. This would allow for you to run your panel at even higher current ratings then the “constant on” current from the data sheet. You can change the duty-cycle controlling the rows to allow for ~100mA per diode. You will get a much higher brightness, and if you cycle them at >60hz, you eyes wont really notice the flicker. Here is a good example using 2n3906 and 2n2222 transistors.

Method 3:
You can also accommodate for the high current loads through the matrix by using a stand alone multiplexer. The IC allows you to isolate your microcontroller and allow you to take greater advantage of multiplexing by controlling more then one row at a time. has a list of tutorials as well for setting up a matrix using drivers.

I hope this has helped to answer your question and good luck with your matrix!

Don’t forget, everyone is invited to ask a question!

Click here!

“Ask an Educator” questions are answered by Adam Kemp, a high school teacher who has been teaching courses in Energy Systems, Systems Engineering, Robotics and Prototyping since 2005.

Adafruit publishes a wide range of writing and video content, including interviews and reporting on the maker market and the wider technology world. Our standards page is intended as a guide to best practices that Adafruit uses, as well as an outline of the ethical standards Adafruit aspires to. While Adafruit is not an independent journalistic institution, Adafruit strives to be a fair, informative, and positive voice within the community – check it out here:

Join Adafruit on Mastodon

Adafruit is on Mastodon, join in!

Stop breadboarding and soldering – start making immediately! Adafruit’s Circuit Playground is jam-packed with LEDs, sensors, buttons, alligator clip pads and more. Build projects with Circuit Playground in a few minutes with the drag-and-drop MakeCode programming site, learn computer science using the CS Discoveries class on, jump into CircuitPython to learn Python and hardware together, TinyGO, or even use the Arduino IDE. Circuit Playground Express is the newest and best Circuit Playground board, with support for CircuitPython, MakeCode, and Arduino. It has a powerful processor, 10 NeoPixels, mini speaker, InfraRed receive and transmit, two buttons, a switch, 14 alligator clip pads, and lots of sensors: capacitive touch, IR proximity, temperature, light, motion and sound. A whole wide world of electronics and coding is waiting for you, and it fits in the palm of your hand.

Have an amazing project to share? The Electronics Show and Tell is every Wednesday at 7pm ET! To join, head over to YouTube and check out the show’s live chat – we’ll post the link there.

Join us every Wednesday night at 8pm ET for Ask an Engineer!

Join over 36,000+ makers on Adafruit’s Discord channels and be part of the community!

CircuitPython – The easiest way to program microcontrollers –

Maker Business — “Packaging” chips in the US

Wearables — Enclosures help fight body humidity in costumes

Electronics — Transformers: More than meets the eye!

Python for Microcontrollers — Python on Microcontrollers Newsletter: Silicon Labs introduces CircuitPython support, and more! #CircuitPython #Python #micropython @ThePSF @Raspberry_Pi

Adafruit IoT Monthly — Guardian Robot, Weather-wise Umbrella Stand, and more!

Microsoft MakeCode — MakeCode Thank You!

EYE on NPI — Maxim’s Himalaya uSLIC Step-Down Power Module #EyeOnNPI @maximintegrated @digikey

New Products – Adafruit Industries – Makers, hackers, artists, designers and engineers! — #NewProds 7/19/23 Feat. Adafruit Matrix Portal S3 CircuitPython Powered Internet Display!

Get the only spam-free daily newsletter about wearables, running a "maker business", electronic tips and more! Subscribe at !

1 Comment

  1. Thanks, this was extremely helpful in understanding an issue I have been running into.

Sorry, the comment form is closed at this time.