[sdiy] Microchip PIC 5 x 4 matrix

rsdio at audiobanshee.com rsdio at audiobanshee.com
Wed Oct 7 21:03:14 CEST 2015

I think you should be able to accomplish your project with the PIC16F88.

However, my first reaction when seeing that circuit is that I don't understand how the button reading can work. Maybe I'm missing something, but with RBx OUT=1 and the 10k pull-up to +5vdc, there would be no difference whether the switch is open or closed.

Minor criticisms are that the 100 ohm current-limiting resistor should be on the LED path, possibly instead of the extraneous diode, but not the switch path.

As for your project, you might want to consider LED brightness. With a 5 x 4 matrix, your maximum LED pulse width will be 1/5 or 1/4. You can get better duty cycle, and potentially simpler code, by arranging an 8 x 3 matrix. Of course, that allows 24 buttons and LEDs, which is more than you need, but it also allows a pulse width of 1/3, which will be a little brighter for the same current. The PIC can handle 25 mA, which is more than most LEDs can handle at DC, but perhaps less than your LEDs can handle under PWM. Another disadvantage is that 8x3 takes two more GPIO pins (11) than 5x4 (9), but it might be worth squeezing things in. There should still be one spare GPIO for other uses. I'm assuming two pins for the crystal and two pins for MIDI I/O. You'd have a second spare GPIO if you don't implement MIDI In.

Another good chip to consider is the PIC18F24K50, in my opinion, but you already have the PIC16F88.


On Oct 7, 2015, at 6:52 AM, Jean-Pierre Desrochers <jpdesroc at oricom.ca> wrote:
> I'm about to build a MIDI foot controller
> using around 20 normally open footswitches
> with there respective state LEDs.
> I have a bunch of PIC16F88 micros and want
> to use one for this project using as less pins as possible.
> (9 pins for the matrix)
> I figured out a way to read and feed all switches
> and LEDs this way:
> http://www.arcenson.com/public/PIC16F88_5x4_matrix.JPG
> All the switches and LEDs will be processed one after each other
> in an endless loop..
> RB5 will send the MIDI data.
> Does anybody see something I forgot in that drawing ?
> I'm not home and will try it tonight.

More information about the Synth-diy mailing list