Home Cockpit Pt.2: many IOs

I counted the number of IO Pins that I need for all the display,LEDs, buttons and switches. Without additional chips it would be: 57 input and 32 output. That’s too much, even for a Mega2560. So I was thinking about various options like…

* master-slave 2 or more Atmega controllers
* separate controllers for in and out, each with it’s own USB
* shift registers (74LS164 or 74HC595) for output
* matrix for in & out
* MAX7219 for up to 64 LEDs in a matrix

Here’s my plan:
I use 2 shift-register ICs for all the Data & CE lines of the alphanumeric display
and connect A0, A1 and WR of the display direct to the controller.
I use a MAX7219 for all LEDs.
Result: a total of 8 output pins of the microcontroller.

I want to connect all 6 rotaray encoders directly to the microcontroller to get the best
timing, so 12 input lines for that.
For the remaining buttons & switches I use a 8×6 matrix (with 45 diodes)
To scan the 8 rows I want to use a 1-out-of-8 (3bit) binary decoder chip
Result: a total of 21 pins used for input.

With 4 additional chips I reduced the amount of needed IO pins from 89 to 29.
With the MAX7219 I have the option of adding many more LEDs If I want and on the input side I can still add 3 more switches or buttons to the matrix.

When using only one microcontoller (the Atmega32 has 30 IO + TX & RX) then I can update the display quickly when I turn the rotaries without communicating with Flightgear immediately.
I hope that USB serial is enough for everything that I want and there is no need for USB HID for this device.

Yesterday I had the good(?) idea to use 4 shift registers instead of
2 shift registers + MAX7219. So I started to build a board with 4 x 74HC595 with all 32 outputs going to a 34-pin connector where I’ll plug in a ribbon cable. After finishig my board it came to my mind again what knew already but did forget:

* the max. output current of the 74HC595 is very limited (75mA per chip, 35mA per output)
* I’ll need a resistor for every LED – (which is not the case with the MAX7219)

I might get away with it because I tried a red LED with 475 ohms to 5V: It is not very bright, but needs only 6,5mA this way.
I can’t use low current LEDs because they are all integrated in the buttons.

Leave a Reply