Extra microcontroller

Putting an extra microcontroller on your project can be an expensive option. Some of the smaller PICs only cost 0.40$, but they don’t have enough pins to scan a decent sized matrix. There is a pretty sharp increase after you leave the 8 pin microcontrollers, and the PICs jump to 0.90$ and the Atmels to 1.40$ or so. This gets you around 18 pins, which can scan an 8×8 matrix. This method is only really encouraged for the case of having 1 or 2 free microcontroller pins to pipe a large matrix into.

But, with the added cost you get a large jump in processing ability. The extra microcontroller can do all of the switch scanning, or other I/O reading, and then just pass the data to the main processor over whatever serial protocol you prefer. This is how most audio effects pedals work. There is one microcontroller that handles the user interface, and then another larger processor, often a DSP, which manipulates the audio.

It is pretty straightforward to implement this method, as you merely connect the SPIs together, and then setup a scanning matrix with the switches. If you find your matrix is too large for the microcontroller you want to use, it’s usually less expensive to find a microcontroller with more pins, than it is to add more external ICs. Given that this is the case, the only real reason to use an external microcontroller is for reducing processing overhead on the main microcontroller. If your main microcontroller is running out of pins to scan a matrix, it’s probably cheaper to get a larger device than add another one.