ModelM-BT is an Arduino sketch used to bluetooth-enable an old IBM Model M keyboard. It is based on an original idea described at Adafruit's website.
The original project's code is based on a hacked and incomplete version of TMK Keyboard Firmware and it's huge! So I decided to write my own code with the following properties:
- small footprint
- easy to understand, very well componentized
- fully unit tested, have confidence it works
- interrupt driven solution rather than bit banging
To this end, I first implemented a fully generic and reusable library for interfacing with PS2 devices called PS2Utils.
I wrote Bluefruit, a simple class to interface with Adafruit's Bluefruit EZ-Key module. I put PS2Utils and Bluefruit together into a complete sketch to fully enable my keyboard.
Pictures of the keyboard at various stages of development can be found on my Google+ stream.
The following hardware components were used to build this project:
- A old Model-M keyboard (thanks Stef!)
- OSEPP Nano, Arduino Nano compatible
- Adafruit Bluefruit EZ-Key
- Adafruit PowerBoost 500c
- Adafruit Lithium ion polymer battery
- Wires, buttons, resistors
If I were to do this again, I'd make the following changes:
- Use an Arduino Pro Mini board, to make the modified keyboard as power efficient as possible. While the OSEPP is great for prototyping, it has too many unneeded components like voltage regulators, USB circuitry, and extra LEDs for a production device.
- Use a 3.3V Arduino rather than a 5V part. Not only would this use less power, it would obviate the need for the resistors to connect the Arduino to the Bluefruit.
- Put the PowerBoost 500c micro USB port much closer to the outer casing so that it would be easier to plug in for recharging.
Because Model M keyboard were built long before the Windows key was added to keyboards, this sketch remaps the Caps Lock key as a Windows key. To get a real Caps Lock, press ALT+CapsLock.
Hold ALT+KeypadMinus down for five seconds to pair the keyboard with a computer. The pairing will be remembered until the keyboard is re-paired. Tested with Windows 7, MacOS 10.10.3, Ubuntu 14.04, and Android Lollipop.
This project uses a rechargeable battery, so I never need to open up the keyboard to change batteries. The keyboard only lasts 13+ hours on a single charge though, so it needs to be plugged in every day.
To use this sketch, first install the PS2Utils library into the IDE. Then clone this repository as follows:
$ git clone [email protected]:rogerta/ModelM-BT.git
Open the ModelM.ino sketch and upload it to your Arduino.
Written with StackEdit.