geekhack Projects > Making Stuff Together!

TMK ADB to USB keyboard converter

(1/248) > >>

hasu:


You can buy preassembled TMK ADB-USB converter here




RESOURCES
ADB protocol:
https://github.com/tmk/tmk_keyboard/wiki/Apple-Desktop-Bus

Source code:
https://github.com/tmk/tmk_keyboard/tree/master/converter/adb_usb




KEYMAP EDITOR
You can edit keymap and download firmware with web browser.

TMK ADB-USB converter rev2(ATMega32u2)
TMK ADB-USB converter rev1 and converter with Teensy2.0 or ProMicro(ATMega32u4)

In the Keymap Editor physical key layout is based on Apple Extended Keyboard(AEK) but you can edit keymap of any other ADB keyboards.




BUILD FIRMWARE
https://github.com/tmk/tmk_keyboard/wiki#build-firmware

SOURCE CODE:
https://github.com/tmk/tmk_keyboard/tree/master/converter/adb_usb


Use 'make' to build firmware for TMK ADB-USB converter rev.2.
Use 'make -f Makefile.rev1' to build firmware for TMK ADB-USB converter rev.1, Teensy2.0 or Pro Micro.

You are recommended to use Keymap Editor above, instead build yourself.





BUILD CONVERTER YOURSELF
You can use PJRC Teensy or other dev board with ATMega32U4/2.


--- Code: ---ADB female socket from the front:
  ,--_--.                 
 / o4 3o \      1: DATA
| o2   1o |     2: PSW(Power SW)
 -  ===  -      3: VCC
  `-___-'       4: GND

--- End code ---

Connect keyboard DATA line to PD0(Pin3 on Pro Micro),  VCC to 5V(VCC on Pro Micro, not RAW) and GND as well.

PSW(Power SW) is not used in current firmware. You don't have to connect it. See this.


pull-up resistor
You must have an external pull-up resistor(1K Ohm) between VCC(5V) and DATA(PD0) line.

Check this wiki page: https://github.com/tmk/tmk_keyboard/wiki/FAQ#pull-up-resistor

1k ohm is strongly recommended.
You can use 1/10W or higher power rating of resistor. See this for resistor power rating.


--- Code: ---Keyboard       Conveter
               ,------.
VCC---------+--|VCC   |
            |  |      |
            R  |      |
            |  |      |
DATA--------+--|PD0   |
               |      |
GND------------|GND   |
               `------'

R: 1K Ohm resistor

--- End code ---

- You may use 4.7k or less resister if you don't have 1k in hand. But it may not work with longer curled cable or daisy-chained multiple devices. 
- See this issue. 4.7k doesn't work in some cases like lenghty cable, curled cable or multipule devices. They required 1k. https://github.com/tmk/tmk_keyboard/issues/683
- 10k ohm didn't work for Turbo Mouse 5 with vintage coiled ADB cable, which is expected to have quite a bit capacitance. 4.7k did work. 2022-03-23
- Kensington Thinking mouse and NeXT mouser didn't work with 10k while they works with 4.7k. https://geekhack.org/index.php?topic=14290.msg3117619#msg3117619
- Griffin iMate and Apple IIGS has even 470 ohm pull-up resistor. https://geekhack.org/index.php?topic=14290.msg3117720#msg3117720




DEBUG
You can use hid_listen to see debug prints.

Debut Outputs
RRR
The "R" on debug output means that the conveter didn't get any respnse to a command within specific term(500ms).
https://github.com/tmk/tmk_keyboard/blob/66e97371bacb1ad55096f0407b47f0a73fadc6c7/tmk_core/protocol/adb.c#L160-L164

This happens when connecting keyboard with converter already powered(hotplug) because keyobard can't response to the converter during its startup. It is not error in this case. But in many other cases the "R" means that there is something wrong on your converter, keyboard or wiring setup.


Sigrok ADB decoder
Cheap $10-20 Logic Analyzer that is compatible with sigrok works well for this job.

Get one and try. 1MHz sample rate is actually good enough for ADB protocol.
You can use this deocoder with sigrok PulseView to see ADB commands and data..

https://github.com/tmk/tmk_keyboard/wiki/Signal-Capture-for-debug#sigrok



