Page 1 of 2
IBM 5140 "Convertible" conversion
Posted: 17 Jan 2015, 18:55
by copter
I found old IBM 5140 Convertible and noticed that it has a really nice keyboard. After thinking for a while what to do with it, I decided that I will convert it as desktop keyboard, as the layout is really nice and switches also into my liking.
There has been some discussion about this keyboard earlier ( here:
http://deskthority.net/other-languages- ... t3977.html ), but I didn't find much info so I decided to take look. Here's couple pictures from the keyboard after I disconnected it from the "laptop".

Overview from the keyboard, sitting next to my normal size TKL. There's still some FIN layout stickers on keys that I plan to remove. Probably I will be replacing stickers with new transparent ones, as I prefer ISO / FIN layout and I don't think that I can find proper caps for this keyboard.

PCB from the backside. I added those small rubber feets before taking pictures, so it doesn't sit directly on top of my table.
I did measure the matrix and it has diodes in place, they are also marked into the PCB, so measuring was quite easy, took maybe just 20 mins.

Ribbon cable connector at PCB, into which I marked first and last pin. First one has also been marked to PCB in my unit.

End of the ribbon cable. You can see pins from PCB how they come out in the other end. From right to left lower row has all uneven ones and upper row has the even ones then.
My plan is to build desktop keyboard from this one. I'm going to keep the PCB and it's support (proper steel) as they are. Not sure what I'm going to do about the case, but I have some ideas that I will get back to after I just get the keyboard working otherwise. Anyway I want to keep the original feel to it, so maybe I'll 3D print matching bottom cover for it.

After measuring I came up with this matrix. Rows are marked with letters A-F and next to them you can see pin numbers from PCB / connector. Columns are marked with numbers and next to logical number is pin number for each column. Inside the matrix there is switch number (printed in the PCB) and their rought translation to FIN layout (Sorry, I haven't yet removed the stickers..).
Next phase is to hook this into a controller. Unfortunately I'm still waiting for my Teensy for this project, so I cannot proceed. I have some Arduino controllers available, but it seems that they are not compatible with tmk_keyboard. Meanwhile waiting for the controller I think it's time to get rid of those stickers and do some cleaning too!
Posted: 17 Jan 2015, 19:01
by scottc
That seems like a very interesting project. That's a decent layout and the switches are nice. How do they feel? Those keycaps must be dyesub PBT, so they're probably gorgeous.
Do you have any Arduino Leonardos or Micros? They'll run both Soarer's controller and TMK.
Posted: 17 Jan 2015, 19:08
by copter
I have Arduino Micro R3, but it doesn't have enough pins (21 needed). I also have Mega 2560 R3 which has enough pins, but I don't think ATmega2560 is compatible?
Keys feel really nice and keycaps are original dyesub PBT. All in very good condition, as I know the history of the computer from which I did take this. It hasn't been used much.
Posted: 17 Jan 2015, 19:09
by seebart
very nice find copter. That will certainly be quite an exclusive desktop keyboard! It´s somewhere between TKL and 60%. So it has ALPS low profile green Slider linear for the F keys and ALPS brown Slider tactile for the rest? NICE! I´d like to see a picture of a cap and switch if possible.
Posted: 17 Jan 2015, 19:12
by scottc
There are a couple of nice pictures on the wiki here:
http://deskthority.net/wiki/Alps_SKCL_Compact
Also check out the linked pages at the bottom - the Japanese ones are really good.
Posted: 17 Jan 2015, 19:15
by copter
I'll be adding some higher resolution pics in a while.
Posted: 17 Jan 2015, 19:53
by copter
Here's more photos as promised.

Normal and small keycap from the side.

Normal and small keycap from the bottom.

Overview from the keyboard when some keycaps are removed.

ALPS brown Slider tactile (all normal sized keys).

ALPS low profile green Slider linear (arrows, FN, top row).

Better picture from the PCB, transparent cover removed. From this picture can also be seen, that transparent plastic cover is actually mounted to proper supports, so future bottom cover etc can be attached to these places as well.
Posted: 17 Jan 2015, 20:17
by seebart
Thanks for the pictures copter! Ah that Alps PCB is nice too,my kind of logo on there.

Posted: 17 Jan 2015, 22:47
by jacobolus
Huh, I’ve never seen a non-US-layout 5140 before. Neat.
I believe HaaTa already has code for scanning the 5140 matrix.
https://github.com/kiibohd/controller/b ... e/matrix.h
Posted: 18 Jan 2015, 12:33
by copter
Last night I realized that I actually can use more than 20 pins from my Arduino Micro R3, as there are some pins which are normally reserved when making sketches with Arduino IDE. For example MOSI, MISO and SCK can be used also when using avr-gcc etc.
So I loaded Soarer's controller software into Arduino without any problems and then made matrix for it, which I sent to the controller too. Unfortunately I didn't get it to work from some reason. There's nothing coming from the keyboard.
I'm not sure where the problem is, I might have missed something as Soarer's controller documentation is a bit short. What I did was that I loaded up the controller firmware into the controller and after that the controller is detected just fine and I can see that it's online using "scinfo". Also I can see that it is detected as USB HID device when I plug it into Linux and check dmesg. After this I made the matrix (below) and converted it into binary using "scas" and then wrote the binary to controller using "scwr". This all went without errors etc. I tried this with two matrix configurations, but result was the same. Sure I tried to reboot the controller using "scboot" and also disconnected it couple times etc.
Have I missed something, do I need some other configuration as well, maybe something from the converter configuration?
Here's the Matrix I made (I also tried reversing it as HaaTa's matrix suggested):
Code: Select all
# Matrix setup for IBM 5140
matrix
scanrate 1
debounce 5
blocking 0
# ARDUINO PINS 0 1 2 3 4 5 6 7 8 9 10 11 12 SCK MOSI
# KBD PINS 1 3 5 7 9 11 13 15 17 19 21 22 23 25 26
# --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# ANALOG 0 / KBD 18
# ANALOG 1 / KBD 16
# ANALOG 2 / KBD 12
# ANALOG 3 / KBD 10
# ANALOG 4 / KBD 6
# ANALOG 5 / KBD 4
# layout 1
sense PD2 PD3 PD1 PD0 PD4 PC6 PD7 PE6 PB4 PB5 PB6 PB7 PD6 PB1 PB2
strobe PF7 ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 NUM_LOCK SCROLL_LOCK INSERT DELETE
strobe PF6 BACK_QUOTE 1 2 3 4 5 6 7 8 9 0 MINUS EQUAL BACKSLASH BACKSPACE
strobe PF5 TAB Q W E R T Y U I O P LEFT_BRACE RIGHT_BRACE UNASSIGNED UNASSIGNED
strobe PF4 CAPS_LOCK A S D F G H J K L SEMICOLON QUOTE UNASSIGNED ENTER UNASSIGNED
strobe PF1 LSHIFT Z X C V B N M COMMA PERIOD SLASH RSHIFT UNASSIGNED PAD_ASTERIX UNASSIGNED
strobe PF0 LCTRL FN1 LALT UNASSIGNED UNASSIGNED SPACE UNASSIGNED UNASSIGNED UNASSIGNED RALT LEFT UP UNASSIGNED DOWN RIGHT
# layout 2
# sense PB2 PB1 PD6 PB7 PB6 PB5 PB4 PE6 PD7 PC6 PD4 PD0 PD1 PD3 PD2
# strobe PF7 DELETE INSERT SCROLL_LOCK NUM_LOCK F10 F9 F8 F7 F6 F5 F4 F3 F2 F1 ESC
# strobe PF6 BACKSPACE BACKSLASH EQUAL MINUS 0 9 8 7 6 5 4 3 2 1 BACK_QUOTE
# strobe PF5 UNASSIGNED UNASSIGNED RIGHT_BRACE LEFT_BRACE P O I U Y T R E W Q TAB
# strobe PF4 UNASSIGNED ENTER UNASSIGNED QUOTE SEMICOLON L K J H G F D S A CAPS_LOCK
# strobe PF1 UNASSIGNED PAD_ASTERIX UNASSIGNED RSHIFT SLASH PERIOD COMMA M N B V C X Z LSHIFT
# strobe PF0 RIGHT DOWN UNASSIGNED UP LEFT RALT UNASSIGNED UNASSIGNED UNASSIGNED SPACE UNASSIGNED UNASSIGNED LALT FN1 LCTRL
end
I did check my wirings couple times, they should be OK. If there is nothing I have missed, then maybe I have problems with some of the pins that I'm using from Arduino.
Posted: 18 Jan 2015, 15:36
by Hypersphere
I got an IBM 5140 convertible computer mainly for the keycaps, which are Alps-mount dye-sublimated PBT. The caps fit Matias switches perfectly, and they now adorn my KBP V60 Matias Click keyboard. I've donated the computer itself to a local computer repair shop that is opening a vintage computer museum. I am very pleased to see someone converting the IBM 5140 keyboard for desktop use.
Posted: 18 Jan 2015, 19:37
by jacobolus
Brown Alps switches are pretty fun.
Unfortunately I didn't get it to work from some reason. There's nothing coming from the keyboard.
Really hard to tell without a bit more context, and I’m not the person to ask. Do you have a multimeter you can use to check that all the wires and traces are hooked up the way you think they are? What kind of debugging have you tried to do? If instead of using an existing keyboard firmware, you just make your microcontroller code strobe one pin and read out on one other pin, and blink a light or something when you get a positive result, can you actually read a switch that way?
Posted: 18 Jan 2015, 20:26
by copter
I have been trying to figure this out today. I have checked the wiring with multimeter and I made my initial matrix using that one. Also I checked Haata's matrix, which is similar so I think I have the matrix figured out.
When I have all the wires connected I get nothing, but if I disconnect the wires then I get some characters coming through, probably generated by floating. I checked with hid_listen.exe that there is actually nothing coming through when the wires are connected. I also tried to set strobe_mode to 4, so then I got huge amount of keystrokes coming from the controller without pressing anything. So I think the controller + firmware is OK, but problem is in the wiring or on controller pins.
Columns are connected to the cathode side of diode and switch to anode in the PCB. Rows are connected to the other side of the switch. I connected pins like I have put them into matrix and then controller ground to PCB ground. I'm I missing something. Could it be that I need to supply VCC somewhere too? I tried to look information regarding this, but it seems that in all diagrams just rows and columns are connected, no mention about ground or VCC when diodes are in play. I also tried to disconnect ground as I'm not sure is it needed here, but it didn't have any effect.
Posted: 18 Jan 2015, 20:41
by copter
I also checked that if I put my multimeter into "beep" mode and put + strobe into row 1 (KBD pin 18) and - strobe into column 1 (KBD pin 1) and then press ESC, it gives me a signal like it should (as per matrix). I moved it to next column 2 (KBD pin 3), it does the same when I press F1. So to me it seems that matrix is OK.
Maybe I'll just wait for Teensy++ so I get all pins properly in place. Maybe Arduino is reserving those MOSI / MISO / SCK pins into something. Just weird that I would expect to get something at least from some rows / columns even if some pins are not working like expected.
Posted: 21 Jan 2015, 00:48
by copter
Well, my Teensy controllers haven't yet arrived, but as being persistent I still wanted to try with Arduino Micro R3. More I was thinking about it, I saw no reason why Soarer's firmware would not work there as the chip was supported and others have had success with it.
So instead banging my head in the wall with the same stuff as during weekend, I decided to write small Arduino sketch instead to try all the switches from the keyboard to see that error is not in the wiring or in my matrix configuration. It didn't take much time as Arduino has well working KeyPad library. So I did my matrix there and I was able to read all switches there properly, so now I know that I have all connections done right.
I replicated exactly the same matrix with same pins and everything into Soarer's firmware, but result was the same. Not working. So I guess there is something in the firmware that makes Arduino Micro R3 to not work right.
This is my current matrix configuration:
Code: Select all
# Matrix setup for IBM 5140
matrix
scanrate 1
debounce 5
# ARDUINO PINS D18/A0 D19/A1 D20/A2 D21/A3 D22/A4 D23/A5 D6 D5 D4 D3 D2 D12 D14/MISO D15/SCK D16/MOSI
# KBD PINS 1 3 5 7 9 11 13 15 17 19 21 23 25 26 22
# --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# D13 / KBD 18
# D11 / KBD 16
# D10 / KBD 12
# D9 / KBD 10
# D8 / KBD 6
# D7 / KBD 4
# layout 1
sense PF7 PF6 PF5 PF4 PF1 PF0 PD7 PC6 PD4 PD0 PD1 PD6 PB3 PB1 PB2
strobe PC7 ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 NUM_LOCK SCROLL_LOCK INSERT DELETE
strobe PB7 BACK_QUOTE 1 2 3 4 5 6 7 8 9 0 MINUS EQUAL BACKSLASH BACKSPACE
strobe PB6 TAB Q W E R T Y U I O P LEFT_BRACE RIGHT_BRACE UNASSIGNED UNASSIGNED
strobe PB5 CAPS_LOCK A S D F G H J K L SEMICOLON QUOTE UNASSIGNED ENTER UNASSIGNED
strobe PB4 LSHIFT Z X C V B N M COMMA PERIOD SLASH RSHIFT UNASSIGNED PAD_ASTERIX UNASSIGNED
strobe PE6 LCTRL FN1 LALT UNASSIGNED UNASSIGNED SPACE UNASSIGNED UNASSIGNED UNASSIGNED RALT LEFT UP UNASSIGNED DOWN RIGHT
end
Posted: 21 Jan 2015, 01:12
by Muirium
copter wrote: Well, my Teensy controllers haven't yet arrived…
If you're after some for a fair price, my little Teensy GB is just about to wrap up:
http://deskthority.net/group-buys-f50/e ... t9602.html
Good luck with the Arduino. I had to fight with a Pro Micro once, and it drove me half mad. I'm lazy and stick to Teensies for controllers now.
Posted: 21 Jan 2015, 01:22
by copter
I guess this is my last experiment with Arduino in these purposes too if Teensy just fires up without any issues. Other solution would be to make my own firmware using Arduino IDE and then updating USB HID firmware into it, but probably somebody has already done this already. But to me it seems that there is already plenty of different firmwares available, so maybe there is no need for such anymore.
Posted: 21 Jan 2015, 06:31
by hasu
I'm not experienced with Soarer's firmware in fact, though, I hope this helps.
Probably sense and strobe configuration are reversed probably.
And you *can't* reset the board with 'scboot' because Leonardo and Teensy use different size bootloader. You have to use reset button on the board.
And If you have trouble on PF4-7 follow this. If not you can ignore this.
https://github.com/tmk/tmk_keyboard/wik ... of-usb-avr
EDIT: s/can/can't/
Posted: 21 Jan 2015, 08:25
by copter
Thanks from the reply. I will take a look into tmk_keyboard probably tonight unless I get something to my mailbox today from Floris.
Posted: 24 Mar 2015, 01:07
by copter
Been a while since I have been updating progress on this one. I got the controller stuff sorted out in the end and got everything working like it should.
But now it seems that one of the arrow key green slider switches has a contact problem, it doesn't register all key presses. I did measure it and it seems that the problem is inside the switch.
Does anybody have a hint how to disassemble it safely and where to look for the problem? It seems that if key is pressed stronger, then switch works better.
Posted: 11 May 2015, 21:05
by Touch_It
I know there are switch opening guides around. I am no expert though and am probably not of much help with that. If I might ask though what did you pay for yours? I found one but I have no idea what they are worth.
Posted: 25 May 2015, 12:23
by copter
I got this one "free" as IBM 5140 was from my company, in where our service technicians used it on the field during 80's. I expected it to be in bad condition, but then later I found out that actually most of it's time it did sit at the office unused as normal service people didn't know how to use computers at the time..
Anyway I have seen complete 5140 computers going 120-300+ EUR in eBay, depending from condition and options. Not really sure is my opinion correct, but I would say that working 5140 without any options should be less that 200 EUR. If you got only the keyboard, then I think 50-80 EUR might be a good start(?). Maybe someone else knows better.
I'm not interested from selling. I just seem to buy stuff into my corners heh. I still have the full working computer without keyboard if someone is interested (I guess not).
Posted: 25 May 2015, 18:10
by Redmaus
Yeah I have a board like this that I am selling. Brown alps is the best alps.
Re: IBM 5140 "Convertible" conversion
Posted: 25 May 2015, 18:12
by seebart
And I'm still thinking about buying yours Redmaus!
Posted: 25 May 2015, 18:14
by Redmaus
Please do. I have some really sweet boards like that and then I have a few regretful decisions like buying the piece of shit pictured.

- IMG_2202.JPG (91.66 KiB) Viewed 15196 times
Re: IBM 5140 "Convertible" conversion
Posted: 25 May 2015, 18:16
by seebart
I bought boards in the past I wouldn't buy again today too. Happens.
Posted: 31 Jan 2016, 00:56
by Hypersphere
@copter: Have you been able to make any further progress with your IBM 5140 keyboard? I also have one of these. It has a very nice sound and feel, and I would also be interested in converting it to USB.
Would it be possible to make use of the controller that is in the IBM 5140 computer, or would it be better to disconnect the keyboard from the ribbon connector and connect it to a Teensy with Soarer's converter?
An alternative, although somewhat sad, would be to desolder the switches (nice Alps browns) and install them in an Alps keyboard kit or in another Alps-switch keyboard, such as a KBP V60 Matias.
Posted: 31 Jan 2016, 08:34
by copter
Been a while since I have been updating this thread. I got the keyboard working in the end, but forgot to update progress into here. Also last year I had some personal issues which required me to take some time off from computers and keyboards, so this project as well all other DT activity were in hiatus because of that.
I equipped this board with Teensy and Soarer's firmware as my intentions originally were. After I got the matrix working last year, I found one broken switch (up key), which caused me to stop working with this board for a while, but actually just last week I managed to fix it as I wasn't able to find a replacement switch.
Problem with the broken switch was that it didn't always register key presses (surprise). I had never opened Alps switch before, but found some nice guides regarding it and decided to give it a try as I didn't have much to lose. Naturally I was afraid that I will break it more, which was the reason why I didn't do it in the first place as soon as I found the problem. I desoldered and removed the switch, bend the contacts a little to take better contact and then soldered back into it's place. This fixed it and took just couple minutes, afterward naturally I felt a bit silly as I had been postponing this easy operation for a so long time..
So now I have the board working 100%. Board is really nice to use, specially because of the dedicated arrow keys and it functions currently as my secondary computer keyboard because of it's compact size. I did make some case drawings also, but never submitted them into a laser cutting service.
I'll post some pictures, my "final" Soarer's configuration and also case drawings later today.
Posted: 31 Jan 2016, 08:58
by copter
This is how my board looks currently:

Posted: 31 Jan 2016, 09:42
by copter
And here's my Soarer Controller configuration:
Code: Select all
ifset any
ifkeyboard any
ifselect any
matrix
scanrate 1
strobe_mode 0
sense_polarity 0
debounce 5
blocking 1
debounce_method 0
sense_delay 1
sense PF2 PF3 PF4 PF5 PF6 PF7
strobe PD0 ESC BACK_QUOTE TAB CAPS_LOCK LSHIFT LCTRL
strobe PD1 F1 1 Q A Z FN1
strobe PD2 F2 2 W S X LALT
strobe PD3 F3 3 E D C UNASSIGNED
strobe PD4 F4 4 R F V UNASSIGNED
strobe PD5 F5 5 T G B SPACE
strobe PD7 F6 6 Y H N UNASSIGNED
strobe PE0 F7 7 U J M UNASSIGNED
strobe PE1 F8 8 I K COMMA UNASSIGNED
strobe PC0 F9 9 O L PERIOD RALT
strobe PC1 F10 0 P SEMICOLON SLASH LEFT
strobe PC2 NUM_LOCK MINUS LEFT_BRACE QUOTE RSHIFT UP
strobe PC3 SCROLL_LOCK EQUAL RIGHT_BRACE UNASSIGNED UNASSIGNED UNASSIGNED
strobe PC4 INSERT EUROPE_2 UNASSIGNED ENTER BACKSLASH DOWN
strobe PC5 DELETE BACKSPACE UNASSIGNED UNASSIGNED UNASSIGNED RIGHT
end
layerblock
FN1 1
endblock
remapblock
layer 1
LEFT HOME
RIGHT END
UP PAGE_UP
DOWN PAGE_DOWN
LCTRL LGUI
BACKSLASH PRINTSCREEN
NUM_LOCK PAUSE
endblock
I haven't mapped or configured numpad keys as I don't really have any use for it.