Git Product home page Git Product logo

trackhand's Introduction

DataHand DH200-6 with USB Micro-controller and Laser Trackball

Aim

The initial aim of this project is to replace the archaic firmware in a DataHand DH200-6 keyboard with an ARM-based micro-controller and USB interface and use this as a test-platform for an integrated laser trackball using the ADNS-9800 LaserStream gaming sensor fitted closely below the finger cluster. The trackball is intended for finger control with the mouse buttons included in a special mode and mapped to the thumb-cluster keys. The proposed layout of ball and switches is reminiscent of the excellent but obsolete Logitech TrackMan Marble FX trackball which I used for 15years: Logitech TrackMan video.

Once the initial aim is fulfilled the trackball hardware and software could be fitted to the DodoHand as an alternative to the proposed TrackPoint pointing device. Details of this project may be found in the same thread: TrackHand with some discussion concerning the suitability of the 2 1/4” trackball for the DodoHand.

Images

Here are the upgraded units with a trackball in the right-hand unit only, mouse buttons mapped to the right-hand thumb-cluster in function mode and current legends: https://github.com/Henry/TrackHand/raw/master/Images/CompletedUnits.jpg Here is the inside of the right-hand unit showing the new micro-controller and trackball with the ADNS-9800 sensor: https://github.com/Henry/TrackHand/raw/master/Images/InsideRight.jpg

Teensy 3 Software

The Teensy-3.1 micro-controller is used in this project. Any of the Teensy boards could be used but I wanted to play around with this latest and most powerful offering from PJRC and the price is very reasonable. The installation notes are really for my own reference but they may be useful to others. I am developing software under OpenSuSE but all these tools are available for other GNU/Linux distributions.

Install AVR tools on OpenSuSE

Open firefox and follow instructions on

Or add the repository and use zypper

Enable serial (based on notes from PJRC)

The udev rule file gives non-root users permission to use the Teensy device. Download 49-teensy.rules

  • sudo cp 49-teensy.rules /etc/udev/rules.d/

Add user to uucp and dialout groups

  • uucp:x:14:<username>
  • dialout:x:16:<username>

Avoid Teensyduino

Teensyduino is the annoying Java interface to building and loading teensy applications. This is the only method supported directly by PJRC on the Teensy-3.1. However, other people are maintaining CLI support software for the Teensy-3.1 based on the applications released by PJRC for the Teensy-2.

Make (used instead of Teensyduino)

Install the arduino libraries and make file for Teensy-3.x

This repository started from the teensy-template repository, so you do not need this step unless you want to write code for another project.

To test simply

  • make
  • make upload
  • Press the button

CLI Loader (used instead of Teensyduino)

Download the latest CLI app for teensy-3.1

Using GNU screen or cat to listen to serial messages

On OpenSuSE the USB serial device /dev/ttyACM0 is created following Serial.begin() and may be interrogated using screen or just plain old cat:

  • screen /dev/ttyACM0
  • cat /dev/ttyACM0

Sometimes there is a problem with the connection and printing stops due to buffering. To remedy this change the tty settings:

  • stty -F /dev/ttyACM0 9600 raw

I2C comms library

This library is included: libraries/i2c_t3

I2C is used to connect the right-hand unit to the left-hand MCP23018 IO-expander.

Teensy-3 pins
  • SCL: pin 19 with 4k7 pull-up resistor
  • SDA: pin 18 with 4k7 pull-up resistor

To connect two teensys connect SCL to SCL and SDA to SDA with the pull-up resistors.

Serial Peripheral Interface (SPI) library

This library is included: libraries/spi4teensy3

Low-power library

This is included: libraries/LowPower_Teensy3

MCP23018 library

Interface to the MCP23018 IO-expander used to scan the optical switch matrix in the left-hand unit and send the data to the Teensy-3.1 micro-controller in the right-hand unit via the I2C connection. This library is an incomplete but sufficient interface to the MCP23018 chip created for this project with reference to the MP23018 datasheet.

ADNS-9800 LaserStream Gaming Sensor library

The ADNS-9800 LaserStream Gaming Sensor is used to scan the motion ball. The Kicklighter breakout board is used

Teensy interface for the ADNS-9800 used in this project is based on that provided by John Kicklighter and connects to the Teensy-3.1 via the SPI

with updates for the Teensy-3.1 from

and is included: libraries/TrackBall

The DataHand DH200-6

The DataHand keyboard receiving this extreme makeover is a second-hand 1993 DH200-6 is decent condition and basically working. All the existing electronics are removed leaving just the thumb and finger switch clusters. The leds on the key map panel are also be reused.

