EveryCircuit
Powering up...
Circuit
Public
Private
Unlisted
Save

Using analogRead for many buttons

@cygig
3 years ago
https://everycircuit.com/circuit/6430904911921152
Here are two ways to read the voltage to determine which button was pressed. On the top, current takes the shortest path so only one button will be registered by design. It is also cheaper to use many resistors of the same value. On the bottom,it is possible to detect combination presses: Button Press - Voltage / 10-Bit ADC (0-1023) / 12-Bit ADC (0-4095) ---------- Button 25K - 4V / 818 / 3276 Button 50K - 3.33V / 681 / 2727 Button 100K - 2.5V / 511 / 2047 Button 200K - 1.67V / 341 / 1367 Button 400K - 1V / 204 / 819 Button 25/50K - 4.29V / 877 / 3513 Button 25/50/100K - 4.38V / 896 / 3587 Button 25/50/100/200K - 4.41V / 902 / 3611 Button 25/50/100/200/400K - 4.43V / 906 / 3628 Button 50/100K - 3.75V / 767 / 3071 Button 50/100/200K - 3.89V / 795 / 3185 Button 50/100/200/400K - 3.95V / 808 / 3235 Button 100/200K - 3V / 613 / 2457 Button 100/200/400K - 3.18V / 650 / 2604 Button 200/400K - 2.14V / 437 / 1752 Arranged from low to high: Button 400K - 1V / 204 / 819 Button 200K - 1.67V / 341 / 1367 Button 200/400K - 2.14V / 437 / 1752 Button 100K - 2.5V / 511 / 2047 Button 100/200K - 3V / 613 / 2457 Button 100/200/400K - 3.18V / 650 / 2604 Button 50K - 3.33V / 681 / 2727 Button 50/100K - 3.75V / 767 / 3071 Button 50/100/200K - 3.89V / 795 / 3185 Button 50/100/200/400K - 3.95V / 808 / 3235 Button 25K - 4V / 818 / 3276 Button 25/50K - 4.29V / 877 / 3513 Button 25/50/100K - 4.38V / 896 / 3587 Button 25/50/100/200K - 4.41V / 902 / 3611 Button 25/50/100/200/400K - 4.43V / 906 / 3628 With the exception of the last three of the 10-bits ADC result, the other values are 10 values or more apart.
Comments
Post