I've found a few other designs that use resistor ladders:

https://www.avrfreaks.net/index.p...

http://tronixstuff.wordpress.com...

However, I haven't seen a formal analysis of what is the "optimal" choice in resistor values for a circuit like this:

Vcc | Rup |______________________ ADC | ----R1-------S1----| | | ----R2-------S2----| | | ----R3-------S3----| GND

So, for example, if button S1 is pressed, the voltage at the ADC is Vcc * R1/(R1+Rup), etc. There should be an optimal set of R values that spread the ADC values as much as possible (for both individual and combination presses).

I did a little bit of experimenting in a spreadsheet, and found that these values worked best:

Rup = 1

R1 = 2

R2 = 4

R3 = 8

A power-of-two configuration makes sense, but it uses less than half the available dynamic range of the ADC. The smallest interval difference is about 200mV (assuming 5V Vcc), requiring 5 bits of resolution. The software will measure the ADC and pick whatever one is closest. This should be enough, but I'm wondering if there's a way to do better, especially with more buttons. I would think there's a way to calculate the optimal values exactly.