Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 01-26-2017, 02:59 PM   #1
KindleMeAndrey
Enthusiast
KindleMeAndrey began at the beginning.
 
KindleMeAndrey's Avatar
 
Posts: 43
Karma: 10
Join Date: Dec 2016
Device: Kindle 3 Keyboard
Puzzling behavior while connecting a PS/2 keyboard to Kindle

Hello,

I'm attempting to connect a PS/2 keyboard to Kindle 3, replacing Kindle's own keyboard, which is a 20-pin row-column matrix of switches. Basically to trigger a key you need to cross a row pin with a column pin. So crossing pin 2 with pin 12 should produce "q".
Here is row/column map for reference:
http://breadboardconfessions.blogspo...board-map.html

I have the PS/2 keyboard connected to Teensy++, then 20 pins going out into Kindle's own keyboard port.

I didn't think it would even work without a multiplexer (switchboard to control which pins get crossed with which), but somehow the five-way controller works totally fine just by putting pins 15-19 into OUTPUT mode. They're supposed to only activate when they are crossed with Pin 20, but even if I disconnect that pin, they still work.

If I put the other pins into OUTPUT mode, I get gibberish (albeit, consistent gibberish):

1
2
3
4
5
6: ^[OH2tdz
7: 1^[OS%^[[24~,
8:
9: 3^-$ (enter)
10: 4ug5c
11: ^[6ih7v
12: qoj8b
13: wpk9n
14: 0ealm

(Pins 1-6 & 20 are rows, 7-19 are columns)

I'm fairly new to this and it's a bit of an electrical puzzle for me at the moment.

If none of them worked, it would make sense and I would just get a multiplexer, but the fact that some of them work as expected while others cause kindle to do crazy stuff (series of nonsensical operations) makes me wonder whether it would be possible to do this with Teensy alone.

Can Teensy++ act as a multiplexer/switchboard?

Is kindle perhaps interpreting all row switches as crossed and pin 20 only registers because it's the last one?

Anything else that I should try?

Here's the code I use for activating the pins (currently mapped to T, Y, U, I and O):

Code:
      if (c == 't') { // 15 [up arrow] ^[[A
        pinMode(PIN_C0, OUTPUT);
        digitalWrite(PIN_C0, LOW);
        delay(100);
        pinMode(PIN_C0, INPUT); 
      }
      if (c == 'y') { // 16 [down arrow] ^[[B
        pinMode(PIN_E7, OUTPUT);
        digitalWrite(PIN_E7, LOW);
        delay(100);
        pinMode(PIN_E7, INPUT); 
      }
      if (c == 'u') { // 17 [left arrow] ^[[D
        pinMode(PIN_E1, OUTPUT);
        digitalWrite(PIN_E1, LOW);
        delay(100);
        pinMode(PIN_E1, INPUT); 
      }
      if (c == 'i') { // 18 - [right arrow] ^[[C
        pinMode(PIN_E6, OUTPUT);
        digitalWrite(PIN_E6, LOW);
        delay(100);
        pinMode(PIN_E6, INPUT); 
      }
      if (c == 'o') { // 19 - center button
        pinMode(PIN_E0, OUTPUT);
        digitalWrite(PIN_E0, LOW);
        delay(100);
        pinMode(PIN_E0, INPUT); 
      }
KindleMeAndrey is offline   Reply With Quote
Old 01-26-2017, 04:52 PM   #2
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
"Output" - as in ? ? ?
Technical details please.

Are you creating a path from an "Output" to a common lead (imitating a switch closure) or are you creating a signal voltage?
knc1 is offline   Reply With Quote
Advert
Old 01-26-2017, 05:34 PM   #3
KindleMeAndrey
Enthusiast
KindleMeAndrey began at the beginning.
 
KindleMeAndrey's Avatar
 
Posts: 43
Karma: 10
Join Date: Dec 2016
Device: Kindle 3 Keyboard
Technical details:

PS/2 keyboard is connected to Teensy++, interfaced with PS/2 library.
Then 20 pins go out of Teensy into an breakout adapter, which converts them into kindle's 20-pin ribbon, in place of kindle's own keyboard.
Arduino code is listed in the original post and using that code I can navigate up/down/left/right/center.

I'm not sure what exactly takes place internally. That's what I'm trying to figure out. Here's the link that explains the different digital pin states: https://www.arduino.cc/en/Tutorial/DigitalPins

They are all set to INPUT by default. In that state nothing happens. When the 5-way controller key pins (15-19) get set to OUTPUT, they work. When the other keys get set to OUTPUT, they spit out gibberish.

Let me know if you need any more details. I'll do my best to answer.
KindleMeAndrey is offline   Reply With Quote
Old 01-26-2017, 06:54 PM   #4
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Atmega pins can source (provide positive current) or sink (provide negative current) up to 40 mA (milliamps) of current to other devices/circuits.
Not so puzzling.

You are trying to use an electrical signal in place of a bare switch contact closure.

You should be able to find what the difference described above means in any basic digital electronics textbook.

= = = =

Even if you could arrange for the Kindle interface to accept signal inputs rather than switch closures, you are using the wrong interface level. Kindles are not 5v devices, not even back in the K3 days.
knc1 is offline   Reply With Quote
Old 01-26-2017, 07:05 PM   #5
KindleMeAndrey
Enthusiast
KindleMeAndrey began at the beginning.
 
KindleMeAndrey's Avatar
 
Posts: 43
Karma: 10
Join Date: Dec 2016
Device: Kindle 3 Keyboard
Then how come the five-way controller triggers work?
KindleMeAndrey is offline   Reply With Quote
Advert
Old 01-26-2017, 08:28 PM   #6
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by KindleMeAndrey View Post
Then how come the five-way controller triggers work?
part and pins please.
knc1 is offline   Reply With Quote
Old 01-26-2017, 08:32 PM   #7
KindleMeAndrey
Enthusiast
KindleMeAndrey began at the beginning.
 
KindleMeAndrey's Avatar
 
Posts: 43
Karma: 10
Join Date: Dec 2016
Device: Kindle 3 Keyboard
I'm not sure what you mean by "part". The pins are 15,16,17,18,19, and when they are set to OUTPUT (per code in the first post), they move the cursor up, down, left, right as well as activate the center button. This works even without any other pins connected (as if pin 20 is always shorted). Ideas?
KindleMeAndrey is offline   Reply With Quote
Old 01-26-2017, 09:25 PM   #8
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by KindleMeAndrey View Post
I'm not sure what you mean by "part". The pins are 15,16,17,18,19, and when they are set to OUTPUT (per code in the first post), they move the cursor up, down, left, right as well as activate the center button. This works even without any other pins connected (as if pin 20 is always shorted). Ideas?
The wires in the Kindle's connector are not physically connected to the cursor.
They must connect to an electronic (and maybe electrical) part or parts.
Give me the part number and pin to connector connections.

To answer your question, I have to do the same thing you did, look up the data sheet for that specific part.
knc1 is offline   Reply With Quote
Old 01-26-2017, 09:50 PM   #9
KindleMeAndrey
Enthusiast
KindleMeAndrey began at the beginning.
 
KindleMeAndrey's Avatar
 
Posts: 43
Karma: 10
Join Date: Dec 2016
Device: Kindle 3 Keyboard
I'm still not sure what you mean by "part number".

Here's what I'm using in this setup:
Kindle 3
Teensy++ 2.0
20-Pin 0.5mm pitch breakout adapter
20-pin 0.5mm pitch cable
PS/2 keyboard with a PS/2 adapter (but that's irrelevant, since it's just key input to be reinterpreted by Teensy)
Jumper cables


Also, upon further investigation, I'm noticing that the "gibberish" codes are actually codes as if all the row pins (1,2,3,4,5,6,20) are active. Thus triggering pin 12, it gives me the output (more or less) of it being shorted with pins 1,2,3,4,5 and 6: "qoj8b". Per chart linked in my first post: Q=2+12, O=3+12, J=4+12. The last two characters are a bit of a mystery, since it's supposed to trigger Back=5+12 and Space=6+12 and I don't think the two of them would make "8b", but it's pretty close.

Now how to make the row pins "inactive" by default...
KindleMeAndrey is offline   Reply With Quote
Old 01-27-2017, 01:56 AM   #10
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Stop trying to be so difficult if you honestly want any help.

The item you have listed as: Kindle 3 is composed of electronic parts, one or more of those parts is the keyboard interface.

Tell me what it is.
Your questions are impossible to answer knowing only what is on one side of the connector.
Without that information you are just wasting our time here.
knc1 is offline   Reply With Quote
Old 01-30-2017, 12:52 PM   #11
KindleMeAndrey
Enthusiast
KindleMeAndrey began at the beginning.
 
KindleMeAndrey's Avatar
 
Posts: 43
Karma: 10
Join Date: Dec 2016
Device: Kindle 3 Keyboard
Dear knc1

I appreciate your willingness to help, but I don't appreciate your condescending attitude.

I find tinkering with electronics fascinating and pleasurable. If replying to newbies makes you bitter and irritated, why bother doing it? Leaving the post unanswered and letting those who enjoy helping step up is simple enough.

You make me think of a stereotypical overworked mother, who resentfully cooks and cleans after her children, all the while taking out her frustration with her own life onto them by yelling and being rude. You're not obligated to help me or anyone else, so if this makes you frustrated and unhappy, please don't bother.
KindleMeAndrey is offline   Reply With Quote
Old 01-30-2017, 06:39 PM   #12
Cinisajoy
Just a Yellow Smiley.
Cinisajoy ought to be getting tired of karma fortunes by now.Cinisajoy ought to be getting tired of karma fortunes by now.Cinisajoy ought to be getting tired of karma fortunes by now.Cinisajoy ought to be getting tired of karma fortunes by now.Cinisajoy ought to be getting tired of karma fortunes by now.Cinisajoy ought to be getting tired of karma fortunes by now.Cinisajoy ought to be getting tired of karma fortunes by now.Cinisajoy ought to be getting tired of karma fortunes by now.Cinisajoy ought to be getting tired of karma fortunes by now.Cinisajoy ought to be getting tired of karma fortunes by now.Cinisajoy ought to be getting tired of karma fortunes by now.
 
Cinisajoy's Avatar
 
Posts: 19,161
Karma: 83862859
Join Date: Jul 2015
Location: Texas
Device: K4, K5, fire, kobo, galaxy
Quote:
Originally Posted by KindleMeAndrey View Post
Dear knc1

I appreciate your willingness to help, but I don't appreciate your condescending attitude.

I find tinkering with electronics fascinating and pleasurable. If replying to newbies makes you bitter and irritated, why bother doing it? Leaving the post unanswered and letting those who enjoy helping step up is simple enough.

You make me think of a stereotypical overworked mother, who resentfully cooks and cleans after her children, all the while taking out her frustration with her own life onto them by yelling and being rude. You're not obligated to help me or anyone else, so if this makes you frustrated and unhappy, please don't bother.
To me, knc1 asked a simple question to help you. You never answered his question. Without the answer then help cannot be provided.

Now from what I gathered in this thread, the ps/2 pins are not corresponding with the kindle pins. But then I haven't looked at the specs of either, which we would need to help.
Cinisajoy is offline   Reply With Quote
Old 01-30-2017, 07:48 PM   #13
KindleMeAndrey
Enthusiast
KindleMeAndrey began at the beginning.
 
KindleMeAndrey's Avatar
 
Posts: 43
Karma: 10
Join Date: Dec 2016
Device: Kindle 3 Keyboard
Dear Cinisajoy,

Thanks for your reply. Perhaps I'm missing something really obvious. I'll try to explain again all the parts that I'm using.

The PS/2 keyboard is connected via a PS/2 keyboard adapter to Teensy++ 2.0. There are four wires: voltage, ground, clock and data. All these are connected to the appropriate pins in Teensy.

From Teensy there are twenty jumper cables going out into an adapter that converts them to a 20-pin 0.5mm pitch ribbon, which goes directly into the kindle in place of its own keyboard connector.

I added links to all the parts in case that's helpful. The Arduino code and pin numbers are in my original post.

I also took apart my kindle and took photos of the components in case what you're looking for is in there:
https://goo.gl/photos/xMN3uC2BYxKk7DHs9

If there's something else you'd like to know, please don't hesitate to ask. If I still haven't answered your question, perhaps you could tell me the steps to take to get that information for you?

And to reiterate my own questions:

* If the switches are designed for bare contact, how come activating the arrow pins digitally moves them around as expected? This makes me think that the entire keyboard could be controlled that way.

* While the arrow key pins behave as if Pin 20 is always shorted, the other keys behave as if ALL the row keys were shorted/activated. For example, activating pin 12 gives me the output (more or less) of it being shorted with pins 1,2,3,4,5 and 6: "qoj8b". Per chart linked in my first post: Q=2+12, O=3+12, J=4+12. The last two characters are a bit of a mystery, since it's supposed to trigger Back=5+12 and Space=6+12 and I don't think the two of them would make "8b", but it's pretty close. Is it possible to "deactivate" these row keys through Teensy, thus triggering only one key press at a time?

Last edited by KindleMeAndrey; 01-30-2017 at 08:06 PM.
KindleMeAndrey is offline   Reply With Quote
Old 01-30-2017, 08:23 PM   #14
Cinisajoy
Just a Yellow Smiley.
Cinisajoy ought to be getting tired of karma fortunes by now.Cinisajoy ought to be getting tired of karma fortunes by now.Cinisajoy ought to be getting tired of karma fortunes by now.Cinisajoy ought to be getting tired of karma fortunes by now.Cinisajoy ought to be getting tired of karma fortunes by now.Cinisajoy ought to be getting tired of karma fortunes by now.Cinisajoy ought to be getting tired of karma fortunes by now.Cinisajoy ought to be getting tired of karma fortunes by now.Cinisajoy ought to be getting tired of karma fortunes by now.Cinisajoy ought to be getting tired of karma fortunes by now.Cinisajoy ought to be getting tired of karma fortunes by now.
 
Cinisajoy's Avatar
 
Posts: 19,161
Karma: 83862859
Join Date: Jul 2015
Location: Texas
Device: K4, K5, fire, kobo, galaxy
Looking over everything and reading your posts, it sounds like the keyboards are not compatible.
Apparently the pins are coded differently. Not a real surprise.
I thought about telling you to try to use a USB keyboard but I doubt the kindle would acknowledge it.
Anyway good luck.
I have to update my new kindle keyboard this week.
Cinisajoy is offline   Reply With Quote
Old 01-31-2017, 07:24 AM   #15
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by KindleMeAndrey View Post
- - - - -
And to reiterate my own questions:

* If the switches are designed for bare contact, how come activating the arrow pins digitally moves them around as expected?
- - - -
This makes me think that the entire keyboard could be controlled that way.
You made an observation, what does it tell you?
This is a branch of science, not of alchemy, take advantage of that fact.

If the observation has no immediate explanation, break down what you are observing into stages of reasoning out an explanation.

Start here:
How can a bare contact be sensed electronically?
Do not be satisfied with only a few answers, get down to the basics, consider those electrical characteristics that can be changed by a mechanical contact.

For each of those answers you found, what would be the result of applying the digital signal you are using to each of those cases?

Follow that path of examination of your observation and you should be able to answer the higher level question that you pose.

- - - - -

Why?
Why does that observation make you think that?
How are each of the keys on that key board related to each other?
How are changes in that relationship sensed electrically?

Just reason it out, looking up any additional information that you need.
Quote:
Originally Posted by KindleMeAndrey View Post
* While the arrow key pins behave as if Pin 20 is always shorted, the other keys behave as if ALL the row keys were shorted/activated. For example, activating pin 12 gives me the output (more or less) of it being shorted with pins 1,2,3,4,5 and 6: "qoj8b". Per chart linked in my first post: Q=2+12, O=3+12, J=4+12. The last two characters are a bit of a mystery, since it's supposed to trigger Back=5+12 and Space=6+12 and I don't think the two of them would make "8b", but it's pretty close. Is it possible to "deactivate" these row keys through Teensy, thus triggering only one key press at a time?
That observation should tell you several things about how the keyboard interface should be expected to work.

Do enough research into the basics of how mechanical keyboards are interfaced to electronics.

Use you favorite information search tool.
Lookup obvious keywords and phrases, such as: "keyboard controller".
There are a number of ways in common use to sense changes in the electrical characteristics of a mechanical switch.

Reading the data sheet on the individual keyboard controllers will tell you how that controller works.
Read about how different ones work until you have a fair sample of the common methods.

Presume that the keyboard interface in the Kindle is one of the common ones.

Combine this new knowledge with your observations and determine which of the common methods is in use on your Kindle.

With that knowledge, you can then answer your own questions above.
With those answers, you will then be ready to decide how to emulate the Kindle's keyboard in a way that the Kindle's keyboard interface will "understand" (your additions will be compatible with the Kindle's keyboard interface).

Remember:
It is a Science, not a seemingly magical process of transformation, creation, or combination (Alchemy).

Once understood, it will no longer seem like PFM.
(I'll even give you the first and third word, you figure out the second: Pure, F......, Magic).

Last edited by knc1; 01-31-2017 at 07:27 AM.
knc1 is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Connecting an external keyboard to Kindle 3 KindleMeAndrey Amazon Kindle 5 12-26-2016 07:18 PM
Kindle Keyboard not connecting to Mac ryansoldout Amazon Kindle 9 07-13-2015 03:40 PM
Troubleshooting Kindle 3 (keyboard) erratic keypress behavior wirawan0 Amazon Kindle 2 04-24-2014 07:23 AM
Connecting an Keyboard? oldbook Kindle Developer's Corner 1 11-30-2012 08:16 PM
Possibility of Connecting an External Keyboard via USB praneeth Kindle Developer's Corner 3 08-04-2009 08:10 PM


All times are GMT -4. The time now is 05:39 AM.


MobileRead.com is a privately owned, operated and funded community.