Thumb Cluster

The 8-pin IDC header on thumb-cluster has the following connections and proposed Teensy-3.1 pin allocation

PinLineSwitchesConnectionsTeensy pin
1Vcc
2XD0 (column 0)1 3 514
3Row 01 2->D1k->(D1)->D2k->R1->Vcc5
4XD1 (column 1)2 4 615
5Row 13 4->D3k->(D3)->D4k->R1->Vcc6
6Row 26->D3k->R1->Vcc8
7Row 35->D5k->R1->Vcc7
8GND1-6
  • Connect 1 to Vcc
  • Connect 8 to GND
  • Connect columns 0 and 1 to INPUT pins each with a 4k7 pull-up to Vcc.
  • Set rows 0-3 to HIGH
  • Scan rows by setting each to LOW in turn
  • Read state of each column, LOW is on.

Finger Cluster

The 14-pin IDC header on finger-cluster has the following connections and proposed Teensy-3.1 pin allocation

PinLineTeensy pin
1Vcc
2XD0 (column 0)14
3Row 41
4XD1 (column 1)15 (now 16 but should be put back to 15)
5Row 50
6Row 616 (now 15 but should be put back to 16)
7Row 73
8Row 817
9Row 92
10Row 1020
11Row 1123
12Row 1221
13Row 1322
14GND
  • Connect 1 to Vcc
  • Connect 14 to GND
  • Connect columns 0 and 1 to INPUT pins each with a 4k7 pull-up to Vcc. (NOTE: columns 0 and 1 are the same for finger and thumb clusters)
  • Set rows 4-14 to HIGH
  • Scan rows by setting each to LOW in turn
  • Read state of each column, LOW is on.
Thumb and Finger Switch Indices

The following tables provide the column, row and combined indices for each of the thumb and finger switches:

Thumb SwitchColumn/Row/index
Knuckle0 0 0
Nail1 0 1
Down0 1 2
DOWN1 1 3
Pad0 3 6
Up1 2 5
FingerDownNorthSouthEastWest
10 5 101 4 90 7 141 5 110 4 8
20 11 221 9 191 7 151 11 230 9 18
30 12 241 13 270 10 201 12 250 13 26
40 6 121 8 171 10 211 6 130 8 16

Trackball

The ADNS-9800 LaserStream Gaming Sensor Kicklighter breakout board connects to the Teensy 3 on the SPI interface using 4 pins + 1 pin for interupt:

PinADNSTeensyDescriptionTeensy pin
1MIMISOData input12
2VIVcc3.3V
3SCSCKClock13
4AGGNDGround
5MOMOSIData output11
6DGGNDGround
7SSSSSelect device10
8MOTMotion interupt9

LEDs

The LEDs on the key map panel on the DataHand case are reused with the following pin allocation on the Teensy-3.1:

LEDTeensy pin
Shift24
Caps Lock25
26
27
Cursor/mouse mode28
Function mode29
NAS mode30
Normal mode31
32
33
  • Note: LOW is on

Teensy-3 pin allocation

Pin requirements:

Purpose#pins
I2C (comms between teensys)2
SPI (comms with trackball) + interupt5
Key matrix column inputs2
Thumb row outputs4
Finger row outputs10
Mode and modifier indicator LEDs6
Wake-up GPIO pin1
Total30

Trackball Installation

To provide the best shape for the finger-driven trackball fitted is the curve of the finger-cluster I found that the standard 2 1/4” pool-ball to be the best compromise. From a curvature point of view a slightly larger ball might be more comfortable but then it would need a higher case and would require further re-arrangement of the thumb switches. Also the 2 1/4” pool-ball is the largest high-quality ball readily available. Even with this size of ball a significant change needed to be made to the thumb-cluster to fit it in a suitable position, starting with the relocation of the “up” switch further in to allow aggressive trimming of the PCB and re-routing of cut tracks. Slight trimming of the finger-cluster PCB was also required but this did not require the cutting and re-routing of any tracks.

For convenient prototyping and testing I made the cup supporting the trackball by hand using Polymorph (known as Friendly Plastic in the US) by rolling a thick-ish sheet and molding around the ball with a thick rubber glove stretched over it to ensure the cup is slightly larger that the ball. I created flattened regions on the cup for the fitting of the laser sensor and to fit it to the case using a belt-sander. The lugs to attach the laser sensor and fix the unit to the case are attached using hot-glue. Three 2mm rubys support the ball and are fitted to the cup through 2mm drilled holes and pushed so they protrude using 2.5mm self-tapping screws.

