geekhack

geekhack Projects => Making Stuff Together! => DIY Discussions ARCHIVE => Topic started by: Hydron on Sun, 13 June 2010, 01:45:30

Title: Wireless Model M - "look! no wires!"
Post by: Hydron on Sun, 13 June 2010, 01:45:30
Well I thought it was about time somebody got around to making a wireless M, so behold, the bluetooth IBM Model M (and a messy desk):
(http://geekhack.org/attachment.php?attachmentid=11030&stc=1&d=1276411823)
And no, I didn't just unplug the SDL:
(http://geekhack.org/attachment.php?attachmentid=11026&stc=1&d=1276411045)
And no, its not just empty:
(http://geekhack.org/attachment.php?attachmentid=11029&stc=1&d=1276411823)
Date of birth: 14 June 1989, date of rebirth: 13 June 2010 (whoops, it got an early birthday present!)

Works well (so far! - typing this on it now), and has a range of ~5m, smaller than I'd like but good enough. Not sure about battery life, it uses quite a bit of juice while typing but not much when on standby. I'd guess somewhere in the range of 2-6 months with decent batteries, but time will tell. Can lag a little when its coming out of standby, but seems pretty good when you're typing normally.

Anyway, the details of how it works:

The green board in the picture is a PCB out of cheap chinese bluetooth keyboard I found on our local ebay equivalent - cost me $47 NZD shipped (~32 USD right now). On this is mounted a BCM92042 module like the one available here: http://russnelson.com/bluetooth-keyboard-controller.html (http://russnelson.com/bluetooth-keyboard-controller.html)

Unfortunately this module is programmed with the matrix from the chinese keyboard, and broadcom will not tell you how to change it yourself, as a few other people have discovered when trying to use the ones from Russ Nelson.

I was initally going to try and emulate the matrix of said chinese keyboard using a microcontroller and then interface to the IBM one, but this would have been quite a lot of software work and isn't exactly elegant (if I could get it to work at all!). Before I got to work on that though, I decided to see if I could reverse engineer the broadcom module and save myself the hassle of writing a pile of code.

- The first step of doing this was to decode the existing matrix, which I did by scanning the membranes into the computer and using photoshop to colour each wire separately. From this you write down a list of keys on each row/column, and then you can match up the rows and columns to build the matrix table.

- With the matrix in hand, I attacked the EEPROM chip on the broadcom module, assuming that this would hold the matrix information. This chip is the one at the top left of the module in my photo. As you may be able to see, the pins of this are pretty small, so I needed to use a small soldering iron and a stereo microscope to attach wires to the 2 data pins (this EEPROM uses the I2C protocol, which requires 2 wires). I also had to put the module into reset mode so that it wouldn't interfere while I was working with the EEPROM (this is done by locating the reset pin and shorting it to ground), and disconnected another one of the EEPROM pins from the circuit board to turn off write-protect in the chip (again, tricky!).

- With wires in place, I used a USB to I2C convertor box to talk to the EEPROM, and dumped the memory contents (4KB in total). This was then loaded into a hex editor, and I began searching for a key matrix.  This job was made do-able by the knowledge of the existing matrix (which I could match up once I found the correct data), and the fact that the Bluetooth HID spec uses the same scan codes as the USB HID spec. I searched for a few of the HID codes, and found instances of each near eachother in the EEPROM dump - this was the scan matrix!

- With the matrix found, I determined a) which wires on the board corresponded to which row/column in the EEPROM table, b) how the modifier keys worked and c) which rows to avoid, as they had the pairing button and a modifier key hard-coded in elsewhere in the software. I then had enough info to rewrite the table with the IBM matrix (suitably arranged to match the physical board well).

- After testing, the last job was to mount it all on verroboard and chuck it into the case. The soldering here took a while, as you might guess from the photo.

After all this, I have what may be the world's only wireless Model M!

There is a little more work to do (apart from a bit of use to test it) - the pairing button and battery case are not accessible from the outside, so you need to unscrew the case to get at them. This is a pain, and while I might put up with the batteries being inside if they last for long enough, I'd like to have the pairing button accessible, so I might move it to near the SDL hole.

Here is the output from that tester program thing, in the background is the Hex representation of the new matrix I loaded into the module:
(http://geekhack.org/attachment.php?attachmentid=11027&stc=1&d=1276411045)
Note that I have remapped the caps and scroll lock keys in software - this output is normal.

As you might realise from what I've written, this is a LOT of work. Unfortunately most people here are unlikely to be able to do it themselves, especially given that if you buy a module from Russ Nelson you have to make a PCB as well.

Once I've tested this board a bit more, I MIGHT be able to make a couple of boards to send out, however even if this happened it would be very limited as it is a lot of work, and shipping to/from New Zealand is expensive. If I did do this, I'd probably be after something rare in trade rather than money.

Edit: Made the pics smaller. See attachments for bigger versions of the first and third pics (confusingly suffixed _4 and _1 respectively).
Title: Wireless Model M - "look! no wires!"
Post by: Hydron on Sun, 13 June 2010, 01:48:07
Just realised that the pics dont get thumbnailed for the article.  Will repost them here and resize the article ones.

Edit: resized pics in article, big versions still attached in article post if needed.
Title: Wireless Model M - "look! no wires!"
Post by: kishy on Sun, 13 June 2010, 01:53:09
@#$#&^

My idea originally was swapping in a different controller but of course matrix differences make that difficult.

Props for what looks like a very nice job!
Title: Wireless Model M - "look! no wires!"
Post by: noctua on Mon, 14 June 2010, 02:37:51
Reading of the EEPROM datasheets is almost helpful, which application was used for dumping the content from the EEPROM, your own?
Title: Wireless Model M - "look! no wires!"
Post by: Hydron on Mon, 14 June 2010, 03:41:27
I have (borrowed from work) a I2C -> USB adaptor from here:
http://www.i2cchip.com/ (http://www.i2cchip.com/)
The adaptor can be configured to derive its I2C bus power supply from the target device (so you dont have to match voltages), and communicates via RS232 using a simple ASCII protocol. The USB part just uses a standard USB -> Serial convertor.

The EEPROM chip is a FM24C32 (google 24C32, FM is just the manufacturer prefix). This is a pretty standard I2C EEPROM, though i believe they can differ in terms of write protection option between manufacturer. It was pretty easy to interface to, the hardest bit was the soldering (TSSOP pins are pretty small, and they have lead free solder which is a prick to work with).

The soldering is doable without a microscope but you need damn good eyes, a steady hand and a good iron - MUCH easier with a stereo microscope. I actually did one a couple weeks ago without the microscope and got it going, but somehow managed to kill the board 30 min later and needed to order another bluetooth board before I could post the writeup.
Title: Wireless Model M - "look! no wires!"
Post by: noctua on Mon, 14 June 2010, 04:02:43
My first idea for a keyboard controller was similar to use the smaller one 24C16
for storing the keymap usage codes. Like codemercs keywarrior, the idea is
pretty good. I don't extactly remember myself why i have discarded this
way, currently i use ATMEGA (teensy++) without externally EEPROM.
The magnifying glass and small electric soldering iron are my friends
too, only my fingers.. well i do my best ;-)

I'm still interested on your wireless solution!
Title: Wireless Model M - "look! no wires!"
Post by: Hydron on Mon, 14 June 2010, 04:30:11
The only reason I had to deal with the EEPROM was to change the key mapping of an existing controller. An ATMEGA has plenty of room for keymaps without external EEPROM, take a look at the USB Model M controller thread.
Title: Wireless Model M - "look! no wires!"
Post by: passedpawn on Mon, 14 June 2010, 11:51:56
Perfect timinig!  I have a couple of Russ's Blue Packet modules sitting here.  I soldered some  jumper wires and caps on the back of it to get it to pair.  Pretty easy really.

I really need to load my own code onto it.  How much effort did you put into this?  Did Russ know anything about the bootloader?  Was there anything online?

Thanks in advance.  Your wireless "M" is pretty cool.
Title: crazy timing
Post by: astrofy on Wed, 23 June 2010, 15:15:51
crazy timing on this project.  I just began looking in depth on how I might accomplish such a feat.  I actually stumbled upon this site while googling for more information on scan matrixes.  

Anyways, I was wondering if you happened to have a link to that chinese bluetooth keyboard you bought.  

Cheers to an amazing hack.
Title: Wireless Model M - "look! no wires!"
Post by: Hydron on Wed, 23 June 2010, 16:54:32
Quote from: passedpawn;192986

I really need to load my own code onto it.  How much effort did you put into this?  Did Russ know anything about the bootloader?  Was there anything online?


Russ didn't know anything about the bootloader (I asked him before I found the modules locally), so I needed to reverse engineer their code. The ONLY thing I changed was the matrix, and I could only do this because it was stored as a nice table in the EEPROM. I'm not up to trying to dissassemble their code, though I do know it is 8051 code, so someone may be able to (will post the EEPROM dump if needed).

As for loading it on, I needed to use a USB -> I2C device as I mentioned - this isn't exactly what many people have lying around, though they are available for reasonable cost (google bus pirate).

Finally, I found nothing online - looks like I have the first wireless M!

Astrofy: The keyboard I used is this one: http://www.diytrade.com/china/4/products/3214179/Bluetooth_Keyboar_support_SONY_PS3.html (http://www.diytrade.com/china/4/products/3214179/Bluetooth_Keyboar_support_SONY_PS3.html)
If you can get one of these, you get the module already mounted on a board, otherwise buy from Russ Nelson as I linked earlier. The code on his modules should be very similar, and you get to make a PCB tailored to the model M (I'd have got them from him if it wasn't cheaper butchering another keyboard). One note about the chinese keyboard - you'll have to remove the LED to get decent battery life, as its ALWAYS lit for some absurd reason.
Title: Wireless Model M - "look! no wires!"
Post by: armenws on Thu, 24 June 2010, 02:38:44
nice.
Title: Wireless Model M - "look! no wires!"
Post by: jensma on Fri, 25 June 2010, 08:37:21
Simply amazing 8D
Title: Wireless Model M - "look! no wires!"
Post by: Sapphire on Tue, 20 July 2010, 21:35:11
Quote from: Hydron;195818
Russ didn't know anything about the bootloader (I asked him before I found the modules locally), so I needed to reverse engineer their code. The ONLY thing I changed was the matrix, and I could only do this because it was stored as a nice table in the EEPROM. I'm not up to trying to dissassemble their code, though I do know it is 8051 code, so someone may be able to (will post the EEPROM dump if needed).

Hi, Hydron. can you mail me or post the EEPROM dump, i'd like to disassambly this code. too pool information about bcm2042. thanks a lot
Title: Wireless Model M - "look! no wires!"
Post by: microsoft windows on Wed, 21 July 2010, 21:28:09
Quote from: kishy;192668
@#$#&^

My idea originally was swapping in a different controller but of course matrix differences make that difficult.

Props for what looks like a very nice job!


Yeah I remember when you were looking into wireless Model M's. A wireless 122-key one would be interesting. Or even better--a wireless On-the-ball Plus.
Title: Wireless Model M - "look! no wires!"
Post by: clee on Thu, 22 July 2010, 17:37:57
Brilliant. Wish that getting something like this working from scratch wasn't so difficult.
Title: Wireless Model M - "look! no wires!"
Post by: keyb_gr on Fri, 23 July 2010, 16:37:38
Only saw this now - excellent work. :)
Title: Wireless Model M - "look! no wires!"
Post by: EverythingIBM on Sun, 25 July 2010, 16:07:39
Someone should make a wireless M15 =p
Title: Wireless Model M - "look! no wires!"
Post by: microsoft windows on Sun, 25 July 2010, 19:42:04
They could probably sell it for a thousand.
Title: Wireless Model M - "look! no wires!"
Post by: kriminal on Mon, 26 July 2010, 09:19:18
hey what wire type did you use to solder from the breadboard to the chip? been looking for wire that small to do something.
Title: Wireless Model M - "look! no wires!"
Post by: Hydron on Mon, 02 August 2010, 04:46:36
Sorry for the slow replies, have been on the ski field away from technology :P

Sapphire - have emailed you the EEPROM dump, would appreciate to see any info you end up gaining from dissassembling it.

Quote
Someone should make a wireless M15 =p

I'd do this if i could actually get a M15! If someone wants this done I'd accept an extra M15 for myself as payment :P

Quote
hey what wire type did you use to solder from the breadboard to the chip? been looking for wire that small to do something.

The wire from the verroboard (brown board in last pic) is nothing special, just insulated single strand copper wire. Its been in my junk box for at least 15 years, I think I salvaged it out of something when I was a kid. Try solid core ethernet cable for something similar.
The wire I used to solder to the EEPROM however was wire wrap wire, which is a bit more special. Unfortunately I don't have a photo of it, but its really thin, plated with silver (I think) which makes it really easy to solder, and has nice thin insulation that doesnt shrivel up when you get it hot.
Title: Wireless Model M - "look! no wires!"
Post by: Oqsy on Thu, 27 January 2011, 22:51:19
http://geekhack.org/showpost.php?p=286019&postcount=25

should have made that post here...

I'm looking for help / advice on physical connection of model m membrane sheets to this controller, and methods for reflashing eeprom with a model M (42H1292) matrix.

(http://184.72.239.143/mu/adda7fd5-1dc3-496e.jpg)

Ohhh also this chip is a Broadcomm BCM2042 for what it's worth.
Title: Wireless Model M - "look! no wires!"
Post by: Harbinger on Mon, 15 August 2011, 13:31:31
I contacted Blue Packet to see where I could purchase the BT modules in the US. I got a response back saying that module is end-of-life and will be discontinued in October, I believe. If anyone knows how to get hold of Russ Nelson other than his given contact info on his web page, now is the time to do so. He said he was out as of a couple years ago and would gauge how many to order next time by the number of emails he got. I sent him a note saying I wanted two of the modules and it took several tries to get through without a kickback by his overactive spam filters.  I never got a response. Blue Packet recommended another module for new designs, but I'll bet it will require new programming to get it to work...
Title: Wireless Model M - "look! no wires!"
Post by: Hydron on Tue, 16 August 2011, 07:00:15
I had no issues getting in touch with Russ Nelson at the email address given on his website, though it was over a year ago.
My module (and another I blew up) were obtained locally out of a cheap chinese keyboard which used the broadcom module. I actually got offered some damaged keyboards of the same type at a discount a little while ago, but I decided that I didn't really need more than one bluetooth model M (also have a USB converted one and a spare PCB for a second USB mod).

Oqsy: As for help modding that controller, its not a trivial project unless you know what you're doing with regards to soldering small SMD stuff, how I2C works, how to fiddle with the firmware dump, and how to make a (simple) PCB. It appears that the code changes a bit between modules, so while I could supply you my work, there is a good chance its useful only as a starting point. I'm fooling about with this because I'm an electrical engineer; while that's no prerequisite (infact many amateur tinkerers will be more competant than a 'pro' EE at this stuff), its certainly not a good first electronics project.
Given all this however, if you know what you're doing then I'm happy to send you the email that wulax and harbinger got with the details of my work on the firmware code.
Title: Wireless Model M - "look! no wires!"
Post by: Harbinger on Tue, 06 September 2011, 09:10:46
Hydron--the link to that PS3 keyboard comes back bad, and visiting the site to try and find it comes up with nothing. Could you supply more information (keyboard name/model number, perhaps)? I've got to find a module or two...
Title: Wireless Model M - "look! no wires!"
Post by: Salamontagne on Thu, 29 September 2011, 06:01:55
Hi.

First i'd like to thank the author for attempting something like this...totally awesome!

I was wondering about the connection to the pc..is it done via blu-tooth to usb adapter? If so, does it provide legacy keyboard and mouse support?
I'm looking todo something very much like this for my "vintage" pc, A p-233 that luckily has usb ports.

One last question...Is a kit form planned? I know it uses pieces from other keyboards, but i was wondering if there was some way a kit form could be made (since the level of
technical expertise is far far beyond my own) I'd buy one in a kit form if it allowed me to simply unplug the pcb inside the model M and plug in the replacement module and stow the battery in a convient place (I can make a simple access door for replacemnt/rechargeing)

Anyhow, i joined this forum just because this is the coolest mod ive ever seen! way to go!
Title: Wireless Model M - "look! no wires!"
Post by: fohat.digs on Sat, 01 October 2011, 19:16:23
Nice mod indeed!

Way over my head, but maybe someday .....

I am also jealous of a June 14 board, that is my birthday too. The only downside I see is having to crack the case to change batteries. Now that you have had it for a year, what is the realistic battery life under steady use? And what is the battery pack anyway, a few AAAs?

Good work
Title: Wireless Model M - "look! no wires!"
Post by: SamirD on Wed, 16 November 2011, 18:37:28
Nice!  I was hoping someone did this. :)