[Tutorial] Cheapest IBM 4704 Keyboard USB Conversion

User avatar
karlmartin95

21 Jul 2019, 21:25

Hi, I made this post to help you to convert your IBM 4704 keyboard to USB with a cost less than 10 USD!

Capacitive F50, F62, F77 and F107 can be converted with this method.

Image

This post took me some work, but after all I did it!.

First, I have to thank to HASU: https://geekhack.org/index.php?action=profile;u=3412 the creator of the firmware that allows one to convert any 4704 keyboard to usb.

Second, Why do you want to do this?
Short answer: Why not?
Large answer: I want to convert this awesome board to USB without loosing the original cable and the amazing original logic board that has an Intel 8048 Microcontroller from 1977

Image

Third, let's start the tutorial!

What do you need?
  1. Arduino Pro Micro 5V 16Mhz
  2. A welder and some soldering skills
  3. DB-9 female RS232
  4. PC with Linux (You could use a virtual machine, I used Kali Linux with VirtualBox in WIN10)
Instructions:

Before we start, here is my F77 layout:

Image

When you press the L1 key (and you keep it pressed) you have access to the layout level 1 and you can use the F keys, ESC and some others keys.

Here the download link of my firmware: https://drive.google.com/open?id=1VCUKv ... G8_gO2JhaN
To upload the code to the arduino go to step 8

Let's begin...
  1. Download the main tmk keyboard master file from here:
    https://drive.google.com/open?id=1ZtyH- ... MaznSZK0k_
    Or you can clone the original repo:
    https://github.com/tmk/tmk_keyboard
    .
  2. Unzip the folder and go to /converter/ibm4704_usb/ directory.
    .
  3. Make a copy of the file "keymap_plain.c" and rename it with "keymap_YOURNAME.c", in YOURNAME put the name you want.
    .
  4. Open the new file, and you'll see a keymap with 2 levels. Edit the keys with the keycodes you want. Here you can see all the keycodes available: https://github.com/tmk/tmk_keyboard/wiki/Keycode

    But... there's a major problem. I don't know if Hasu knows this, but the key assignation is wrong. In the case of the F77, the extended 15 key pad is wrong assigned. In order to assign correctly the keys in the extended pad, you have to apply this configuration:

    (The image is from the TMK editor and is just for illustration, it's better to show you an image of a keyboard than a C code struct :lol: )
    Image

    As you can see, if you want to achieve MY keymap config, you should assign some keys on the leftmost 10 keys pad and some other keys on the 15 extended key pad.
    .
  5. OPTIONAL STEP: If you are lucky and you keyboard has this buzzer:

    Image

    You could make it work so It'll beep in every key press. Also you could move the knob to adjust the intensity of the beep (completely incredible). So, to make the buzzer works, you have to replace the file "matrix.c" from your original folder with this one:
    https://drive.google.com/open?id=1ixLXJ ... QHNU3RQOx3

    The diference from the original matrix.c and my matrix.c is that my file has a call to a function that sends to the logic board the command to make the buzzer beep.
    .
  6. Open the Linux Terminal and navigate to the directory where you are working, in /converter/ibm4704_usb/
    Now, type this command to install the required programs to generate and compile the firmware and to flash the arduino.

    Code: Select all

    sudo apt-get install binutils gcc-avr avr-libc uisp avrdude flex byacc bison
    
    .
  7. Now, execute this command to generate and compile the firmware:

    Code: Select all

    make -f Makefile.rev1 KEYMAP=YOURNAME
    Where YOURNAME is the name you assigned to your keymap previously. That command will generate a ".hex" file with the name "ibm4704_usb_rev1.hex", you can rename it with the name you want, just keep the .hex extension.

    Alright, we have the firmware compiled and ready to run in the AVR architecture of our ATmega 32u4
    .
  8. This step should be done very quickly, you have to start the arduino in Bootloader mode in order to load the firmware in the flash memory of the arduino. You can pick a male-male cable (like the ones used in the protoboards) and you have to connect the RST (RESET) pin to GND pin 2 times. Put one side of the cable in the RST pin and then touch 2 times the GND pin. This will make the arduino run the Bootloader sequence for 8 seconds. During this lapse of time you have to do 2 important things:
    But before do that, keep in mind that you could start the bootloader of the Arduino the times you need or you want. So, don't get frustrated if your first 8 seconds passed away.

    a) Open your ArduinoIDE or list the connected devices to the computer and you have to get the PORT where the Arduino Pro Micro is connected.
    b) Once you know where the Arduino is connected, navigate again to the folder where you were working and execute this command to upload the firmare to the Arduino:

    Code: Select all

    avrdude -p atmega32u4 -P PORT -c avr109 -U flash:w:YOURFIRMWARENAME.hex
    
    Where PORT is the port that you got in the a) step, and YOURFIRMWARENAME is the name you assigned to the .hex firmware created before.
    .
  9. Create the External Adapter:

    Ok, now you have to solder 4 cables to the Arduino Pro Micro and then to the DB9 female. Here's the Pinout:

    Image
    .
  10. If you are a perfectionist like me, buy some heat-shrink tubes (tubos termocontraibles en Español) of diferent sizes. The smaller to the cables that go from the Arduino to the DB9 female and a bigger to cover all of the Arduino.
    And the final result:

    Image

    Image
