SparkFun Electronics Commentsurn:uuid:214d0e4e-f1b1-d287-ce26-ac5b4c9f82492024-03-18T22:08:37-06:00SparkFun ElectronicsByron J. on PRT-12080 - SparkFun VKey Voltage KeypadByron J.urn:uuid:9b1947c6-7efb-0160-4db6-d375bef0c5142015-10-30T14:31:35-06:00<p>There are a few things that you can check.<p>First, make sure you're declaring the Vkey library to match your power supply voltage in the sketch. The <code>VKey::FIVE</code> or <code>VKey::THREE</code> parameter, denepding if you're in a 5V or 3.3V power supply. Also doublecheck that your connections are secure -- that the buttons are soldered in neatly, and the power, ground and output connections are all solid. I recently chased my tail for a couple hours because an alligator clip was barely hanging on the end of its wire.</p><p>Second, use a volt meter or oscilloscope to verify that the power supply is stable and sensible. Measure both VDC and VAC. The DC reading should be close to the nominal rating (3.3V or 5V), and not wiggling around. The AC reading should be close to 0 -- an unstable supply will exhibit some AC voltage, and will wreak havoc with the VKey.</p><p>Third, with the voltmeter still in hand, exercise the keys, measure the output voltage, and compare the results with the <a href="https://learn.sparkfun.com/tutorials/vkey-voltage-keypad-hookup-guide/board-overview" rel="nofollow">table in the hookup guide</a>. While a key is held, the output voltage should be steady.</p><p>Finally, you might glean some clues if you bypass the library, and call <code>analogRead()</code> directly. Are the conversion values reasonably steady?</p></p>
AltoonaBound on PRT-12080 - SparkFun VKey Voltage KeypadAltoonaBoundurn:uuid:4ae861e8-873b-115b-93b3-53cc546db5dd2015-10-28T13:28:53-06:00<p>Not sure, but it seems like I have a defective one. Now it's emitting a 12 key while idle. Using the demo program, so nothing fancy is going on.</p>
AltoonaBound on PRT-12080 - SparkFun VKey Voltage KeypadAltoonaBoundurn:uuid:be1a0139-aaaf-4ce8-ae7a-4c66fba094ac2015-10-26T18:20:21-06:00<p>If I hold a key down, it should report the initial keypress and then ignore because the same key is being detected. Sometimes, if I hold down the 4 key, for instance, it returns a 3 and then bounces back and forth between 3s and 4s. It happens with other keys, too and it's always key and key-1. What's up with that?</p>
Byron J. on PRT-12080 - SparkFun VKey Voltage KeypadByron J.urn:uuid:5211b1a6-2865-35af-b49a-56106aa37dee2015-08-10T10:54:51-06:00<p>The button centers are on a 0.7" grid.</p>
AltoonaBound on PRT-12080 - SparkFun VKey Voltage KeypadAltoonaBoundurn:uuid:599f31e2-35dc-90a0-0f99-d33ef04b2d772015-08-04T10:26:47-06:00<p>What's the center-to-center spacing on the buttons?</p>
Jason Baker on PRT-12080 - SparkFun VKey Voltage KeypadJason Bakerurn:uuid:ec8fb292-91fe-ed56-6e82-1e1ca697f3822015-05-23T20:16:24-06:00<p>WARNING - there is no reverse voltage protection on this keypad, so be sure not to mix the supply pins. I, unfortunately, had to learn that the hard way...</p>
LightManCA on PRT-12080 - SparkFun VKey Voltage KeypadLightManCAurn:uuid:2ccaf10f-f35c-54ac-0e7b-f0b9b265ea8d2014-04-10T12:19:10-06:00<p>That sounds a lot more complicated!</p>
Customer #400194 on PRT-12080 - SparkFun VKey Voltage KeypadCustomer #400194urn:uuid:4d1e62e3-5bd2-4505-dc28-9bfff6f16e162014-03-19T07:48:31-06:00<p>It did not run correctly on any of my boards (Leonardo, Due). Thus, I dumped the library, determined the analogRead values for every key (which might be different per board), increase them a little bit (about 10 points) and use the following program adapted from DFrobot example code to use the five buttons on the Romeo, but added a threshold of 20, because the keyboard is noisy:<pre><code>int key=-1;
int oldkey=-1;
int adc_key_val [12] = {45,85,125,170,215,260,300,345,380,425,470,510};
int adc_key_in;
void setup()
{
Serial.begin(9600);
}
void loop(){
delay(50);
adc_key_in=analogRead(0);
key=get_key(adc_key_in);
if ((key != oldkey) && (key !=-1)){ Serial.println(key);}
oldkey=key;
}
int get_key(unsigned int input){
int k;
for (k=0; k<12; k++){
if (input<20){k=-1; return k;}
if (input<adc_key_val[k]){k=12-k; return k;}
if (k>=12){k=-1;return k;}
}
}
</code></pre></p>
SeeCat on PRT-12080 - SparkFun VKey Voltage KeypadSeeCaturn:uuid:f04ece41-1715-01be-26da-a5460d42806b2014-03-11T12:33:15-06:00<p>Replacing the original (5v) min/step/max of 17/40/496 with 18/42/522 did the trick; the keys all decode perfectly now. Wondering if there is a way to have the Arduino auto-calibrate itself so these settings could be generated automatically as part of initialization? Also curious why your development keyboard varied from my production keyboard so much since the divider circuit on both boards is coming from a well regulated 5v source.</p>
Byron J. on PRT-12080 - SparkFun VKey Voltage KeypadByron J.urn:uuid:5ebc2307-4879-867f-a4bb-77116d5a362e2014-03-11T11:28:54-06:00<p>Yeah...something doesn't quite jive there. You report a max reading of 504, we somehow both arrived at a max of 496. I just put your measurements into the spreadsheet, and here's the resulting table.<pre><code>18.9 min
42 step
Key # lower threshold mid point upper threshold
12 18.9 39.4 59.9
11 60.9 81.4 101.9
10 102.9 123.4 143.9
9 144.9 165.4 185.9
8 186.9 207.4 227.9
7 228.9 249.4 269.9
6 270.9 291.4 311.9
5 312.9 333.4 353.9
4 354.9 375.4 395.9
3 396.9 417.4 437.9
2 438.9 459.4 479.9
1 480.9 501.4 521.9
</code></pre><p>That gives me a min/step/max of 18/42/522. The values you measured are within 3 counts of the midpoint of each bin there, so you should be squarely within each.</p><p>Please give that a try.</p></p>
SeeCat on PRT-12080 - SparkFun VKey Voltage KeypadSeeCaturn:uuid:b1cf122f-1a27-4f5a-cd0a-759e6a9989822014-03-10T19:25:59-06:00<p>The results were about the same with min/step/max of 21/43/496. The ADC readings are as follows: No Key - 10, K1 - 504, K2 - 462, K3 - 420, K4 - 378, K5 - 336, K6 - 293, K7 - 251, K8 - 209, K9 - 166, K10 - 124, K11 - 82, K12 - 40. Plugging those into the spreadsheet and it shows min/step/max of 18.9/40/497.9 so I used 19/40/498 with similar results. Something still not right here.</p>
Byron J. on PRT-12080 - SparkFun VKey Voltage KeypadByron J.urn:uuid:e3db413d-656d-2786-07c0-ede7f3d3cc6f2014-03-10T13:58:22-06:00<p>It looks like your samples are spaced a little wider than the boards I used to get the firmware running.<p>In the calibration table, try the following values</p><ul>
<li>min = 21</li>
<li>step = 43</li>
<li>max = 496</li>
</ul><p>I just used the spreadsheet in the github repo called ADC.ods. Using your VDC measurements, I estimated the ADC value (ADC = (Vin/Vref)*1024), and plugged that into the spreadsheet.</p><p>You might get better values by using readAnalog() to capture the ADC value that each key yields, and putting those values into the green area of the spreadsheet. The min, step and max for those voltages show up in the light blue cells.</p></p>
SeeCat on PRT-12080 - SparkFun VKey Voltage KeypadSeeCaturn:uuid:5000c701-6d39-e039-c39c-31f321903c862014-03-05T21:21:34-07:00<p>Hooked this up and am having trouble with the default library settings. Basically the 1 key doesn't register a key press at all, 2 key reports as 1, 3 reports a 2, 4 reports 3, 5 reports 4. Then there is a gap (no 5 key), and the 6 key through 12 key work fine. I'm running this on a RedBoard with a measured Vcc of 4.987 volts. Looks like the VScaleKey table may need to be tweaked further for production variances. Here are the Vout readings for each key:
1 - 2.488v,
2 - 2.280v,
3 - 2.073v,
4 - 1.867v,
5 - 1.660v,
6 - 1.453v,
7 - 1.246v,
8 - 1.038v,
9 - 0.831v,
10 - 0.623v,
11 - 0.414v,
12 - 0.207v,
Open - 0.061v. Is anyone else having similar problems with this board?</p>
MarkFromNJ on PRT-12080 - SparkFun VKey Voltage KeypadMarkFromNJurn:uuid:de1cb2d5-8752-f668-4fd8-4680c51ce6772014-02-21T02:29:02-07:00<p>More than 20 years ago Microchip published an I/O app guide, a little 3x5in. sized printed pamphlet (remember those?) that was included with the development boards. Most of Microchip's business was low pin count parts back then, so I/O was at a premium. This guide showed how to get more bang from each I/O - using one I/O to drive 2 LEDs, PWM for DAC output, etc. This is very similar to one of those app note circuits except as I remember that one used a simple voltage divider rather than a current source. Funny how nothing ever really changes.</p>
Darduino on PRT-12080 - SparkFun VKey Voltage KeypadDarduinourn:uuid:060d4414-ec40-3595-b4a5-439698ce2bb22014-02-17T15:31:49-07:00<p>Just port the Arduino Library to NETMF (Netduino Board) with a KeyPress Event and synchronous ReadKey() method that will block until a key is pressed - I don't have the Keypad to test (but 90% sure it will work) so, am wondering if anybody have a Netduino and the Keypad to test the code for me before I upload it CodePlex</p>
BiOzZ420 on PRT-12080 - SparkFun VKey Voltage KeypadBiOzZ420urn:uuid:4e18d353-adc3-78d3-dc17-f0d527a1a7152014-02-16T01:21:05-07:00<p>if you remove the opamp current source it would work across all voltage ranges (the buffer can take) ... your comparing it against the supply voltage anyway so it would save a ton of pain!</p>
Customer #509371 on PRT-12080 - SparkFun VKey Voltage KeypadCustomer #509371urn:uuid:1b1de126-0bb3-5c1f-583e-259b9cd437bb2014-02-15T21:01:13-07:00<p>With 12 keys on analog voltage, I'm thinking: map the 12 tones of the musical scale for an analog keyboard/synth. There's a MIDI application in this. I want one.</p>
Byron J. on PRT-12080 - SparkFun VKey Voltage KeypadByron J.urn:uuid:df1fd65f-2576-a056-87fd-82883c417cd52014-02-14T16:40:52-07:00<p>Like many things in engineering, the temperature dependence was a tradeoff, so this can have a relatively constant output voltage regardless of the supply voltage (granted, around room temperature).<p>If we can constrain the problem to a single supply voltage, then a simple resistor divider could be used to set the current. Or we could forward bias the diode more strongly -- It looks like the Vf/Temperature curves track more closely above 100mA. Make that <strong>a lot</strong> more strongly.</p><p>There might be some really clever ways to make self-calibrating software, too. If you put a jumper in place of button 1, the thing would idle at it's max output voltage. Dividing that by 12 would tell you how big each step needed to be.</p><p>And don't get me started on monosynths, or we'll be here all day!</p></p>
Ford Anglia on PRT-12080 - SparkFun VKey Voltage KeypadFord Angliaurn:uuid:c947cefb-5ab0-c793-0650-1d59830486f32014-02-14T15:44:25-07:00<p>Interesting concept! I wonder if a 'digital' version is planned?<p>An MCU (micro controller) in place of the op amp, reading switch closures, using key-scanning of a matrix, could then output serial data of key closures. This would require only two signal pins (plus supply and ground) for the popular I2C (or TWI) protocol.</p><p>Having an MCU allows programming of behavior, and resolution of the multiple button press issue. Or, to distinguish between a button "tap" (< a second) and a button "hold" (> a few seconds)</p></p>
Customer #2017 on PRT-12080 - SparkFun VKey Voltage KeypadCustomer #2017urn:uuid:8cfd6d46-c80a-cb1a-4675-03913cc8c9102014-02-14T12:45:31-07:00<p>according to my calcs this design will only work when limited to +/- 10C of temperature change. due to the diode drop changing with temp. maybe add some temp comp, either in software or hardware. the old analog mono synths used a similar circuit and had temp comp to combat this issue.</p>
Customer #2017 on PRT-12080 - SparkFun VKey Voltage KeypadCustomer #2017urn:uuid:a19f3ab6-f261-0431-a06f-612b3c6b483d2014-02-14T12:41:11-07:00<p>if all you need is 1 key at a time it saves a lot of pins. wonder about temperature effects however.</p>
Customer #346721 on PRT-12080 - SparkFun VKey Voltage KeypadCustomer #346721urn:uuid:eb33926f-9bc6-554d-f224-2e81c0af14432014-02-14T09:34:42-07:00<p>Not according to the "Hookup Guide" - "One situation to consider is when more than one key is pressed at the same time. The VKey implements high-key number (or low voltage) priority – when more than one of the switches is closed at a time, the output will indicate the higher key number. For instance, if you hold down 5 and 9 together, the output will indicate key 9 is pressed."</p>
Customer #380827 on PRT-12080 - SparkFun VKey Voltage KeypadCustomer #380827urn:uuid:01e56f9c-3ddd-8cf0-0d8f-277feba38f9d2014-02-14T09:28:32-07:00<p>Can it detect multiple button presses?</p>