TROUBLE WITH YOUR DIY CONVERTER?
You are using Pro Micro?
Confirm it is a 5V version with 16MHz crystal. Make solder bridge on J1 and use VCC for 5V power, not RAW. MUST check this page also.

I'm never willing to recommend you to use Pro Micro unless you are already familiar to it and have skill to solve problems yourself. Pro Micro is bad choice especially if this is your first time project. Alternatives are PJRC Teensy2.0 and TMK converter, of course!

Please don't ask help for problem specific to Pro Micro here.

Don't ask help before placing pull-up resistor and trying solder on J1!

More1K Ohm pull-up resistor You must have an external pull-up resistor(1K Ohm) between VCC(5V) and DATA(PD0) line. 1K ohm is strongly recommended. You may use 4.7K, 10K or any of 1K-10K Ohm resister, if you don't have 1K in hand.

In most cases your wiring is wrong Check your wiring yourself again and again, one hundred times! And try swapping wires at your own risk, note that your wiring are already wrong at this point probably :D It won't break your keyboard unless you are extremely unlucky.

Now you need help? Don't ask help before trying things above!
OK. If you are not sure about your wiring, post pics of your hardware and wriring this really save our time. Don't save your time by omitting this. Shots of controller side and ADB connector/keyboard side would be helpful. Use TMK default prebuilt firmware to test. Also debug outputs from hid_listen command would be useful.

