Close
0%
0%

Reverse engineering a old school keyboard

Putting a non-functioning barebones keyboard back to work

Similar projects worth following
Many years ago I purchased 2 caseless excess stock keyboards. They seemed to come from old school laptops and had a microcontroller on board. The journey had me re-learn keyboard scanning techniques.

This project started out as something that I thought was going to be straight forward, it however turned into an adventure.

Phase 1. Does it work - Did the micro-controller do anything and if it did how could I use it.

Phase 2. What goes where - Grab my multi-meter and start working through the I/O on the micro-controller and see what goes where.

Phase 3. Design a new mini PCB to sit where the DIP 40 controller used to be and develop software in the Arduino environment

Phase 4. Put it to work - After all the effort poured into getting it to work would seem a waste do nothing with it.

Reverse_Schematic01.pdf

Reverse engineered schematic of keyboard.

Adobe Portable Document Format - 248.49 kB - 10/13/2025 at 06:23

Preview

  • 1 × SC87C51 Microprocessors, Microcontrollers, DSPs / Microcontrollers (MCUs)
  • 1 × 74HC125E Quadruple Buffers with 3-State Outputs

  • Phase 3 - Part 1

    Phil10/14/2025 at 06:27 2 comments

    With the hardware design revision 1 complete and the usual amount of doubting my design choices it's time to get it made when both finances and time permits. 

    For clarity going forward I will call ports P0.1 to P0.7 the columns and P1.0 to P1.7 and P2.0 to 2.5 the rows, I can see myself getting confused.

    I have chosen to use 74HC138 chips to pull the rows low and a 74HC165 to read in the columns which will be pulled high via 10K resistors. Using a running/walking zeros method each row will be pulled low in turn and then the columns will be read. If a column input is low then a key had been pressed.

    Issues I will likely come up against.

    1. Switch de-bounce - mechanical key switches are noisy each having a mechanical make-break episode when pressed

    2. Typematic delay - giving the keyboard the ability to fill any document with the same key press when you accidentally leave a book resting on the space bar.

    3. Bi-directional communications - PC keyboards have LEDs that the BIOS or operating system turn on and off when you press certain keys. The keyboard doesn't have LEDs so the bi-directional communications bit it up for further thought.

    4. Scan codes - keyboards don't send ASCII characters they send scan codes that's why you can select different languages and types. They also send key release data packets so you can do the old CTL-ALT-DEL. Each key will have a scan code sent out when the key is pressed and a release code when you lift you finger followed by the scan code for the key released. 

    5. Other - The data sent by the keyboard also has a parity bit so this will need to be calculated prior to being sent.

    One final note sort of a inference from observation. P3.2 on the 8051 IC is an interrupt. The clock line between keyboard and host is pulled low by the host to send commands to the keyboard so having that line connected to and interrupt would be helpful.

  • Phase 2

    Phil10/11/2025 at 08:27 3 comments

    With the microcontroller no longer installed it was time get the multimeter out and start mapping the keyboard matrix. After several hours and driving anyone in close proximity mad with the multimeter beeping I managed to map out the columns and rows and discovered that there was a diode in series with each key switch and the keyboard has 8 rows and 14 columns. Either way the matrix and which button went where on it had been determined.

  • Phase 1

    Phil10/11/2025 at 07:58 0 comments

    Phase 1

    Started with getting the datasheet for the microcontroller (TSC87C51). Identifying the power pins and working back to the main header on the PCB. Once those pins had been identified I powered the keyboard with 5VDC checked for excessive current draw and then started probing the rest of the header pins with an oscilloscope looking for activity while pressing a key repeatably.

    Couldn't get anything on any of the pins but while I was at it I made sure the oscillator was working - it was so there was nothing left to do but desolder the microcontroller and put it in a EPROM programmer. To my surprise the chip was blank or had its security bit set.

    Either way this was a dead end so onto Phase 2.

View all 3 project logs

Enjoy this project?

Share

Discussions

danjovic wrote 10/11/2025 at 12:59 point

Another option you have is a custom PCB that matches the 40pin socket. Thaw should provide you freedom of choice for both micro-controller and connectivity method.

  Are you sure? yes | no

Phil wrote 10/12/2025 at 05:00 point

I think that is the way I will go. I do an Arduino hybrid so I can program with AVR ISP MKII so the board will need to have a ATMEGA328P on it.

  Are you sure? yes | no

Does this project spark your interest?

Become a member to follow this project and never miss any updates