A Four button Digital Input Board
Quite often in Electronics we need input from the user.
Despite touch screens being the norm, I believe tactile push buttons still have a place in the world.
They’re much cheaper. Easy to understand and implement.
But what’s the best way to get them into the uP?
Please, take a vote!
Lets take a look at some pros and cons for each:
Dedicated Digital Inputs
- Simple and cheap
- Multiple Touch
- Only one input per Input on uP
Multiplexed Digital Inputs
Uses the Rows and Columns approach to have row*column number of inputs.
- Simple & Cheap
- Allows higher input density and better utilisation of uP I/O
- No Multitouch. (This is due to the matrix setup, you can get false signals)
- Inefficient for low numbers of inputs. eg. 2 rows * 2 columns requires 4 inputs, why not just use dedicated digital inputs?
Analogue Multiplexed Digital Inputs
Uses an Analogue to Digital Converter (ADC) to determine what input was pushed.
- Requires only one input (ADC)
- Number of digital inputs depends on the ADC resolution
- Requires ADC on the uP
- Not easily interruptable
- Difficult to multi-touch
- Need to take into account resistor tolerances.
Personally, I believe if you have less than ~10 inputs, try to use an Analogue Multiplexed input method. This requires only one input pin. Downside is of course, is that you require a uP which has an ADC.
Less than 4 inputs, you can get away with Dedicated Digital Inputs, but only if you have ‘spare’ I/O. But lets face it! The more available I/O the better!
If you need more than 10 keys, say for a 12 or 16 keypad, then I suggest a Row/Col approach. You get better input density than the dedicated DI and you won’t get issues around the ADC not having a high enough resolution.
That’s my thought! What are yours?? Next I’ll write about whether we should Poll or use Interrupts for input detection! Stay Tuned