Physical Keyboard for any Android phone

This is my attempt at having an android phone of my choice coupled to a portrait Physical QWERTY keyboard off an old blackberry.

Public Chat
Similar projects worth following
Ever since my first Blackberry, I've grown really comfortable with physical keyboards, and time and time again, I've found myself going back to the brand, despite some of their shortcomings. Following the death of my Priv, I've decided to start building my own phone with the specs that I want. The aim of this project is that by the end, I will have a fully functional daily driver android with a slide-out portrait keyboard.

After failing to map the pinouts to the Priv's combined keyboard/trackpad, I decided to use a keyboard off a Q10, due to the decent amount of information available. Using a Hirose BM14B connector soldered onto a PCB (and this, ladies and gentlemen, turned out to be the hardest part of the whole project) I then could solder wires and map it out on a Sprintek SK5126 chip. This chip is the best one I've seen around in terms of keyboard encoders as it comes with free and easy to use software to program it, it is also designed for mobile devices and therefore inherently low-power. It can be powered directly with a 5V source (such as a phone in this case) or one can power it with a 3.3V supply. 

Initially I put all components on the bare metal chassis of an old Priv, the idea was to see how all the other components would fit around it, which turned out to be unnecessarily complicated. Using a regular USB 2.0 cable, I could program the SK5126 and test out the layouts as well as hunt for shorts caused by the BM14B connector.

The donor phone of my choice turned out to be a Xiaomi Mi 8 SE due to its relatively high specs for its cheap price and a variety of available custom ROMs. I bought mine second-hand off ebay but for this purpose, any phone which supports OTG will do fine as Android automatically supports physical input devices OTG. 

This meant I had to buy a male USB C connector and use only the Power, Ground and D+/D- lines as well as ground the Configuration channel pin through a 5.1Kohm resistor (which indicates to the phone that it is an OTG device). 

  • 1 × Hirose BM14B connector Actually more than 1 were needed as soldering these connectors onto the PCB is a real headache and most of them ended up molten from the heat.
  • 1 × Sprintek SK5126 Reprogrammable keyboard encoder chip from a company in California which converts a keyboard matrix into a USB output. Same USB is also used for programming the keyboard matrix and other parameters.
  • 2 × PCB one PCB to branch out from the Hirose connector, the other one is to solder the SK5126 chip. Joining both PCB with wires determines the layout of the matrices.
  • 1 × Any android phone one might want to use. In my case it's a Xiaomi because of how easy it is to mess around with and how cheap it is.
  • 2 × N.C. micro sensor switch One switch used to detect the slider's position, the other to detect when a charging cable is connected.

