Where to start with multiplexing? or bit addressing?

I believe in order to control large amounts of LEDS...

you need to 'multiplex'? or use shift registers (or something?)

Is there any BASIC tutorials or articles on getting into this?

I am 'not' looking for advanced articles.. where they throw out chip acronyms used..etc.. (as that would mean nothing to me)

simple parts lists.. and an overview of the topic and implementation wold be great!


Is there a limit of the number of LEDS you can individually control/address? (is this based on the shift register chip of choice?)

is multiplexing the 'word/verb' of this action? (driving multiple leds) and shift register is a physical component to be used 'in' multiplexing?


if I had say 3 leds I wanted to control with ONE pin.. where does one start? (I know you can use 3 separate pins....but wanted to use 3 leds to keep confusion low when talking about multiplexing on one pin)

also Im assuming that if one wanted to 'multiplex' with RGB leds..you would use 3 pwm pins..




Edit: Okay that may be a little more advanced then you may be looking for. I"ll keep looking

To understand the principals try this:- http://www.thebox.myzen.co.uk/Workshop/LED_Matrix.html

For a 4 by 4 example of an RGB Matrix look at this:- http://www.thebox.myzen.co.uk/Hardware/Mini_Monome.html

Finally for an 8 by 8 matrix try this:- http://www.thebox.myzen.co.uk/Hardware/Hexome.html It will also give you an indication of the amount of wiring involved.

I've described the process several times.

Say you have 16 LEDs, arranged as 4 rows and 4 columns. You wire your matrix with 4 anodes in each column connected, and 4 cathodes in each row connected. 4 arduino outputs go to current limit resistors to the 4 anodes. Values selected so that 8mA can flow. 4 arduino outputs go to the cathodes. Your data to be displayed is stored in a 4x4 array

Write a loop that does this: start with all 4 anode outputs low, and all 4 cathode outputs high. output the anode pattern for row 1, high will be On, data is from array row 1. output a 0 for cathode output 1 for some number of mS, this will light up the LEDs. If 4 LEDs were on, the arduino would sink 32mA. output a 1 for cathode output 1 to turn off the LEDs.

repeat for rows 2, 3, 4

check if the array needs updating

repeat the updates.

You can be smart about it, do a blink-without-delay loop, each pass thru loop see if your on time has elapsed, and if not check for other stuff that may have occurred and update the data array.

tanks for the replies..

before I started reading the links..

coupdl questions to make sure Im on the same/correct path..

1.) this would be more STRIP related than 'MATRIX/CUBE'.... (for the project/demo).. does that matter? same principle applies? 2.) I didnt see any mention of shift registers? and the comments mentioned using 8 x I/O pins from the Arduino? How do you save I/O pins and run.drive more leds from less/one pin?

1 I/O pin per 2 leds doesnt seem very 'convenient??

3.) what if the LEDS used need/require more than only 8mA? more like to the normal 15-25 range?

the project/demo I had in mind is to play with an animated LED strip.. (well plain led strip..I want to animate it) LOL

same info above applies...yes?

Thanks again.. I'll check out links.. (and re-read what crossroads posted.. a few times!....lol)

1.) this would be more STRIP related than 'MATRIX/CUBE'.... (for the project/demo).. does that matter? same principle applies?

No, it is the same it dosn't matter how you physically arrange the LEDs.

I didnt see any mention of shift registers?

They are just one way of getting extra outputs, they are not essential.

1 I/O pin per 2 leds doesnt seem very 'convenient??

Sorry don't know what you are on about here.

what if the LEDS used need/require more than only 8mA?

You use LED drivers, direct connection to a shift register is a bit babyish.

Hello Grumpy_Mike-

thanks for the reply..

re: shift registers-

not essential.. ifyou wanted to drive/have more leds that you have I/O pins available.. then needed yes? or are you saying you can add more leds on 1 i?o pin of the Arduino?

In CorssRoads post..

he mentions using 4 pins (each) for Anode and cathode

4 arduino outputs go to current limit resistors to the 4 anodes. Values selected so that 8mA can flow. 4 arduino outputs go to the cathodes.

which essentially takes up 8 pins of the Arduino.. yes? giving me a total of only 16 leds though.. yes?

ie: 2 leds per Arduino I/O pin?

for each row or column.. there needs to be another I/O pin on the Arduino used.. correct?

if you were using only 2 Arduino PWM output pins (1 for resistor >> anode) and (1 or cathode).. you could only have 2 leds...correct?

So in this project/theory.. you would need to use a shift register chip....yes? (which Im not against... except now I read you called it babyish!) LOL..

which by that I think your saying not the best/most professional approach? (for actually driving/powering the leds?..how would you otherwise do it? with that many leds?) space IS a concern... would these drivers be needed for each led? or segment of led array?

sorry totally clueless about how one would go about wiring this all up?

my project will involve ALOT of LEDS.. IMHO..if I had to guess.. Id say 2 x separate strings of 40 leds each.. (80 total?)

these would be HB SMD leds.. (1206 footprint/package).... not sure yet though.. might just be an odd 4mm HB oval leds I have laying around too)

Im assuming this is way to much for the Arduino to handle by itself....and would require an 'shift register'...?


Are there other (small) shift register chips out there besides the: 74HC595 that only gives (I think) 8 outputs for leds?

It is connecting LEDs directly to a logic shift register which is a bit babyish.

A shift register is only one way of getting more output lines from an arduino. There are lots of others. A TLC5940 is another good chip for driving LEDs and there are plenty of similar ones.

Please explain what you mean by "animated LED strip"

This kind of thing? ![](http://i.ebayimg.com/00/s/MzYwWDM2MA==/$(KGrHqJ,!iQE5fbSLsPfBO,QEZQJH!~~60_1.JPG)

Or this kind of thing?

it would be option A

just a 'plain strip' of leds... that "I" animate myself through Arduino/code.

I suppose I would have to solder them myself...(make my own 'strip')

since Im currently un-sure of the space/length I'll need.. (either 1 long strip..or two separate strips)

*Im not sure if just doing one long 'string' of leds would be the best... (since I need to basically make a 'circle')..

if I can target any led at any time.. shouldnt matter if I kept it all 1 long string/array? would it?

I dont have a clue on how to drive that many (external driver) but thats new to me more or less..(Grumpy Mike suggested something to look at I believe)

space is an issue as I'll be cramming this stuff into a mod'd toy more or less.. (in theory this is what Id be doing.. just talking about the stuff Id need to learn first!) lol


So you've got 18 LEDs, 20 I/O pins, space is tight: add 18 current limit resistors and drive them all directly.


Im hoping to NOT use all/most of my I/O pins..

so it leaves room to do extra 'activities'...etc..

(which is why I was asking about shift registers..or adding the support to individually control/target leds using only a few pins.. or daisy chaining these 'shift registers')

Im thinking I'll need some sort os mess..more pins that just 2.. (to keep the amount of shift registers used as well)

reading some of the links provided.. Im actually looking forward to trying to play with the 0001010110 style of turning on/off leds..

is that referred to as 'matrix style'?

is that referred to as ‘matrix style’?

A matrix controls LEDs by columns and rows. This is just bit addressing.

ahh.. ok, so bit addressing is what I need to look into more..yes?

Also..(just for note].. the 18 leds in the image above is just for visual..

there would be alot more I believe.. somewhere around 40-80 I believe.. (if two strips.. 40 each..if one lone strip 80 total I believe)

Anyone recommend or know of a good link to start reading up on this bit addressing?

Start here:- http://www.arduino.cc/playground/Code/BitMath

Here’s a 1x80 strip using shift registers.

Thanks Grumpy_Mike and CrossRoads-

the bitmath link was a nice read..

and thanks for the diagram CR.. (a bit over my head.. but looking at those schematics arent as scary as they used to be!.. used to be they were so 'busy' it was a HUGE turn off and very demotivating.. now I can sorta follow..just dont always understand hat is being done on some things or need verification on what a certain trace is going or what part is what)

I found this: http://arduino.cc/playground/Main/MAX72XXHardware

one chip..can drive 64 leds...etc

(again sorry Im 'so' bad at hardware)

I understand a 'driver' is just a board/chip that 'drives' the led(s) with the correct power.. right? nothing more? So that 'driver' linked above would be used only for supply enough power to my SMD leds.. (whatever the final count ends up being).. Id use or two of those chips..etc

however I still need to use/find a shift register.. (cause these are NOT the same..right?.. that driver chips can do shift register stuff?

I think Im still getting confused on the led strip.. vs a 'matrix' (which I understand uses columns/rows to target the specific led)

and I read the article that using a 8 bit array to turn on/off leds 01100010 (direct bit addressing..etc)

but Im missing a real world example to put it all together.. even on a small scale.

Would I search here for bit math? or bit addressing? to see others experiences before me? maybe seem some small diagrams/examples..etc


dang.. thats a serious schematic for a noob to take in! LOL

Max 7221 is a nice chip, I use it to drive eight 7-segment displays here. Has built in multiplex/control register. You do an SPI transfer to a byte, the 1's in that byte light up the matching LEDs.

Schematic is not tough - just 8 of the same thing. 3 control lines in, power, ground, couple of static lines, and the 8 LEDs. Don't let it get to you.

(shot across the length of my house, about 30') Digits are ~40mm x 80mm.

Here''s the '7219 & wiring to headers, parallel cable to the digit boards. Use a yellow highlighter to show what you have connected as you go.

The empty looking sockets on the middle board are the socket strips I used as headers. Got a duemilaove temporarily wired in here while waiting for a promini to arrive: