Electronic – arduino – Is it Possible to control LED with arudino pins combined with PWM from IC

arduinoledmultiplexerpwm

What I'm looking to make is a multiplexed 16×16 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 8×8 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 8×8 I can do on the board, if I wanted to do a 16×16 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?

Thanks!

Best Answer

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