Initially I tried a cue-ball but the sensor could not detect the motion reliably if the ball moves fast. This may be an issue with inaccurate positioning of the sensor. I now use an Aramith “Golden-8” ball with metallic finish which the sensor can follow more reliably. This is the closes to the balls which Kensignton use but readily available and reasonably priced.

Low-power sleep mode

To save power, IR LEDs and in particular the laser sensor it is important to include a sleep mode. Sleep functionality in the ARM-based Teensy 3.1 is completely different to the AVR-based Teensy 2 and a special library is needed:

There are various modes of operation supported from reduced clock low-power modes to interruptable deep-sleep and hibernate modes. The problem with the reduced clock modes is that the IR LEDs will still be powered although it would be possible to reduce the scanning frequency of the matrix. The interruptable deep-sleep mode looks most appropriate but a pin would need to powered to interrupt the sleep which is not possible using the optical switched of the DataHand which would all be off during sleep. The easiest solution is to provide a dedicated wake-up push-button switch attached to a dedicated wake-up pin on the Teensy 3.1. Note that only a subset of the pins may be used for this purpose:

GPIO pin
1.PIN_2
2.PIN_4
3.PIN_6
4.PIN_7
5.PIN_9
6.PIN_10
7.PIN_11
8.PIN_13
9.PIN_16
10.PIN_21
11.PIN_22
12.PIN_26
13.PIN_30
14.PIN_33

A push-button switch is attached to pin 33 for wake-up which works fine but it would be good to use the normal keys. Given that the trackball laser is switched-off during sleep it is not possible to wake by moving the ball. An alternative would be to use one of the rest modes of the ADNS9800 for laser saving and still support wake-up by moving the ball but this would require the SPI to be running, i.e. the Teensy 3.1 in sleep rather than deep-sleep mode which would be OK if it wired directly to the computer rather than wireless and battery powered.

Compile and Upload

The complete source code for the firmware may be found in the TrackHand directory and support libraries in the libraries directory. The complete code may be compiled, linked and loaded using make:

  • Compile only: make PROGRAM=TrackHand
  • Compile and upload: make PROGRAM=TrackHand load

The program defaults to TrackHand so

  • Compile only: make
  • Compile and upload: make load

is sufficient.

To initialize the configuration parameters stored in EEPROM it is necessary to compile and load with the INITIALIZE=1 set on command line the first time the firmware is loaded:

  • Compile and upload: make INITIALIZE=1 load

After initialization the standard firmware may be loaded which uses the current configuration stored in EEPROM:

  • Compile and upload: make load

Dvorak Layout

I have created a Dvorak-like layout based on the Kinesis and DataHand Professional II Dvorak layouts adjusted for programming convenience. To allow parentheses to be typed without shift they are included in the normal key-map directly with the shift being generated automatically. Also to allow complete flexibility for shifted keys the shift and shift-lock keys enable a shift-mode rather than simply applying the shift-modifier. While the locations of the normal characters is fairly obvious it is less clear where the symbols should be located and this is still in a state of flux.

The CAD and PS files for the keyboard legends are in the KeyboardLegends directory. Here are the current keyboard legends for the right-hand and left-hand units: https://github.com/Henry/TrackHand/raw/master/KeyboardLegends/Both.png

Learning to Touch-type

I am using klavaro to learn to touch-type on the TrackHand. I can already touch-type on the Kinesis Advantage with the Dvorak layout and the I have created a layout for the TrackHand which is reasonably similar which has been helpful when learning the normal keys but the layout of the symbols is VERY different. I set the keyboard to USA dvorak and found that the tutorials corresponded well to the layout of keys for both the alphabetic characters and reasonably well to the symbols.

thconf: CLI TrackHand Configuration Utility

thconf is a simple command-line utility provided to configure the TrackHand. It is complied using the Makefile in the TrackHand directory and provides the following options:

Usage: thconf [OPTION]...
-h  --help               Print this usage information.
-d  --dev <name>         Name of the serial device used to communicate with the TrackHand.
-p  --print              Request that the TrackHand prints the current configuration.
-r  --resolution <val>   Set the pointer motion resolution in increments of 50cpi in range 1-168.
-s  --scroll <val>       Set the scroll divider to reduce the scroll speed.
-t  --timeout <val>      Time of inactivity after which power saving is enabled.

trackhand's People

Contributors

henry avatar

Watchers

 avatar

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.