Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : (MM-DM) 4x3 Keypad on 1 analog pin
Author | Message | ||||
donmck Guru Joined: 09/06/2011 Location: AustraliaPosts: 1313 |
(MM-DM) 4x3 Keypad on 1 analog pin Jez Siddons, a member of the KSD forum, posted a project on the KSD forum about a 4x3 Keypad, on 1 analog input pin, that has created a bit on interest, and is very easy to implement. I reposted it at: http://www.duinomite.com/duinomite-4x3-keypad-on-1-analog-pi n/ The original post is at: http://www.kenseglerdesigns.com/cms/forums/viewtopic.php?f=1 3&t=549 Software is MMBasic V3.2A (other V3.x may also work), and the hardware is a DuinoMite-Mini. He also did another recent keyboard project at: http://www.duinomite.com/duinomite-chop-off-keyboard-usb-con nector-and-fit-ps2-connector/ Again, the original article is posted at: http://www.kenseglerdesigns.com/cms/forums/viewtopic.php?f=1 3&t=550#p2283 I feel these projects would be of interest to the readers of this forum also. Cheers Don... https://www.dontronics.com |
||||
marcwolf Senior Member Joined: 08/06/2009 Location: AustraliaPosts: 119 |
The 4x3 KB is a great idea and I have used it before with excellent results. If you ar using the KB a distance away from the processor it's a good idea to put the voltage regulator down at the keypad end. That way way there is less chance of voltage loss and incorrect readings. Marc Coding Coding Coding.. Keep those keyboards coding.. RAW CODE!!!!! |
||||
MicroBlocks Guru Joined: 12/05/2012 Location: ThailandPosts: 2209 |
I have used it before and it works great when the temperature is within a certain range. When resistors get warm or cold they slightly change the voltage on the analog input. For me it was not useful because of that. Microblocks. Build with logic. |
||||
marcwolf Senior Member Joined: 08/06/2009 Location: AustraliaPosts: 119 |
Ahh.. There is a trick to that. Rather than work with absolutes this is what I did in my code If X >= 14 or X <= 18 then ' Check for 16 KeyValue = '1' End If If X >= 22 or X <= 27 then ' Check for 25 KeyValue = '2' End If That way you compensate for temperatures and minor voltage fluctuations Take Care Dave Coding Coding Coding.. Keep those keyboards coding.. RAW CODE!!!!! |
||||
paceman Guru Joined: 07/10/2011 Location: AustraliaPosts: 1329 |
|
||||
marcwolf Senior Member Joined: 08/06/2009 Location: AustraliaPosts: 119 |
Range of voltages. The 16 & 25 are the expected values and I do a +/- 2 on either side of the expected value to ensure that the keystroke is captured. Hope this helps Dave Coding Coding Coding.. Keep those keyboards coding.. RAW CODE!!!!! |
||||
paceman Guru Joined: 07/10/2011 Location: AustraliaPosts: 1329 |
OK thanks - seems logical to me - and saves all the other conversions. Greg |
||||
MicroBlocks Guru Joined: 12/05/2012 Location: ThailandPosts: 2209 |
I had some trouble with it. I tried the range, but they overlapped. the temperature range i tested was between -20C (freezer) and 50C (in the sun). Maybe a temperature sensor to compensate. :) Or i had a not so good LM334Z. Microblocks. Build with logic. |
||||
marcwolf Senior Member Joined: 08/06/2009 Location: AustraliaPosts: 119 |
Although I have never had that problem what you could do is this. Add a Temp Sensor to the circuit and read that every so often. Set up a standard resistor on the A/D and read it over a wide temp range. Check several other resistors to see how they react. This should give you an approximation on wether to add or subtract a temperature variance to the A/D read voltage, i.e. Gosub CheckTemp ' Return Temp Factor as TF being numerical ReadAD Keyboard, KValue ' Get the value from the keyboard KValue = KValue + TF ' add the temperature compensation ' All other code for decoding values to keys here Coding Coding Coding.. Keep those keyboards coding.. RAW CODE!!!!! |
||||
bfgstew Newbie Joined: 27/04/2013 Location: United KingdomPosts: 19 |
Hi guys. Has anyone got the original schematic for the 4 x 3 to 1 wire adc? The links are not responding and I really need this keypad platform to work. Cheers Guys Stewart Red to red, black to black and blue to bits! |
||||
MicroBlocks Guru Joined: 12/05/2012 Location: ThailandPosts: 2209 |
Here you go: Microblocks. Build with logic. |
||||
bfgstew Newbie Joined: 27/04/2013 Location: United KingdomPosts: 19 |
Many thanks TZ, much appreciated Red to red, black to black and blue to bits! |
||||
donmck Guru Joined: 09/06/2011 Location: AustraliaPosts: 1313 |
Sorry Stewart, I received your messages in the middle of the night our time, so I couldn't respond. I will reference my article to this thread, as the old Ken Segler site is up and down like the proverbial. Thanks TZAdvantage for coming to the rescue. Cheers Don... https://www.dontronics.com |
||||
bfgstew Newbie Joined: 27/04/2013 Location: United KingdomPosts: 19 |
Much appreciated for getting back to me Don. Red to red, black to black and blue to bits! |
||||
paceman Guru Joined: 07/10/2011 Location: AustraliaPosts: 1329 |
Stewart, if there'a benefit for you to go to a 4x4 keypad (4 extra keys) using the single analog input, rather than the 4x3, have a look at this thread. 4x4 keypad I found it worked well and the calibration method is reliable and simple. Greg |
||||
bfgstew Newbie Joined: 27/04/2013 Location: United KingdomPosts: 19 |
That looks a neat job Greg, thanks for sharing it. I have been trying for ages to get a reliable 1 wire set up for this keypad, but all I came up with was the resistor matrix, and how people found it to be reliable, I always found it to be the opposite, especially when the high number keys are pressed, the voltage steps just came so close to each other, rendering it unreliable. This set up looks perfect, okay, it has a few more components, costs a few more pence, but if it is reliable, so what. I use the Picaxe microcontrollers, so the coding is going to slightly different but not difficult to transfer code over to it. Keep you posted on outcome. Stewart Red to red, black to black and blue to bits! |
||||
paceman Guru Joined: 07/10/2011 Location: AustraliaPosts: 1329 |
I found the conversion to integer in the program line: keynum=Cint(5.2539*vkey+0.0534) (constants depend on calibration) was the best (and simplest) way to reliably convert voltage to key because it automatically gives the full +/- range for each key's voltage. Also, the supply has to be 5v to give the full 3.3v range across the keys without putting greater than the allowable 3.3v on the analog input. The "no key pressed" condition is the highest voltage and is just less than 3.3v. Also I found Futurlec stocked the 'old' diode (1N457) that was recommended in Nat Semi's datasheet to minimise temperature variation with the LM334Z constant current device, but I'm still using the 1N4148 which has similar specs and seems to work well. I've also since bought a couple of 4x4 keypads for about $2 each from e-Bay instead of the original $29 I paid from Jaycar To be fair, they've dropped that to around $13 now but it's still ridiculous! No doubt you can do a lot better in the UK. Greg |
||||
bfgstew Newbie Joined: 27/04/2013 Location: United KingdomPosts: 19 |
Thanks for that Greg, really appreciate the help I have received from this forum and being a Pomp as well, mind you, you probably feel pity as we are getting a proper caning off you at the moment!!!!!!! Red to red, black to black and blue to bits! |
||||
SteveP Newbie Joined: 21/03/2013 Location: United StatesPosts: 19 |
Sparkfun now sells VKey Voltage Keypad 3x4 as part PRT-12080. It uses a constant current source and user comments discuss temperature effects. https://www.sparkfun.com/products/12080 |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9308 |
I have used this idea on a PICAXE, but not the uM chip or any other platform. It was at the PICAXE forums, that the idea was discussed for that platform, but it is essentially the same, from what I can see, the only difference being that in the PICAXE version, there was not current-source used, but that is a good idea. As the diagram itself says, does not support multipule simultaneous presses, but I was using it for a simple code-lock at home, and it seemed to work just fine for that. Any keypress not in the right place in the sequence, would reset the code lock to the beginning. In my case, I used a PICAXE 08M 8-pin DIL chip, and the code was 6-digits long, with piezo beeper for each keypress, relay output and LED's. In all the time I used it, I never had any issues with buttons not working due to temperature variations, as mentioned by TZA, but that must be possible, or he would not have posted about it. I used 1% metal film resistors for accuracy, and I think they are a bit more temperature stable then carbon film ones - not exactly sure. I used exactly the same idea for finding the key: [code] if key1>=52 and key1<=57 then goto one if key1>=58 and key1<=62 then goto two if key1>=63 and key1<=68 then goto three if key1>=69 and key1<=73 then goto four if key1>=75 and key1<=80 then goto five if key1>=85 and key1<=90 then goto six if key1>=95 and key1<=100 then goto seven if key1>=105 and key1<=115 then goto eight if key1>=125 and key1<=130 then goto nine if key1>=150 and key1<=160 then goto star if key1>=190 and key1<=200 then goto zero if key1>=210 and key1<=255 then goto hash [/code] Smoke makes things work. When the smoke gets out, it stops! |
||||
Print this page |