View all 7 components

  • Troubleshooting (please help)

    kylemonti12/16/2019 at 08:49 0 comments

    As of now, I'm stuck troubleshooting the whole thing. If anyone knows about USB C, please help out with your suggestions.

    When I plug the device into the phone, keyboard always lights up (ie the chip is powered), the phone either detects it as a keyboard, or as a device charging off the phone. More often than not, the latter one is what it is detected as and therefore the keyboard does not work at all. I have no idea at all what is going wrong at this point. As I said, there is power going to the chip (and the chip itself consumes very little). I've checked the data lines and they're fine as well (no resistance other than 22 Ohm for each line as suggested by the manufacturer). This problem repeated itself with both chips (one in the test rig and the other one in the prototype slider) and the chip works fine when I plug it into a regular computer. 

    I feel like there must be some technical detail (regarding USB in General and USB C in particular) that I'm missing out on. And the fact that the fault is intermittent, makes the fault that harder to trace!

  • Prototype slider

    kylemonti12/16/2019 at 08:39 0 comments

    First of all, thanks to all those showing interest in this project lately. Spoiler alert: I'm a bit stuck on troubleshooting at the moment and if anyone knows anything about USB, I'll be grateful for your suggestions. Here's what's happened so far:

    I have modified the sliding chassis to accomodate the Q10 Keyboard and a couple of LED's (FN and Caps) on the lower part. The lower part also accomodates the encoder chip as well as anything else it needs to work (pictured). The rest of the phone (except for the battery) will be mounted on the top part and therefore I tried using the provided ribbon cable, which turned out unsuitable to transfer power and data to the chip and keyboard, so in the end I passed my own wires and hope for the best.
    The position of the slider is determined by a small sensor switch on the side (pictured below next to the keyboard). The switch is N.C. and when the slider is closed, it interrupts the power line from USB. 
    The device also needs to be able to charge the phone without having to disconnect it every  time, so I added a USB C port (but only connected Power, ground, D+ and D- ). Another NC sensor switch senses when a charger is connected and disconnects the 5.1KOhm resistor on the Configuration Channel. Without charger, the Switch closes and signals to the phone (thanks to the resistor) that the device is an OTG device. When the charger is connected, the config channel is instead connected to the charging cable which signals that there's a charger available. 

  • Suggestions? Please let me know!

    kylemonti11/10/2019 at 15:15 0 comments

    Before I finalise the test phase. I had a few ideas I would like to include in the final project which make a lot of sense and provide much much more functionality.

    1)  The SK5126 chip provides 2 pinouts for a PS/2 mouse (1 clock, 1 data) which means that I can simultaneously, without changing the chip, have a small mouse/trackpad allowing for more precise control without having to reach up for the touchscreen. Blackberry's trackpads automatically spring to mind, but upon reading the pinouts online, I don't understand how I can interface this as PS/2 data. If anyone has any information or ideas on how to achieve this, please let me know.

    2)  As the keyboard occupies the only USB port on the entire phone, I am also thinking of adding a USB hub chip with power support. This will allow me to charge the phone and plug in all sorts of OTG devices without having to unplug the keyboard every time. I think this is relatively easy to achieve and there are many chips out there which facilitate this.

    Let me know if you have any other relevant ideas I might try to incorporate into this project.

  • Scope of testing and known issues

    kylemonti11/10/2019 at 15:07 0 comments

    In its current test-phase, the complete phone and keyboard assy are rather bulky (more precisely it's just too long to fit in any reasonable pocket). Also, the weight on the phone means the whole thing is a bit top heavy and makes typing on it a bit less comfortable. This has been forseen which is why in the final build (the slider) I intend to pull the battery out of the phone and stick the battery right behind the keyboard and then attach a flexible extension cable to the motherboard which allows power to be delivered via the slider mechanism together with D+ and D- cables from the SK5126 chip. The battery connector seems to be a Hirose BM25, which I cannot find from the same shop I bought the BM 14B connector. This is my next task as it is a showstopper until I'm able to provide power to the phone of course.

    Another annoying issue comes from the BM14B connector which adapts the keyboard's I/O. due to the extremely small pitch of 0.4mm between each solder, the SK5126 sometimes detects a small amount of voltage between 2 adjacent pins and registers this as a keypress. This problem has been largely mitigated by putting resistors in line with the rows, this also resolves any capacitative effect happening between these extremely close pins. Nonetheless it still manifests itself from time to time and I intend to keep a close eye on it during this test phase. 

  • Practical test phase

    kylemonti11/10/2019 at 14:48 0 comments

    At this point in time, I have installed the keyboard and both PCBs on a sheet of PVC which I used to make a special cover for the phone. This allows me to test out the complete system in a practical manner without having to modify the phone at all. A switch on the side cuts off the power to the chip and will be connected to the slider in the final build to switch on the keyboard only when it is extended. The red and green LED's are indicators for ALT and Caps Lock respectively (they are driven directly by the SK5126 encoder which is another great reason to use that chip). 

View all 5 project logs

Enjoy this project?



Roberto A. Foglietta wrote 01/21/2024 at 15:29 point

Hi, nice work! However the last log update is quite updated and the BBQ20 get out in the mean time but it is not available anymore on the market. What's about developing 3rd release supporting BT/BLE with a small rechargeable Lithium battery in order to use the keyboard wireless and as a standalone gadget?

  Are you sure? yes | no

kylemonti wrote 05/19/2024 at 06:20 point

Hi, unfortunately I've abandoned this project long ago because for what it was worth for me, it was no longer worth the troubleshooting. There is however someone who is selling finished keyboard units with BT, you need to look for it a bit.

  Are you sure? yes | no

Dakkaron wrote 01/03/2024 at 01:14 point

Hi, looks like you came up with a similar idea as I did.

Did you ever get it working?

If not, maybe you'd like to checkout my project:

  Are you sure? yes | no

kylemonti wrote 05/19/2024 at 06:31 point

Oh wow, great job mate! That does look similar to what I built.
I did get it sort-of working as a demonstrator, but I never managed to mount it on the sliding chassis of the priv and have that working.

I used the SK5126 because I've got no programming skills (anymore) and so I had to use Sprintek's software to program the Keyboard matrix. Also, the hirose connector was a real pain to solder and, in the end, when everything was working, I kept getting ghost keys occasionally because the Hirose connector has a spacing of only 0.4mm and each pulse kept interfering with the adjacent rows. Adding resistors did not help dampening it that much. 

Given that, and the fact that I could never get everything to fit and balance on the Priv's sliding chassis, I decided I had gone far enough and learnt far enough from that project to move on to something else. I'm glad you build your project too, and I'm glad someone else is actually selling those BB keyboards with BT functionality.

  Are you sure? yes | no

kylemonti wrote 12/10/2019 at 10:50 point

@RW Is that the lead based one? Or do you know a particular part number/composition? Both my iron and heat gun are controlled temp. And I've got 19 connectors spare so I might give that a shot. Cheers.

  Are you sure? yes | no

RW wrote 12/10/2019 at 13:29 point

The stuff I've got is ancient, not sure the label on the tube is readable. I think it's just a tin/bismuth one. (Surprising it still seems to work given the 6 months or 1 year shelf life I'm seeing on these now) . The "good stuff" is meant to be the Motorola spec Indalloy 282  Bi57Sn42Ag1 which has mechanical strength equivalent to normal solders, yet melting point is down around 138C. They are all lead free I think due to lead crystallising and making it all crumbly if it gets in contact with Bismuth. That's the caveat with them, you have to make connections on clean, bare copper, to make sure they don't mix with another solder and go weak. However, the cheaper stuff and joints that can only be cleaned down to light tinning, can still be protected mechanically by immobilising the wires with glue and tape etc. This wouldn't be recommended for higher power connections though. 

  Are you sure? yes | no

RW wrote 12/09/2019 at 03:43 point

Nice, following because I've got some old BBs I wanna repurpose the keyboards from. What bugs the hell out of me on android though is the number of emulators or other ports of keyboard heavy applications that don't use the standard keyboard drivers. Some of them your hardware keyboard doesn't work at all only their custom software keyboard. Some of them, really only the alphabetic keys work, try and shift for symbols etc, and they act dumb. Extremely annoying when most of these are what I want a physical keyboard FOR. Some have variant behaviour with types of keyboard, possibly driver differences, a phone with a slider keyboard, that I've also used USB KB and a Bluetooth KB on, different keys and functions don't work, super frustrating. 

  Are you sure? yes | no

kylemonti wrote 12/09/2019 at 06:07 point

sounds more like an issue with the keyboard manufacturer. It all boils down to the encoder chip.

For me the worst ordeal has been soldering the hirose bm14b connectors which connects to the keyboard to the breakout pcb. Hot air melts them well before the solder paste. Using an iron to heat up the tracks individually proved better but causes a lot of microscopic shorts between them (the pitch is only 0.4mm). Hold the iron a second too long, and the connector once again deforms. What I've discovered is that if the shorts are too small to be seen, I can melt them away by hooking up a 1.5v battery to 2 of the shorting pins for a second, causing the short circuit to melt that last bit of solder under the connector without damaging it. Its the only way I've managed to make it work.

  Are you sure? yes | no

RW wrote 12/10/2019 at 03:07 point

Well they'll work fine in android specific applications, text and document editors etc, or for typing anything into text boxes in the browser like this one. 

One can find low temperature solder paste that flows at 180C or something like that, possibly lower. Kinda difficult if you don't have a temperature controlled iron though, you kinda have to pulse width modulate the heat transfer manually.

Also you can get for cars in an automotive store "defogger repair epoxy" or paint, which you might tack down fine wires with. It will add a couple of ohms though. 

  Are you sure? yes | no

kylemonti wrote 11/10/2019 at 15:26 point

Special thanks to @arturo182  on github who published the pinouts to the BB Q10 keyboard.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates