Pages: 1 2 [3] 4   Go Down
Author Topic: using Keypad library for a full QWERTY keyboard  (Read 6925 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes exactly. I'm a newbe to that, so I didn't know if the analog pins are useless and I only can could the digital ones.

and I'm not a native english speaker so that add some difficulties in understanding the stuff (and ma lead to some questions that might sound silly and unnessessary)
« Last Edit: February 15, 2012, 10:48:06 am by mclien » Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 73
Posts: 7198
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes exactly. I'm a newbe to that, so I didn't know if the analog pins are useless and I only can could the digital ones.

and I'm not a native english speaker so that add some difficulties in understanding the stuff (and ma lead to some questions that might sound silly and unnessessary)

To expand this topic on analog pin ideas, I think you can connect a few resistors to the row pins like that of the analogbuttons and use column pins to drive low and sense with analog inputs. What do you thing, mstanley? 4 digital pins and 1 analog pins for a 4*4 keypad? I'll whip out the code with my phi_interface library, which already contains analog keypads but of a different type.
Logged


Phillipsburg, NJ
Offline Offline
Full Member
***
Karma: 6
Posts: 184
Author: Matrix Keypad Library
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
To expand this topic on analog pin ideas
I think I would like to but maybe we should start another thread for that.  It could be pretty scary for newbies.  smiley

Quote
What do you thing, mstanley? 4 digital pins and 1 analog pins for a 4*4 keypad?

LoL... I thought of that, too.  It sounds like a pretty fun challenge.  But for shipping code it would probably just be best to have the library identify that the user is connected to the analog pins and have the library reconfigure them for digital when needed.
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 73
Posts: 7198
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
To expand this topic on analog pin ideas
I think I would like to but maybe we should start another thread for that.  It could be pretty scary for newbies.  smiley

Quote
What do you thing, mstanley? 4 digital pins and 1 analog pins for a 4*4 keypad?

LoL... I thought of that, too.  It sounds like a pretty fun challenge.  But for shipping code it would probably just be best to have the library identify that the user is connected to the analog pins and have the library reconfigure them for digital when needed.


Yep! Will do once I get it to work. All I have now is a "matrix keypad" with multiple analog inputs, each with a number of keys hooked to it. This hybrid keypad will be more useful since you can just buy a matrix keypad and not having to construct a special keypad to use analogButton lib. I have been aching over the ATMEGA328P lacking of I/O pins for a while. I was trying to make a phi-panel out of GLCDs. They take 13 pins so 5 left if I do serial panel. I guess I've just found my way to handle that with analog/digital hybrid keypad. Awesome! Finding solutions or learning stuff every day is great!
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

FYI, the matrix of the Palm portable Keyboard (US-Layout), which I plan to re-use with the teensy:
Code:
       "c1"    "c2"    "c3"    "c4"    "c5"    "c6"    "c7"    "c8"    "c9"    "c10"   "c11"   "c12"
"r1"    "4"                     "c"     "r"     "f"     "8"     "u"     "j"     "m"
"r2"    "5"                     "v"     "t"     "g"     "9"     "i"     "k"     ","
"r3"    "6"                     "b"     "y"     "h"     "0"     "o"     "l"     "."
"r4"    "7"                     "n"     "` ~"   "space" "space2"        "p"     ";"     "done"
"r5"    "1"     "Caps"  "Del"           "cmd"   "x"     "-"     "["     "„“"    "/ "            "Shft L"
"r6"    "2"     "tab"   "left"          "q"     "a"     "+"     "]"     "enter" "up"            "shf R"
"r7"    "3"     "ctrl"  "down"          "w"     "s"     "BckSpce"       "\"     "ToDo"  "Memo"  "Fn"
"r8"    "z"             "right"         "e"     "d"     "Date"  "Phone"                 "alt"
So what do you think liudr? 12 digital and 1 analog pin for that, or are 8 steps to narrow for an analog pin?
But I could also live with the use of a "full" matrix of 20 I/O pins (so I can still leave out the RX/TX pins and have 2 pins left to drive a LED, if I want to)
And don't be confused by some strange Labels: There are some extra keys on that keyboard that where designed for the use with a Palm device, but could be perfectly reused as extra/media/F keys.
Once the hardware is working its just a metter of assinging the keys and perhaps do some work with xmodmap (at least when using GNU/Linux).

EDIT:
I was just surfing hackaday:
http://hackaday.com/2012/02/15/building-a-keyboard-from-scratch/
(haven't read all links, but it was mentioned he used a teensy++2.0 and "existing libraries". maybe it's worth alook?)
« Last Edit: February 16, 2012, 09:20:41 am by mclien » Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 73
Posts: 7198
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

mclien,

8 analog steps should work. Then you have 12 digital I/O + 1 analog input to sense the entire keypad. I will find some time to tackle this. Under my phi_interfaces framework it should be easy to add a device like this but I have the phi_prompt library to release first smiley-wink

The hackaday is worth checking. I browsed the site and didn't find a design file. There's around 90 keys and the keypad layout is known so the maker could have made a custom dimension. Your keypad has a fixed dimension of 8*12 and that is what you have to deal with. The hackaday code should be worth looking at. The hackaday keyboard must allow multiple key held together so it's much more complicated than what my library does, which is single key only.
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Oh, the last point you mention is a issue to me.
Since I want to use the device as a "normal" USB keyboard I have to get it working with up to 3 keys pressed (ALT+SHIFT+L or something like that) or is that what option8 does by using the keypad library 2 times?
Logged

Phillipsburg, NJ
Offline Offline
Full Member
***
Karma: 6
Posts: 184
Author: Matrix Keypad Library
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

option8 tried using the keypad library 2 times to handle multiple key presses but I don't believe it solved his problem.  I modified the library for him so that, with some restrictions, he can press up to 10 keys at the same time.

I saw that he offered to send you a copy of his sketch so I asked him to send you a copy of the modified library.  If he can't do it then I can send you what you'll need. But it will have to wait until this weekend.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes I got a "keypad 2.0 multi-keys" zip-file
and a "IIc Keyboard.ino"
So, some newbie questions (for verification):
-the ino file is option8s keyboard layout, which I have to modify (rows/cols amount, my layout)
- there are a lot of examples included (mainly for the numkeypad, if I understood it correctly) and a keypad.h and a keypad.cpp file.

So "all" I need is to modify the layout part of option8s ino file and include the keypad.h library?
Logged

Phillipsburg, NJ
Offline Offline
Full Member
***
Karma: 6
Posts: 184
Author: Matrix Keypad Library
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes I got a "keypad 2.0 multi-keys" zip-file
and a "IIc Keyboard.ino"
I am really glad to hear that. smiley

Quote
So, some newbie questions (for verification):
-the ino file is option8s keyboard layout, which I have to modify (rows/cols amount, my layout)

Yes, that is true.  Just make sure you keep your pin numbers in the right order. Also, if you aren't using the Arduino 1.0 software (IDE) then you need to rename IIc Keyboard.ino to IIc Keyboard.pde


Quote
So "all" I need is to modify the layout part of option8s ino file and include the keypad.h library?
His file may already #include the keypad.h library.  If not, then yes, you will have to include it.


P.S.  Do you know how to add libraries to your Arduino software?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Quote
So, some newbie questions (for verification):
-the ino file is option8s keyboard layout, which I have to modify (rows/cols amount, my layout)

Yes, that is true.  Just make sure you keep your pin numbers in the right order.
sure, but I fist have to do the hardware for that. (will be a real pain, I think. 20 small wires from one small pad to the teensy and about 12 pads to connect each other. maybe i use enameled copper wire to spare some space
Quote from: mstanley
His file may already #include the keypad.h library.  If not, then yes, you will have to include it.

P.S.  Do you know how to add libraries to your Arduino software?
My mistake. I ment where to place the library, but I think I just have to find the directory where all the libraries are and put the keypad.h there, so that the include command works...

I hope I'll get some photos uploaded at the weekend. Thanks for your support so far.
Logged

Phillipsburg, NJ
Offline Offline
Full Member
***
Karma: 6
Posts: 184
Author: Matrix Keypad Library
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My mistake. I ment where to place the library, but I think I just have to find the directory where all the libraries are and put the keypad.h there, so that the include command works...

If you can find your installation folder for the Arduino software then you will need to extract the keypad.zip into the libraries/ folder.  Once the files/folders are extracted then the directory tree should show Arduino/libraries/Keypad with a bunch of other library folders in there.

Restart the Arduino IDE if you already have it running. Next, go through the menus Sketch->Import Library...->Keypad and you should be able to add the library.  If you don't see Keypad in the menus then you extracted it to the wrong place.

Quote
I hope I'll get some photos uploaded at the weekend. Thanks for your support so far.

Very cool and I'm glad I could help.

I have plans for the summer break while I'm between terms.  I am changing the library to always scan simultaneous multiple keypresses.  There will be a new function, getKeys(), for people wanting to scan keyboards but I plan to keep the current getKey() for people who want to read a single keypress from their keypads.

The reason I mention it is because I'm hoping that you keep your copy of the library private.  It's GPL'd so you can pass it around if you like but I really don't want to support it.

Thanks.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

My question isn't directly related to this post, but I figure that since you're the one who made the library then there's no one better to ask.

Basically I'm interfacing with a keyboard and LCD. The code should work as follows
a) a "menu" shows up
b) if the user presses a certain key then it should call another function
c) this other function prompts the user for input via the keypad.
d) the input is saved
My problem is in step c (and d) .... for some reason the code isn't acknowledging key presses once in the other function. I do call the function getKey again in the second piece of code and I've tried a couple of things to debug it but none of them work.
I've seen someone else do it, and they claim it works but it's not working with me. Do you have any suggestions as to what may be going wrong?

Thank you  smiley
Logged

Phillipsburg, NJ
Offline Offline
Full Member
***
Karma: 6
Posts: 184
Author: Matrix Keypad Library
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My problem is in step c (and d) .... for some reason the code isn't acknowledging key presses once in the other function. I do call the function getKey again in the second piece of code and I've tried a couple of things to debug it but none of them work.

Hi foob,

You should really only call the getKey() function once each time through the loop.  As long as you are not using delay()'s in your code then getKey will be called hundreds, or even thousands, of times per second.  Way faster than any human can react.  Thus, any time a new key is pressed it should get stored in your return variable and you can use that from any of your functions to see which key was pressed.

If that isn't enough to help you with your problem then email me directly and I will help you.  You can find my email address in the keypad.h file that you downloaded with the library.

-Mark
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi guys

I'm working on a teensy based keyboard (modern keyboard controller replacement, no diodes)
The hardware is sorted but I haven't started on the software yet.
Can I help out with the testing/grab the files and do a runner/help in any way?
Logged

Pages: 1 2 [3] 4   Go Up
Jump to: