Sun Type S Keyboard Retrofit

Use one of the golden standards of keyboarding on your modern system

Similar projects worth following
This project aims to use a readily-available Teensy-LC microcontroller as a bridge between the Sun Type S serial protocol and USB. Using one of the serial inputs on the LC to communicate with the keyboard, the LC will convert the proprietary (but well documented) serial protocol into common keycodes readable by generic USB HID Keyboard drivers.

Sun Keymap:

Teensy Keylist:

Source Code:


Schematic for Teensy to Sun serial inverter

sch - 72.30 kB - 05/20/2016 at 05:10



Board file for Teensy to Sun serial inverter

brd - 37.86 kB - 05/20/2016 at 05:10


  • 1 × Sun Serial Cable Connector
  • 1 × Teensy-LC
  • 2 × 2n2222 Discrete Semiconductors / Transistors, MOSFETs, FETs, IGBTs
  • 4 × 1KΩ Resistors
  • 1 × OSHpark designed PCB

  • Boards are in and soldered!

    jareklupinski05/20/2016 at 04:47 0 comments

    The one with the wires soldered directly to the board stays here, meanwhile the other will be sent along to my collaborator. Together we'll finish filling out the keycode map, and tune this to be a light, easy-to-understand, easy-to-mod Sun keyboard platform.

    static byte keyStack[6];
    //TODO handle stack overflow
    byte addToKeyStack( char key ){
      for( int i = 0; i < 6; i++ ){
        if( keyStack[i] == 0 ){
          keyStack[i] = key;
          return 1;
      return 0;
    //TODO handle mismatched character
    byte dropFromKeyStack( char key ){
      for( int i = 0; i < 6; i++ ){
        if( keyStack[i] == key ){
          keyStack[i] = 0;
          return 1;
      return 0;
    //TODO add keyboard beeper test code
    //TODO add keyboard beeper code to respond to exceptions
    void setup(){
      SerialUSB.begin( 9600 );
      while( !SerialUSB );
      Serial1.begin( 1200 );
    void loop(){
      while( Serial1.available() > 0 ){
        byte in =;
        static byte mod = 0;
        SerialUSB.println( in );
        switch( in ){
          case 76:
            mod |= MODIFIERKEY_CTRL;
          case 204:
            mod &= ~MODIFIERKEY_CTRL;
          case 102:
            addToKeyStack( KEY_C );
          case 230:
            dropFromKeyStack( KEY_C );
        Keyboard.set_modifier( mod );
        Keyboard.set_key1( keyStack[0] );
        Keyboard.set_key2( keyStack[1] );
        Keyboard.set_key3( keyStack[2] );
        Keyboard.set_key4( keyStack[3] );
        Keyboard.set_key5( keyStack[4] );
        Keyboard.set_key6( keyStack[5] );

  • Schematic and Board Files

    jareklupinski04/25/2016 at 19:23 0 comments

    Decided to just keep it as a Teensy backpack/shield/wing/whatever teensy calls their addon boards. Sending these off to Oshpark, once they come back and I validate them I'll post the Eagle files

  • It lives!

    jareklupinski04/25/2016 at 18:10 0 comments

    Got the keyboard communicating over USB, right now it's spitting out just raw keycodes. Now comes the tedious task of mapping these keycodes to standard USB keys...

View all 3 project logs

Enjoy this project?



AVR wrote 10/01/2016 at 17:44 point

I got an original teensy powering my Apple Extended Keyboard II, hope you succeed in your Sun build, always wanted one of their keyboards :)

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

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