GithubHelp home page GithubHelp logo

ql_usb_kbd's Introduction

QL_USB_KBD

This CircuitPython code for the Raspberry Pi Pico 2040 allows a Sinclair QL with a GB keyboard to be converted to a GB USB keyboard that can be used in Linux or MS Windows.

No working QLs were harmed in the producion of this project, and no non-reversible changes were made to the QL case

Background

The Sinclair QL was launched in 1984, and production was discontinued in 1986. Therefore the electronics are over 35 years old. Whilst they have proved resilient, and there are still firms that will repair them, there are examples where the mainboard is no longer functional.

This project provides code on the Raspberry Pi Pico 2040 that can decode signals from the keyboard matrix and send corresponding USB HID (Human Interface Devices) messages to a host computer.

The QL keybaord layout is similar to a GB keyboard, with some small exceptions e.g:

  • Position of £ key
  • Position of " # and @
  • No dedicated backspace and delete. (Control Left and Control Right is used instead).

The code translates keypresses so that the keyboard appears as a standard GB USB keyboard (albeit with less keys).

Connecting the keyboard membrane

The QL keyboard membrane connects through one 9 way and one 11 way Connfly Ds1020 connector. These can be very difficult to source for an individual. I found some 12 way Ds1020 connectors on ebay. These can be used as long as the membrane is inserted firmly at one end of the connector.

Ironically the keyboard membrane is probably the most fragile component in the QL. It is very likely that any membrane of a significant age will need to be replaced before attempting this project. Luckily newly manufactured replacements are readily available, and of higher quality than the original.

The 20 lines from the membrane (9 rows, 11 columns) are routed to the first 20 GPIO lines on a Raspberry Pico. This can be simply achieved by mounting the Ds1020 on Veroboard, with PCB headers then taking the output to the Pico. I am sure those with more hardware skills than me could easily fabricate a dedicated PCB, including mounting the Pico 2040.

No diodes are used in the circuit. The keyboard functions well in the normal case without them. Currently the code is configured so only 3 simultaneous keypresses are registered, to prevent ghosting. This could be improved to allow more keypresses from a single keyrow.

Indicating the state of CAPS Lock

The QL case includes a Yellow Power LED. It draws approximately 15mA.

In this project, it is connected to the Pico in series with a 220Ω resister. The power LED has been configured to be on when CAPS LOCK is not set, and off when CAPS LOCK is not set. It has been configured this way, so that the Power light glows when in the more common setting i.e. CAPS LOCK is not enabled.

Installation

The project uses CircuitPython, and the Adafruit Matrix Keypad library. Instructions for installation can be found here.

The code must run automatically on power up. In addition the usual auto-mount of the CIRCUITPY drive should be disabled.

boot.py is used to prevent automount. Using code.py as the filename for the code file ensures that the code will run on power on (see here).

Both boot.py and code.py should be copied to the root directory of the CIRCUITPY drive.

Debug

For debug purposes key_test_ql.py can be run. This is similar to code.py, but includes print commands, so keystrokes can be seen in REPL.

Known issues

To allow switching between windows and full screen in sQLux, Shift ESC is mapped to F11. This makes it difficult to generate the Copyright symbol in sQLux.

Why?

Some people may question why a 35 year old keyboard of debatable quality should be converted to USB. The main reasons why I did this:

  1. I consider the QL case as a good example of industrial design.
  2. It allows use of a modern emulator (either under MS Windows or Linux) with an authentic keyboard.
  3. It makes a change for me to code for a real time application in Python, rather than C

It is also amusing that a $3 dollar part, running at 125MHz, with 264kB of RAM and 2MB of Flash, is being used to control the keyboard of the QL, when originally the main QL processor ran at 7.5MHz, and accessed 128kB of RAM!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.