That's all, have a nice modding and thanks to everyone in this awesome community to keep this kind of boards alive!

Extras:
More images, files and a Spanish Tutorial can be found here:

Code: Select all

https://drive.google.com/open?id=13sXdTo4nhBX766Igrpeld0Vr6gystcRi
PD: If there is some English typo let me know in a PM please! :D Also if you need help you can PM me too ;)

Good Luck!
Last edited by karlmartin95 on 21 Jul 2019, 23:20, edited 1 time in total.

User avatar
karlmartin95

21 Jul 2019, 23:19

Enjoy!

User avatar
Redmaus
Gotta start somewhere

22 Jul 2019, 00:16

Now all I need is a 4704

User avatar
dcopellino

22 Jul 2019, 00:44

Redmaus wrote:
22 Jul 2019, 00:16
Now all I need is a 4704
No problem, you'll find it here for free
bp.jpg
bp.jpg (8.85 KiB) Viewed 1755 times
:D

User avatar
Muirium
µ

22 Jul 2019, 01:01

Yup, TMK speaks almost everything, 4704 included. I remember running this when I first got my Kishsaver and Hasu first supported them. I consider Xwhatsit's controller an upgrade, though, as I never liked the 4704's original cable, or its bulky end, and Xwhatsit's GUI worked well before Unimap. Nowadays, though, TMK's a solid choice.

So, how does this setup perform? Is it nkro? TMK certainly is, I'm just not sure about the IBM controller. And how much juice does this draw from a USB port? My Xwhatsit Kishsaver is pretty light on power. Even works with an iPad as I recall.

Also, anyone got a good closeup on the IBM badges in that 4704 family picture? The ones I've seen for real are forever badge-less.

User avatar
karlmartin95

22 Jul 2019, 01:17

dcopellino wrote:
22 Jul 2019, 00:44
Redmaus wrote:
22 Jul 2019, 00:16
Now all I need is a 4704
No problem, you'll find it here for free
bp.jpg
:D
:lol: yeah!

User avatar
karlmartin95

22 Jul 2019, 01:19

Muirium wrote:
22 Jul 2019, 01:01
Yup, TMK speaks almost everything, 4704 included. I remember running this when I first got my Kishsaver and Hasu first supported them. I consider Xwhatsit's controller an upgrade, though, as I never liked the 4704's original cable, or its bulky end, and Xwhatsit's GUI worked well before Unimap. Nowadays, though, TMK's a solid choice.

So, how does this setup perform? Is it nkro? TMK certainly is, I'm just not sure about the IBM controller. And how much juice does this draw from a USB port? My Xwhatsit Kishsaver is pretty light on power. Even works with an iPad as I recall.

Also, anyone got a good closeup on the IBM badges in that 4704 family picture? The ones I've seen for real are forever badge-less.
I have no idea about that badge, I've noticed that in the image before.

User avatar
snacksthecat
✶✶✶✶

22 Jul 2019, 23:53

Really nice tutorial. Thanks for taking the time to share it.

User avatar
karlmartin95

23 Jul 2019, 22:22

snacksthecat wrote:
22 Jul 2019, 23:53
Really nice tutorial. Thanks for taking the time to share it.
We must help each other, it's the only way to grow.

User avatar
Redmaus
Gotta start somewhere

05 Sep 2020, 08:02

Thanks Karl! I used your method to convert my F107 I got today :D
IMG_4069.jpg
IMG_4069.jpg (1.93 MiB) Viewed 323 times
IMG_4073.jpg
IMG_4073.jpg (2.2 MiB) Viewed 323 times

User avatar
karlmartin95

08 Sep 2020, 16:44

Redmaus wrote:
05 Sep 2020, 08:02
Thanks Karl! I used your method to convert my F107 I got today :D
IMG_4069.jpg
IMG_4073.jpg
I'm glad it worked for you! Happy clicking!

Post Reply

Return to “Keyboards”