What I'm looking to make is a multiplexed 16x16 LED grid with with 2-bits of brightness (aka 4 levels of brightness). There might be a better way to do this.

I've built a prototype 8x8 grid with an Arduino Nano, it works great. I have 8 pins to connect the anodes and 8 pins to the cathodes. I'm using 3v 20ma 5mm LEDs

But, since arduino only has 6 PWM pins, i can't get the resolution I want. I'm looking to get more pwm pins

I'm looking at the ADAFRUIT 24-CHANNEL 12-BIT PWM LED DRIVER, which gives 24 pins of PWM over SPI. While 8x8 I can do on the board, if I wanted to do a 16x16 matrix while connected to the Arduino. Is it possible to use pins from the LED driver to run the anodes (16 of the 24 pins) with PWM while using 16 GPIO pins on the arduino to run the cathodes (to get more pins for multiplexing)? From my experiments, only the anode needs PWM while the cathode just needs to be high or low for multiplexing. Would the VCC for the Driver need to come from a power supply?


  • \$\begingroup\$ That sounds like it should work okay. If you need more cathodes you could use a similar sort of "port expander" for the cathodes too. \$\endgroup\$ Commented Jul 11, 2018 at 23:56
  • \$\begingroup\$ @immibis ok cool! Thank you. I'm totally aware I need to rework the driver. I was just making sure that using a HIGH/LOW on the arduino would work with a board operating on it's SPI channel. I figured it would work since they all share a common ground, I just wanted to make sure. If this question is too specific, please feel free to vote to remove/close. I'll add the schematic once it is done to this question \$\endgroup\$
    – Dani
    Commented Jul 11, 2018 at 23:59
  • \$\begingroup\$ @immibis just edited the question to be more general. \$\endgroup\$
    – Dani
    Commented Jul 12, 2018 at 0:03

1 Answer 1


When you make a grid of LEDs that need to be multiplexed you will not be able to make PWM work to set the brightness level for each and every LED. The reason being that the multiplexing is already chopping each LEDs visible time to some low duty cycle. With your 8x8 grid that already means that each LED is only ON for 1/8 of the time.

If PWM were to have any meaningful effect during the interval that the LED is on it would have to (a) be synchronized with the multiplexing rate and (b) be running some factor faster than the multiplex rate. Since you already want the multiplex rate to be quite fast so the LEDs do not look like they are flickering it seems like PWM idea is not going to be particularly useful.

I think a better approach will be to run your matrix row multiplex anodes with a transistor that pulls the LED anodes to the supply rail. Then have two sets of column bits, each one with a different sized resistor selected so that the two column bits can set the 4 possible combinations of the series resistors to GND. This will let each LED on time have a current setting suitable for the brightness selection for that LED. (Interestingly you will want to probably support an LED off state so in reality with two sets of column bits you would only really get three possible brightness levels).

Another couple of things to keep in mind:

  1. When multiplexing LEDs where they end up having a low duty cycle like 1/8 it is necessary to over drive the LEDs at greater current than their nominal steady state current.
  2. You could foreseeably use three sets of column bits to get to 7 total brightness levels plus the off level.
  3. LED brightness is not linear with duty cycle.

This shows the concept in schematic form:

enter image description here

  • \$\begingroup\$ Clever approach! Makes sense ill try it out!!!! \$\endgroup\$
    – Dani
    Commented Jul 12, 2018 at 1:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.