To begin with, let me introduce today's guest: CH Products Trackball PRO
This is 4 buttons trackball from CH Products, using a huge 53mm phenolic ball. It is a discontinued device, replaced by the DT225.
The version I have is the BUS MOUSE one. Other possible versions include PS/2, serial, Sun Microsystems and ACCESS bus.
Before we go further, let me give a little background on what BUS MOUSE is
The bus mouse was designed in the late 80's to provide a way to connect pointing devices to IBM PC compatible computers. Absolutely NO LOGIC was done on the device side and you had to rely on a separate board, like the Microsoft InPort, to translate the signals into mouse events. The connector is circular, has a 5/16" diameters and 9 pins mapped has following:
- Mouse button 2
- Mouse button 3
- X position (channel B)
- Y position (channel A)
- Y position (channel B)
- Mouse button 1
- Power (+5V)
- X position (channel A)
As mentioned, the trackball does no logic nor send serial serial data. Unlike serial mouse, it sends binary signals for the mouse buttons (left, middle and right) and quadrature signals for mouse movements.
What is a quadrature signal
Back on those times, optical or laser sensor mouse were non-existent. Instead, mice and trackballs were using optical encoder. Basically, an optical encoder uses a slotted wheel and light source + photo detector array to generate a signal.
A quadrature signal is a signal generated by a two channels optical encoder. Each channel generates a binary signal depending on whether the sensor sense the light coming from the source or not.
Each channel is phased-out by 90°. If the channel A leads, then the shaft is turning clockwise. If the channel B leads, then the shaft is turning counter-clockwise.
For further reading about quadrature and efficient solution to manage the signals, I really encourage you to read this person's article:
We came to the same solution and he explains it so well that it's worth linking it here.
What did I do then
I wanted to keep the trackball as vanilla as possible, so I decided not to touch the original PIC16C55-XT/P processor.
This PIC processor does no logic, remember how BUS MOUSE works, but it adds several nice features to the device. All of them are accessible from DIP switches located on the underside:
- Axis reversing
- Halved or doubled resolution
- Debouncing for the mouse button switches.
Note: The two upper switches have their own input pin on the PIC side. The BUSMOUSE is limited to 3 buttons, so they act both as middle button or as left/right click-lock (depending on the DIP switches setting).
Removing the PIC would allow to use them as button 3 and 4, but as mentioned, I wanted to keep this device as vanilla as possible. It doesn' t pop up that often, especially mint condition and the BUSMOUSE version is even rarer.
I decided to remove the original cable from its header, to keep it unarmed, and I bought a new 10 pins harness with 2.54mm pitch.
Two thing had to be done:
- Catch and manage the signals
- Transform the trackball into USB HID device
That's were the Arduino comes into play. Controllers like the Teensy or Pro micro can work as HID compliant devices through the provided libraries. To be totally honest, that was my very first experience with an Arduino.
I started this project with a Teensy++ 2.0 (in green), but it was too big to fit inside the trackball enclosure, so I switch to the very tiny Arduino Pro Micro (in red) from Sparkfun. It sports an Atmel ATMEGA32u4 processor and seriously it was a pleasure to program.
The original cable was held into place with 3 little plastic bridges. Since the new cable is too thick to reuse them, I used cotton thread and "sew" it through the bridges holes. That's a very efficient and tidy solution.
I then soldered the Arduino Pro micro to the cable (c.f. pinout on the "Build instructions" section) and built a temporary cable from a surplus smartphone USB cable. I'll do...Read more »