Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 23:59 28 Nov 2024 Privacy Policy
Jump to

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: Australia
Posts: 1313
Posted: 08:04pm 08 May 2012
Copy link to clipboard 
Print this post

(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...Edited by donmck 2012-05-10
https://www.dontronics.com
 
marcwolf

Senior Member

Joined: 08/06/2009
Location: Australia
Posts: 119
Posted: 05:48am 10 May 2012
Copy link to clipboard 
Print this post

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: Thailand
Posts: 2209
Posted: 03:45pm 12 May 2012
Copy link to clipboard 
Print this post

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: Australia
Posts: 119
Posted: 12:30am 13 May 2012
Copy link to clipboard 
Print this post

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: Australia
Posts: 1329
Posted: 01:14pm 13 May 2012
Copy link to clipboard 
Print this post

  marcwolf said   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

/QUOTE]

Hi Dave,
Do you just mean give each button a range of voltages to lie within (which seems very sensible), or is there something else about the "16" and "25".

Greg
 
marcwolf

Senior Member

Joined: 08/06/2009
Location: Australia
Posts: 119
Posted: 01:19pm 13 May 2012
Copy link to clipboard 
Print this post

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: Australia
Posts: 1329
Posted: 01:26pm 13 May 2012
Copy link to clipboard 
Print this post

  marcwolf said   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.

ave

OK thanks - seems logical to me - and saves all the other conversions.
Greg
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 08:36pm 13 May 2012
Copy link to clipboard 
Print this post

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: Australia
Posts: 119
Posted: 12:36am 14 May 2012
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 19
Posted: 04:07am 29 Nov 2013
Copy link to clipboard 
Print this post

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: Thailand
Posts: 2209
Posted: 05:54am 29 Nov 2013
Copy link to clipboard 
Print this post

Here you go:



Microblocks. Build with logic.
 
bfgstew

Newbie

Joined: 27/04/2013
Location: United Kingdom
Posts: 19
Posted: 06:01am 29 Nov 2013
Copy link to clipboard 
Print this post

Many thanks TZ, much appreciated
Red to red, black to black and blue to bits!
 
donmck

Guru

Joined: 09/06/2011
Location: Australia
Posts: 1313
Posted: 09:26am 29 Nov 2013
Copy link to clipboard 
Print this post

  TZAdvantage said   Here you go:




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 Kingdom
Posts: 19
Posted: 11:18am 29 Nov 2013
Copy link to clipboard 
Print this post

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: Australia
Posts: 1329
Posted: 05:20pm 30 Nov 2013
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 19
Posted: 11:32am 01 Dec 2013
Copy link to clipboard 
Print this post

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.

StewartEdited by bfgstew 2013-12-02
Red to red, black to black and blue to bits!
 
paceman
Guru

Joined: 07/10/2011
Location: Australia
Posts: 1329
Posted: 03:47pm 01 Dec 2013
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 19
Posted: 07:42pm 01 Dec 2013
Copy link to clipboard 
Print this post

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 States
Posts: 19
Posted: 11:03am 15 Feb 2014
Copy link to clipboard 
Print this post

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
Edited by SteveP 2014-02-16
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9308
Posted: 12:46pm 15 Feb 2014
Copy link to clipboard 
Print this post

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


To reply to this topic, you need to log in.

© JAQ Software 2024