Electronic – What’s the maximum number of outputs you can control from a microcontroller with n outputs


Been pondering this for a while, and I think it's \$2^{(n-1)}\$ outputs.

If I have 5 outputs, I'll use 1 as the signal, and the other 4 as control lines to cascaded decoders, which gets me 16 outputs. This grows exponentially, so it's fine with microcontrollers with more than say 4 outputs.

But what about microcontrollers with limited outputs (eg. 4). Are you limited to only 8 outputs here?


The project is to drive a variable brightness (PWM controlled) LED array of 32 x 4 from a single microcontroller with a limited number of outputs (4). I am wondering whether the complexity involved in this is not worth the effort, and whether to instead use a microcontroller with more outputs.

Best Answer

It depends on what you mean by "control". Are you confining yourself to simple combinatorial logic, or are serial protocols allowed?

In theory, you could control an arbitrary number of outputs from a single pin by using something like the Dallas/Maxim 1-wire (serial) protocol to drive a set of I/O expander chips. Similar approaches can be used with I2C, SPI, or simple shift registers, each of which would require a minimum of 2 pins.