Chapter
1
Introduction
The OpenAG5 project aims to provide open-source firmware and reverse-engineered device documentation for the revolutionary AlphaGrip5 (AG5) keyboard.
Open firmware allows you to rewire your AG5, so that you can take your AG5 with you anywhere, plug it into any computer, and viola! it always remembers your custom remapping.
1.1 Status
1.2 Features
- Make any key emit any character or signal.
- Change the sensitivity of the trackball.
- Transform any key into a special shift modifier.
- Light up any LED for whatever reason.
- Make the dreaded CapsLock key emit a signal.
- Save/load your custom remap directly onto the AG5 through USB.
1.3 License
Copyright 2007 Suraj N. Kurapati <SNK at GNA dot ORG>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
- All copies and substantial portions of the Software (the "Derivatives") and their corresponding machine-readable source code (the "Code") must include the above copyright notice and this permission notice.
- Upon distribution, the Derivatives must be accompanied either by the Code or—provided that the Code is obtainable for no more than the cost of distribution plus a nominal fee—by information on how to obtain the Code.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1.4 Mailing list
To subscribe, send an e-mail with “subscribe” in the subject to openag5-talk-request@lists.tuxfamily.org and a confirmation e-mail will be sent to you.
To unsubscribe, simply send an e-mail with “unsubscribe” in the subject to the address shown above.
Chapter
2
Setup
Loading the OpenAG5 firmware onto an AG5 requires opening the case, soldering, and other forms of tinkering. For this reason, please note that I am not responsible for any damage or loss that may result from the installation or use of this firmware.
With that said, you are welcome to ask for help in the project mailing list if you run into any trouble during installation.
2.1 Requirements
2.2 Installation
Chapter
3
Device documentation
This chapter presents documentation about the internals of the AG5, which I painstakingly reverse-engineered so that you don’t have to. :-)
3.1 Microcontroller
The microcontroller onboard my AG5 was covered by a white sticker with the following text printed on it:
v1.1 061214 23EF
When I peeled the sticker off, the following text was revealed:
MC908JB8FBE 3K45H CTQH0610
This indicates that the microcontroller on my AG5 is a Freescale MC68HC908JB8, which is a member of the HC08 family. You can obtain the technical data sheet for this microcontroller directly from Freescale.
Figure 1. Microcontroller pinout diagram

This diagram [1, page 32] shows the pinout for the microcontroller on my AG5.
3.1.1 Programming
Because the microcontroller on the AG5 is a member of the HC08 family, we can use the MON08 monitor mode (which is common to all family members) to program it.
Figure 2. Connection points for microcontroller programming

This image shows the connection points for programming the microcontroller via the MON08 monitor mode interface.
I tried to find as many off-chip connection points as possible because soldering wires to the tiny microcontroller pins is difficult.
3.2 Button wiring
A circular receptor composed of two electrical contacts (see Figure 4: Electrical contacts in a button receptor) can be found beneath every button on the AG5.
Figure 4. Electrical contacts in a button receptor

The inner contact (shown in red) appears like a plus sign (+) in the middle of the receptor. It is surrounded by the outer contact (shown in gold) which appears like a circle.
Table 1: Button contacts and microcontroller signals lists the microcontroller signals corresponding to each pair of electrical contacts for every button on the AG5. You can determine or verify these connections for yourself through the use of a continuity tester.
Notice that the white shift buttons are actually composed of two smaller buttons. The reason for this might be that the AG5 inventors ran out of room on the secondary PCB and so, they simply chose to use two smaller button receptors instead of a normal one.
Table 1. Button contacts and microcontroller signals
| Button | Label | Inner contact | Outer contact |
|---|---|---|---|
| K1 | M | PTB0 | PTA0 |
| K2 | H | PTB1 | PTA0 |
| K3 | U | PTC1 | PTA6 |
| K4 | N | PTC1 | PTA4 |
| K5 | , (comma) | PTB4 | PTA0 |
| K6 | | (pipe) | PTB5 | PTA0 |
| K7 | . (period) | PTB6 | PTA0 |
| K8 | O | PTB7 | PTA0 |
| K9 | B | PTB4 | PTA3 |
| K10 | P | PTB5 | PTA3 |
| K11 | G | PTB6 | PTA3 |
| K12 | R | PTB7 | PTA3 |
| K13 | T | PTC1 | PTA5 |
| K14 | F | PTC0 | PTA7 |
| K15 | E | PTB2 | PTA3 |
| K16 | D | PTB3 | PTA3 |
| K17 | S | PTB0 | PTA4 |
| K18 | W | PTB1 | PTA4 |
| K19 | A | PTB2 | PTA4 |
| K20 | Q | PTB3 | PTA4 |
| K21 | J | PTB4 | PTA4 |
| K22 | V | PTB5 | PTA4 |
| K23 | C | PTB3 | PTA7 |
| K24 | Y | PTB2 | PTA7 |
| K25 | K | PTB0 | PTA7 |
| K26 | L | PTB1 | PTA7 |
| K27 | X | PTC1 | PTA1 |
| K28 | Z | PTC1 | PTA0 |
| K29 | Ent | PTB4 | PTA7 |
| K30 | BkSpace | PTB7 | PTA7 |
| K31 | Tab | PTB6 | PTA7 |
| K32 | Space | PTB5 | PTA7 |
| K33A | RightWhiteShiftTop | PTC4 | PTA2 |
| K33A1 | RightWhiteShiftBottom | PTC4 | PTA2 |
| K33B | LeftWhiteShiftTop | PTC4 | PTA3 |
| K33B1 | LeftWhiteShiftBottom | PTC4 | PTA3 |
| K34A | LeftGreenShift | PTA5 | PTC5 |
| K34B | RightGreenShift | PTC5 | PTA5 |
| K35A | RightRedShift | PTA4 | PTC5 |
| K35B | LeftRedShift | PTA4 | PTC5 |
| K36 | Win% | PTC3 | PTA1 |
| K37 | Esc | PTB1 | PTA1 |
| K38 | PrtSc | PTC1 | PTA2 |
| K39 | Alt/Opt | PTC7 | PTA7 |
| K40 | Ctrl | PTC6 | PTA6 |
| K41 | NumLock | PTB3 | PTB1 |
| K42 | FnLock | PTB4 | PTA1 |
| K43 | Pause | PTC1 | PTA3 |
| K44 | Del | PTB5 | PTA1 |
| K45 | CapsLock | PTB6 | PTA1 |
| K46 | MouseClickTop | PTC2 | PTA0 |
| K47 | MouseClickBottom | PTC3 | PTA5 |
3.3 Mouse wiring
- Horizontal movement is detected by the top mouse encoder, which is connected to the PTD0 and PTD1 signals on the microcontroller.
- Vertical movement is detected by the bottom mouse encoder, which is connected to the PTD2 and PTD3 signals on the microcontroller.
Figure 5. Front face of secondary PCB

I apologize for the poor quality of this photo, but I have already placed this PCB back into my AG5 and it’s far too much work to open it up again for the sole purpose of taking a better photo. :-/
3.4 Light wiring
Table 2: Light contacts and microcontroller signals lists the corresponding microcontroller signals for every LED (a small light bulb) on the outer face of the AG5.
Table 2. Light contacts and microcontroller signals
| Light | Signal |
|---|---|
| nl | PTD7 |
| pa | PTD5 |
| cl | PTD4 |
| fl | PTD6 |
