1-wire keyboard

1-wire keyboard is a simple tool for calculating the resistors for a keyboard/resistor network on an A/D input.


1 Wire Keyboard (or analog keyboard) Calculator (1-Wire Keyboard) is a tool for embedded system designers to implement a keyboard or keypad using a single analog to digital converter (A/D) input. For larger keyboards, or keypads that require chording (more than one key pressed at a time) multiple A/D inputs can be used, each with a portion of your complete keypad.


NEW FEATURE IN BETA TEST: There is a new ‘Generate Code’ button. After you have Named your keys, optimized your key placement and resistors, you can generate a C function to decode your keyboard. Testing is still on-going. Please give me feedback if you have used this feature and if it worked for you. The current version doesn’t check key names for uniqueness or proper C variable syntax. If your embedded compiler does not support a startup file that does initialization of variables at startup, your will have to change 2 lines and add the initialization as described in the comments of the generated code. Fixed const declaration bugs in generated C code in version 1.1.2b.


1-Wire Keyboard supports from two (2) to 64 key keyboards, however; keyboards beyond 26 keys may be hard to realize with a single A/D input. 1-Wire keyboards offer lower EMI than scanned keyboards, and need fewer ESD protection components to implement, and also only require just one pin on a microcontroller. If minimizing current consumption is a concern the ground can be replaced with a second pin on the microcontroller configured as an open drain output. The software can protect against excessively long key presses by allowing that pin to float except when reading the keypad.


Enter your keyboard size at the top left with the number of rows and columns needed. This will give you a rectangular array of keys, some of which you may not need. Control clicking (right clicking) on a key will remove or add that key.


Near the middle top is your A/D converter specifications. Make sure you enter the worst case A/D count error in the A/D accuracy field. This is often a sum of several error contributors on the data sheet. Make sure you are entering ‘counts’ and not ‘bits’ or you will be make your job a lot harder. The last field is the maximum allowable A/D input impedance. This will be, for no key pressed, the maximum allowable resistor from the array to Vref.


At the right is the specifications for the family of resistors you want to use. The popup selects the set of values and fills in the typical tolerance. You can then change the tolerance if you need to. The default temperature coefficient is 100ppm; you may need to adjust this based on what and who’s resistors you pick. You may want to adjust this if your first attempt fails because you could use Panasonic’s 1% ERJ family, it has 100ppm at high and low values, but from 100 ohms to 100k ohms it is 50ppm. Some other manufacturers may also have this characteristic. This could help solve overlapping A/D ranges for keys on some larger key count designs. Be sure to adjust the temperature range for your application.


If your keyboard is small you may want to try to get away with just three different resistor values, so leave the default radio button ‘minimum number of values’ selected. If your keyboard is more than eight (8) or so keys you will likely need to select ‘Enhanced distinction between keys.’ Now click ‘Find Resistor Values’.


With keyboards with many keys, you may see some pink highlighted keys. When A/D inaccuracy and resistors conspire against you, and some keys’ A/D ranges of a key overlap another key you can try selecting ‘Enhanced distinction between keys’. This may do the trick, as below, in this 16 key example, but for larger keyboards you may need to do some additional work. If you choose, you may also name the keys as on the right below.

Let’s take a little larger keyboard, for example, of 20 keys. You may need to remove adjacent keys (right click on the key) and expand your array size to recover the lost keys. A 4x7 array with some offending keys (keys with possible non-unique A/D values) removed will give you your 20 keys with one to spare. To help figure out which key to remove, you can click on a pair of keys and see their worst case delta in the ‘A/D delta’ field at the bottom of the window. As long as you have a delta of one or more, those two keys are fine. If your keyboard arranges keys in circles, you can use my Device Placer to place the keys.

Download 1 Wire Keyboard CalculatorX.zip 1.12b for Macintosh1-wire_keyboard_files/1%20Wire%20Keyboard%20CalculatorX.zip
email me.mailto:knotinweb@speakeasy.net?subject=1-wire%20keyboard

See an example schematic in Capilano’s DesignWorks on my Schematics page, click here.

Home > Robert_Rau.html
Electronics >Electronics.html

1-wire keyboard

Download 1 Wire Keyboard CalculatorWIN.zip 1.12b for Windows1-wire_keyboard_files/1%20Wire%20Keyboard%20CalculatorWIN.exe.zip

Visit my other pages:

Electronic Design ToolsElectronics.html
Rocketry ApplicationsRocketry.html
Green LivingEco.html
RailroadsTrains.html
Engineering Links for softwareLinks.html
SchematicsSchematics.html

Above are pictures of one of my test keypads. The protoboard on the right has the eight resistors and connector for the keypad. Since the key layout is the same as a scanned keypad, a standard off-the-shelf membrane keypad was used. Although this protoboard has a three pin connector, I only needed two wires between my keypad and my main board, ground and the array output, then the pull-up resistor to the 3.3 volts was on my main board. I also needed only one EDS protection device.