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. Arduino.cc 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. Arduino.cc 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: adafruit.com/editorialstandards

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 code.org, 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 7:30pm ET! To join, head over to YouTube and check out the show’s live chat and our Discord!

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

Join over 38,000+ makers on Adafruit’s Discord channels and be part of the community! http://adafru.it/discord

CircuitPython – The easiest way to program microcontrollers – CircuitPython.org


New Products – Adafruit Industries – Makers, hackers, artists, designers and engineers! — New Products 11/15/2024 Featuring Adafruit bq25185 USB / DC / Solar Charger with 3.3V Buck Board! (Video)

Python for Microcontrollers – Adafruit Daily — Python on Microcontrollers Newsletter: CircuitPython 9.2.1, What is DMA, PyConUS 2025 and More! #CircuitPython #Python #micropython @ThePSF @Raspberry_Pi

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

Adafruit IoT Monthly — Halloween, WiLo, and more!

Maker Business – Adafruit Daily — Checking in on Intel

Electronics – Adafruit Daily — Probe Compensation

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



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.