The LCD Screen I’m using uses a lot of pins. In fact, it takes up all the available inputs on an Arduino Duemilanove and even then you can’t use the SD card and Touch at the same time because the Duemilanove doesn’t have enough pins. I’m not really planning on using touch (at least yet) so I’m not too worried about that at least for now. There is the Arduino Mega which has a lot more inputs (and the LCD manufacturer does make a shield for it that lets you use everything) but I don’t own any of those yet and I own 3 Duemilanove. There is the possibility I may need a smaller screen, and if I do, I’ll buy the Mega Shield.
I came up with the idea to use a second Arduino, a Nano – and the MP3 shield they make for it for the audio. The Nano and its MP3 shield are tiny (and the MP3 shield is the same price for either the Nano or Duemilanove, and I use those for prototyping, so I needed a “production” Arduino anyway).
But the MP3 shield uses all but 5 of the digital inputs on the Nano. I’ll need to use 2 of those serial communications with the Arduino controlling the LCD, so that only leaves 3 inputs…
If I use a one-pin-to-one-input I need a lot more: each of the 3 LED button uses 2 (one for the switch and one for the LED itself), so that is 6. The rotary encoders use 2 each (one for forward, one for back) and there are 2 dials, so 4 pins total there. That’s 10. If I want to use the rotary encoder’s “push” function that’s 2 more. I really only need one of the rotary encoder’s push buttons, so let’s say 8 inputs and 3 outputs. I’m short by EIGHT PINS!
Now it turns out that you can use the analog pins (which are normally used for analog inputs like sensors) as digital using the Arduindo’s built-in Analog-to-Digital converter, and the Nano has 8 of them. Whew!, that gives me just enough pins: the 3 digital left over plus the 8 analog pins!
But even better, there is also a method to use a single analog pin and resistors to read a large number of buttons. That will save 2 or 3 pins (depending on if I wire the rotary encoder button to it as well, which I might not, just for simplicity in the wiring).
Between these two methods I should be down to a single analog input for the 3 buttons, 3 digital outputs for the LEDs, 4 digital inputs for the rotary encoders, and one digital input for the encoder button.
Any more inputs and I’ll need a 3rd Arduino or to use a multiplexer that will let me use a larger number of inputs with just a few Arduino pins. Whew!
Update: I realized I was considering the button LEDs inputs, when they are really outputs. I fixed that.