[rant]
Many people said they are sure their wiring was fine first but it became clear they failed to do that in the end many times in this thread :( Don't omit pull-up resistor with your laziness, you better have it absolutely.
Don't take advantage of generosity of kind and helpful members(yes, including me, of course  ;))! Their time is more precious than your time, use your time to learn and look into your problem first.
[/rant]




UPDATE
2012/12/12 Extended keyboard support by blargg
2013/04/08 Fix issue: ADB-USB converter misses keystrokes (NOT FIXED COMPLETELY)
2013/07/22 Changed Pin usage: PD0, NOT PF0 now
2013/10/11 WIP: Fix ADB-USB converter misses keystrokes
2013/11/28 Fix key drop problem finally Thank you, blargg!
2015/04/28 Mouse is supported by mek-apelsin
2015/12/18 Request for help: extended mouse support
2016/06/04 Added LIMITATION section
2016/06/04 Apple Adjustable Keyboard media keys are supported now
2016/09/03 Keymap editor(unimap) is available now
2018/01/19 Fix lag problem on ADB-USB converter
2019/06/23 Added Apple Extended Mouse Protocol and Kensignton Turbo Mouse support
2020-02-13 Updated firmware to fix AEK support
2021-01-24 Change default mapping for 'keypad ='
2021-11-17 Hotplug of keyboard support
2022-04-12 Various pointing devices support
2022-05-05 JIS keyboard support
2022-05-21  sigrok ADB decoder
2022-05-30 Implement 'Address Resolution '
2023-03-12 Fix Remote Wakeup
2023-10-26 Add support for Microspeed MacTrac 2.0(old firmware)



TESTED DEVICES

Check also: https://github.com/tmk/tmk_keyboard/issues/736

Keyboard:
- Apple Extended Keyboard M0115
- Apple Extended Keyboard II M3501
- Apple Standard Keyboard M0116, M0118
- Apple Adjustable Keyboard M1242
- Apple Desktop Bus Keyboard(Apple II GS Keyboard) 658-4081
- NeXT ADB Keyboard ANSI
- NeXT ADB Keyboard German


Mouse:
- Apple Desktop Bus Mouse G5431 Taiwan(1)
- Apple Desktop Bus Mouse II M2706 Taiwan(1)
- Apple Desktop Bus Mouse II M2706 Ireland(?) - See ISSUE below.
- Apple Desktop Bus Mouse II M2706 Malaysia
- Apple Classic Mouse protocol (1, 2)                                                                                 
- Apple Extended Mouse protocol (4)
- Kensington Turbo Mouse 5 #64210 and Thinking Mouse (0x32)                                                           
- Macally 2-button Mouse (0x42)
- Logitech MouseMan/TrackMan Proprietary protocol (0x4C*)                                                             
- Logitech MouseMan/TrackMan Extended protocol (0x4D*)
- NeXT ADB Mouse(1) - See ISSUE below.

TEST REQUIRED
- Micrspeed MacTrac (0x2F, 0x5F) - Not confirmed
- Contour Design Countour Mouse (0x66) - Not confirmed                                                                 
- Mouse Systems A3 Mouse/Trackball (0x03) - Not confirmed                                                             
- CH Products Tracball Pro/DT225 (0x42) - Not confirmed

https://github.com/tmk/tmk_keyboard/wiki/Apple-Desktop-Bus#mouse   




LIMITATION
- Hotplug of keyboard is not fully supported, you will have to connect keyboard with the converter first, then plug-in USB port.

Hotplug of keyboard and mouse is supported now. 2021-11-17




AEK left/right modifiers discrimination, ISO layout and Adjustable keyboard media keys
On ADB Standard keyboards(M0116) left and right corresponding modifiers are logically indentical and can not be discriminated one another by the converter. This is ADB keyboard limitation, not converter's.
Apple Extended keyboard(M0115/M3501) can discriminate them except for 'Command' key.



ISO keys
The ISO keys should be correctly supported.

iMate and uKey have problem on some keys reportedly.
https://geekhack.org/index.php?topic=4185.msg61270#msg61270
https://github.com/randyrants/sharpkeys/issues/225#issue-537872871


Power key
In default configuration Power key works as 'Magic command' trigger key when it is held.
https://github.com/tmk/tmk_keyboard#magic-commands

You can remap the Power key somehow but there is a limitation.
https://geekhack.org/index.php?topic=14290.msg3100399#msg3100399

You may need to change thse line in config.h if 'Magic command' feature interferes.
https://github.com/tmk/tmk_keyboard/blob/7b31d1b9d9f0d9c7d1e4b553e583381552cd8778/converter/adb_usb/config.h#L54-L57


Keypad =
The key is assigned to keycode 'EQL'(usual equal) on default keymap.

Note that keycode 'PEQL'(keypad equal) works on Linux and MacOS but doesn't on Windows. If you are on Windows you will need to use 'EQL'.



Locking CapsLock
Many of old ADB keyboards have mechanically locking switch for Caps lock and TMK supports them.
https://github.com/tmk/tmk_keyboard#mechanical-locking-support

Or you may want to remove locking pin from the push-lock switch to use it as a normal momentary switch.

Caps lock key of Apple adjustable keyboard is not mechanical locking switch but it emulates locking switch behaviour. You will have problem when using the key as control, for example.






Extended mouse protocol support
- Kensington Turbo Mouse 5(by hasu)

Do you have other multiple button mouse to support? Check this issue on github and ask help in this thread.
https://github.com/tmk/tmk_keyboard/issues/274




ISSUES

Check also: https://github.com/tmk/tmk_keyboard/issues?q=is%3Aissue+ADB

- Apple Desktop Bus Mouse II(M2706) assembled in Ireland doesn't work due to initialization failure. Meanwhile, M2706 assembled in Taiwan works.
https://geekhack.org/index.php?topic=14290.msg2873443#msg2873443
https://geekhack.org/index.php?topic=14290.msg2875515#msg2875515

Malaysia one also works. With 'Address Resolution' fix(2022-05) Ireland one work now perhaps.(Test needed)
https://github.com/tmk/tmk_keyboard/issues/748#issue-1396848868

- NeXT ADB Mouse has problem at startup.
https://geekhack.org/index.php?topic=14290.msg3119277#msg3119277

lowpoly:
Hah, great.

Strange nobody replied. I thought the Griffin iMate was hard to get these days. The mod forum should have a better place in the forum overview, IMO.

Also, the iMate had issues with intl. 'boards.

So, Colemak converter for ps/2 'boards next? :-)

Soarer:
Neat. :)

I would like to add ADB support to my adapter in the future, but I have lots of other tasks to complete first! One of them is implementing a key remapping UI ;)

And I recently bought a couple of the Belkin ADB adapters, which work ok, at least on US layout. But it seems they are not generally available either :/

Findecanor:
Superb! How does it handle latching Caps Lock, though?

iMav:
Great job!  Love seeing this type of stuff.  How many days have you lost with your head down programming that teensy?  ;)

I may just have to pick up one of these and start playing as well.

Navigation

[0] Message Index

[#] Next page

Go to full version