The holidays are finally drifting towards the end, so it’s time to start doing some stuff. I’m slowly preparing a couple of instructables dealing with multiplexing. The first one will cover the basics and provide an example using Arduino only; the second one will deal with creating big matrices with LED drivers.
Truth to tell, I though the first one will be a quick stroll, as it’s less complex than the LED drivers one. In fact, the opposite is true. While LED drivers are specifically designed for multiplexing, the Arduino is most certainly not, and trying to multiplex its 6 PWM output is a real headache.
Most notably due to one of the timers being 16-bit on an 8-bit microcontroller, which means it’s not synchronized with the other two.(*) And all three are needed to control 6 PWM outputs.
It would have been easier to limit the multiplexing experiment to one row of RGB LEDs (like, 8 of them), thus utilizing only three PWM outputs and two 8-bit timers. And this would have been pretty ok for demonstration purposes. But it’s a lot more interesting to solve the problem of actually syncing all PWM outputs some way, so I guess the instructable will take some time to write (considering I have to do some paid work too).
(*) UPDATE: As is happens, it was my own screw-up: I forgot to keep the WGM12 bit intact while setting the prescaler in the TCCR1B register. The timers on Arduino are pre-set to different PWM modes, hence the difference in base frequency in some references. If the 16-bit timer is set to 8-bit PWM, in synches perfectly with the right prescaler. Details in the next post.