Tuesday, April 26, 2011

The FrankenKindle - It's alive!

Every project needs a good name, and given the nature of this particular endeavor I can't think of anything that would top The FrankenKindle.  Now all I need is a theme song...

This week marked a huge milestone for the project.  The two large page turning buttons on the V.Reader device were used to control the page turn functionality of the Kindle 3.  And, wonder of wonders, it worked!

Here's a quick rundown of the components in the video (skip to the end to see the actual test).

(WARNING: Nerdspeak ahead.  Skip to the bottom if you value your sanity.  You've been warned...)

The V.Reader

We'll be using seven buttons in total from this device, although for this test only the two large arrow buttons on the front panel were used to turn individual pages.  They are simple dry-contact switches, which means that when they're activated it's basically the same as touching two wires together to make a connection.  Two wires were used per switch, and are routed back to the microcontroller on the breadboard.

The controller

For simplicity's sake I chose to use the Teensy++.  It's a USB-powered device based on an 8-bit AVR microcontroller, which allows easy connection to the PC for programming and also provides a convenient 5V supply to the rest of the circuit.  In addition, it is compatible with the Arduino environment which dramatically simplifies the programming phase. This particular unit is overkill for this application but we're hip-deep in the prototyping phase here so the emphasis is more on making it work than making it efficient.  That will come later.

The multiplexer

This is the multiplexer I chose, mainly because it's cheap, intended for digital signals, and has a breakout board already.  If multiplexers confuse you, just think of one of those old-school telephone operators sitting in front of a giant switchboard.  They take a jumper cable and connect two signals together so they can communicate.  That's exactly what happens here.

Let's look at the left-hand circuit for starters.  The short version is that pin 7 (called "1D") may be connected to any one of the four pins above it, pins 3, 4, 5 or 6 (1S4, 1S3, 1S2, or 1S1, respectively).  The signals IN1 and IN2 control which connection is made, and 1EN and 2EN enable it.  The EN signals allow the connection circuits to be handled independently, basically making this into a dual single-pole, quadruple-throw switch.  Each chip, then, should allow up to eight distinct connections to be made.

That's fantastic, except the breakout board supplied by SparkFun doesn't break out the 1EN and 2EN pins, so any connection made on one side of the chip is mirrored on the other.  1D and 2D are still distinct, but they cannot be controlled independently.  If 1D is connected to 1S3, then 2D must also be connected to 2S3.  This limits us to only four independent connections per chip, rather than eight.  (Yes, the two switch systems are electrically isolated, but since it is not possible to independently control them, half of the switch becomes useless for this application.)

Further, since I can't enable or disable the connection I must reserve one combination as a "home" and make sure it's not used.  The reason for this is simple - each connection simulates a key press event on the Kindle.  We must have a state where no keys are pressed, and the only way to do that with this chip as SparkFun sells it is to reserve one of the switch combinations and not connect it to the Kindle at all.  As such, out of eight possible connections we are only able to use three.

Fortunately I decided to buy spares, so I should have enough on hand to complete the first run of the FrankenKindle.  Eventually I'd like to make this project more user-friendly however, and this issue will need to be addressed.  It will likely require creating a custom PCB for the project.

The software

As detailed in a previous post, two hacks were used to improve the functionality of the Kindle for this application, Jailbreak and Launchpad.  When a key is pressed on the V.Reader, the Teensy sees that and uses the multiplexer to mimic pressing the specific key sequence to fire the Launchpad script, which will turn an individual page.  (Whew!)  This same procedure could be used without the software hack, but it would only be able to jump between chapters, not individual pages.

(This concludes the nerdspeak - welcome back!)

The test

Enough talk - here's a short video showing how it works.  Apologies for the horrible sound quality.


  1. Is there external keyboard sold to connect directly to Kindle 3? Thanks

  2. Not yet. :)

    One eventual goal of this project is to create a "black box" of sorts, that will allow the user to connect their own buttons and switches so they can create their own custom interface. It's a ways off, but that black box will likely be something I put out for sale.

    The trick is that the Kindle doesn't have USB Host capability, so it can't read a USB keyboard directly. I know some of the new Android tablets have this capability, and I believe the iPad does as well.

  3. Stumbled upon http://www.siralex.info/2011/05/19/kindle-3-serial-line-adapter/ while traversing http://www.mobileread.com/forums/showthread.php?t=129268&page=2 You may find them useful. I'm in pursuit of a foot pedal system to enable the effective use of the Kindle DX for sheet music during choral performances (a much more selfish reason for researching this topic).

  4. Hi, Glenn,

    Thanks for your encouraging experiments. I will follow your posts closely and look forward to your "black box".

    I am very interested in finding a way to touchtype on an e-paper device (with an external wired keyboard). I feel regular screens are slowly disabling me. Here is my little essay on an e-paper typewriter:

    Would love to hear what you think.


  5. That's a very interesting take on eInk as a writing tool. I do like the look and feel of the Kindle I've been working with, but I guess I never stopped to think about the reasons.

    The Kindle lacks USB host capability unfortunately, so while I know a few people have talked about it, the use of a USB keyboard doesn't seem feasible at this point. A new device (or a next-gen Kindle...?) would need to be designed with this functionality from the start. The technology is there, they just need to take that extra step and implement it.

    Thanks for the links, and thanks for following my project!

  6. Hi, Glenn,

    Been awhile, but still definitely interested in your external keyboard project. Thank you for reading and commenting on my pieces on the ergonomics of e-paper.

    Since you've worked so closely with the Kindle 3, I would really like your opinion about something. If voiding the warranty and completely destroying/replacing the Kindle software with Debian or Angstrom Linux were ok (even desirable :) ) what is your estimation of the possibility of installing a USB host inside the device (I'm guessing using either the wifi or the 3G connector to do so)?

    Again, I really do not care about being able to access the Kindle store from the device. I want to complete repurpose the thing into an e-paper tablet computer.

    Thank you!


  7. Ps,

    Congrats on your success with the keyboard for your sister and with all the attention your project got.

    Last question: Do you think the Bus Pirate
    would be useful to your/my purpose?


  8. Andrew: I've looked at USB host devices a bit as well, and from what I can tell you need specific hardware to act as a USB host. That is, regardless of the OS you put on a device, you need a specific chip in order to host your own USB slave device. The Kindle 3 doesn't have this hardware.

    Short version: Kindle 3 won't accept a keyboard directly.

    Not to say that there aren't ways around that, of course. :) I'm working on something, but it's just in the concept stages. I'll need to play with it for a while before I have anything to report.

    The Bus Pirate looks interesting, but I think its main purpose is just to ease communication between devices. It would probably be very useful, but it won't give you USB host capability.

  9. Hi, Glenn,

    Thanks for your reply, but that's not quite the question I was asking.

    How difficult would it be to add USB host hardware to a Kindle? (Again, I don't care if this screws up Kindle software.)


  10. Andrewed: It isn't possible to add USB Host capability to the Kindle motherboard itself, because to do so would require (at the very minimum) an additional chip, soldered directly to the main controller, which may or may not have the resources to drive it. This would require a redesigned board; essentially a new Kindle altogether.

    You'd be better off trying to jack the eInk display itself, along with whatever controller it uses, and using it as a display for whatever microcontroller you want. That is a completely different project, one that is far beyond the scope of what I'm trying to do here. I'll stop short of calling it "impossible", but I will tell you that it would be a major project.

    "Anything is possible, impossible just takes longer." (NSA)

  11. Please, Please, Please!!! Hack the hell out of the kindle 3 to let it accept an external keyboard.

    I understand (in my own layman way) what you mean by the kindle's inability to host do to lacking a dedicated chip soldered on to the motherboard.

    BUT all that means to me is that there is no nice and pretty way of connecting it. I found a site that found a way of connecting an external keyboard to the 1st generation htc incredible phone. It involved splicing two ends of two different lines. (car charger and micro bus ???)

    Could something like this (BY YOU!)be done for the kindle?
    (say yes, say yes, say yes)

  12. If he did it, it'd take a lot of time, effort, and expertise. And that's worth a lot of money! If it's not a project he wants to do himself, you'll have to either pay him (if he does work like that for money), pay someone else (possible, not cheap!), or find someone else qualified who's interested.

    Maybe post on the forum here. There are other protocols than USB. The standard PS/2 PC keyboard standard is a simple, slow serial port. Should be much easier to do, if you can still get keyboards that support PS/2. I think they still include the little adaptor with modern USB keyboards. That might be something to hack with a couple of spare IO lines on the Kindle's chip, or possibly a small microcontroller.

    Tho don't ask me to do it! I'm more into armchair electronics, not soldering and oscilloscopes.

    You could get yourself a cheap microcontroller dev kit, and a book, and teach yourself! There are online tutorials but really a book is much better, much more information, and you can read it in bed. And, as you know, easier on the eyes!

  13. What if you used some kind of interfacing to act as the usb host such as an Arduino? I haven't worked with USB interfacing much, but you might be able to use the Arduino to send keystrokes from an external keyboard to a kindle through some type of program running in the background. Nice work your project!