CH Products Trackball PRO - BUSMOUSE to USB

GuilleAcoustic

Chief Procrastination Officer
Original poster
SFFn Staff
LOSIAS
Jun 29, 2015
2,967
4,390
guilleacoustic.wordpress.com
Hello SFF,

this is my first post here, but some of you already know me. A few month ago, I bough a vintage PS/2 Trackball from the CH Products brand. I must say that I'm very impressed by the quality of this device. It well deserves its title of "Model M of the trackballs".





The trackball was advertised as being the PS/2 variant, but unfortunately it is not. In fact, it uses a pretty old connector and protocol called : BUS mouse.

The bus mouse connector is very similar to the PS/2, with the same 5/16" diameter, but it as 9 pins instead of 6. I can't blame the seller, as PS/2 and BUS can easily been mixed up.



Unlike PS/2, serial or USB devices, absolutely NO LOGIC is done on the device side. BUS mouse devices send the raw data from the opto-mechanical encoders and buttons to a decoding card on the computer side. The connector has the following pins:
  • XA (X axis encoder channel A)
  • XB (X axis encoder channel B)
  • YA (Y axis encoder channel A)
  • YB (Y axis encoder channel B)
  • Switch 1
  • Switch 2
  • Switch 3
  • +5V
  • Ground

You've probably spotted that, despite having 4 buttons, the connector only carries 3 switches information. In fact, the top buttons acts as middle-click (both of them) or as click-lock (left lock and right lock). Everything is configurable thanks to 8 DIP switches below the device.

Fortunately, all is not so bad:
  • The cable is connected to a header so that changing it will be easier.
  • The pinout is provided on both manual and PCB
  • The controller is an 8bit PIC16C55 with a DIP28 package.



How do the encoders work:

They are based on quadrature encoders and consists on a shaft wheel and 2 optical sensors per axis. When the shaft spins, it generates 2 electrical signals phased out by 90 degrees


(image courtesy of Dynapar)

The picture below, shows that there're 3 achievable count speed:
  • x1 if you count on channel A rising edge only
  • x2 if you count on channel A rising edge and falling edge
  • x4 if you count on both channel A and B rising and falling edges


(image courtesy of Dynapar)



Retro-mod operation:

I purchased an Arduino PRO micro, as the Teensy2.0++ doesn't fit the trackball case. This was probably a lucky day, but the store also had the exact same 10 pins cable harness than the one originally used by CH Products.

As you can see, the PRO micro (in red) is almost half the size of the Teensy2.0++ (in green).



CH Products used some plastic "jumpers" to tie the wires.



The new wires are thicker than the original ones and I can't use them. What could I use then ...



... assume that the cable is a button and the PCB is some piece of fabric :p ...





I spent most of my time working on the code. I greatly improved the way I handle the quadrature data.


Disclaimer: No PCB has been harmed during the process. I just reused the "plastic jumper" fitting holes.





I made a temporary cable from a micro USB cable. I just got the casing off of the micro USB connector.



I still to do some proper sleeving and a strain release, in order to have a clean finish. I hope you do like this humble project of mine. Please do not hesitate to leave a comment or ask any question.


Below is a compact and optimized code:

Code:
/* =================================================================================
   Author  : GuilleAcoustic
   Date    : 2015-05-16
   Revision: V1.0
   Purpose : Opto-mechanical trackball firmware
   ---------------------------------------------------------------------------------
   Wiring informations: Sparkfun Pro micro (Atmega32u4)
   ---------------------------------------------------------------------------------
     - Red             : Gnd                         |  Pin: Gnd
     - Orange          : Vcc (+5V)                   |  Pin: Vcc
     - Yellow          : X axis encoder / channel A  |  Pin: INT0 - SCL
     - Green           : X axis encoder / channel B  |  Pin: INT1 - SDA
     - Blue            : Y axis encoder / channel A  |  Pin: INT2 - Rx
     - Violet          : Y axis encoder / channel B  |  Pin: INT3 - Tx
     - Grey            : Switch 1                    |  Pin: PB3  - MISO
     - White           : Switch 2                    |  Pin: PB2  - MOSI
     - Black           : Switch 3                    |  Pin: PB1  - SCK
   ================================================================================= */

// =================================================================================
// Type definition
// =================================================================================
typedef struct
{
  int8_t  coordinate = 0;
  uint8_t index      = 0;
} ENCODER_;

// =================================================================================
// Constant for binary mask
// =================================================================================
#define  _SWITCH_1    B1000
#define  _SWITCH_2    B0100
#define  _SWITCH_3    B0010

// =================================================================================
// Constants
// =================================================================================
const int8_t lookupTable[] = {0, 1, -1, 0, -1, 0, 0, 1, 1, 0, 0, -1, 0, -1, 1, 0};

// =================================================================================
// Volatile variables
// =================================================================================
volatile ENCODER_ xAxis;
volatile ENCODER_ yAxis;

// =================================================================================
// the setup function runs once when you press reset or power the board
// =================================================================================
void setup()
{
  // Attach interruption to encoders channels
  attachInterrupt(0, ISR_HANDLER_X, CHANGE);
  attachInterrupt(1, ISR_HANDLER_X, CHANGE);
  attachInterrupt(2, ISR_HANDLER_Y, CHANGE);
  attachInterrupt(3, ISR_HANDLER_Y, CHANGE);

  // Start the mouse function
  Mouse.begin();
}

// =================================================================================
// The loop function runs over and over again forever
// =================================================================================
void loop()
{
  // Update mouse coordinates
  if (xAxis.coordinate != 0 || yAxis.coordinate != 0)
  {
    Mouse.move(xAxis.coordinate, yAxis.coordinate);
    xAxis.coordinate = 0;
    yAxis.coordinate = 0;
  }

  // Update buttons state
  !(PINB & _SWITCH_1) ? Mouse.press(MOUSE_LEFT)   : Mouse.release(MOUSE_LEFT);
  !(PINB & _SWITCH_2) ? Mouse.press(MOUSE_RIGHT)  : Mouse.release(MOUSE_RIGHT);
  !(PINB & _SWITCH_3) ? Mouse.press(MOUSE_MIDDLE) : Mouse.release(MOUSE_MIDDLE);

  // Wait a little before next update
  delay(10);
}

// =================================================================================
// Interrupt handlers
// =================================================================================
void ISR_HANDLER_X()
{
  // Build the LUT index from previous and new data
  xAxis.index = ((xAxis.index << 2) | ((PIND & 0b0011) >> 0)) & 0b1111;

  // Compute the new coordinates
  xAxis.coordinate += lookupTable[xAxis.index];
}

void ISR_HANDLER_Y()
{
  // Build the LUT index from previous and new data
  yAxis.index = ((yAxis.index << 2) | ((PIND & 0b1100) >> 2)) & 0b1111;

  // Compute the new coordinates
  yAxis.coordinate += lookupTable[yAxis.index];
}
 
Last edited:

jeshikat

Jessica. Wayward SFF.n Founder
Silver Supporter
Feb 22, 2015
4,969
4,780
Welcome to the forum and what an awesome post to inaugurate the Modding sub-forum!

Trackballs don't get enough love these days, I'm worried Logitech will discontinue the M570 and I won't be able to get a replacement if one of mine fails.
 

Phuncz

Lord of the Boards
SFFn Staff
May 9, 2015
5,827
4,902
Awesome, awesome work ! Reverse-engineering isn't for the faint of heart, especially without any documentation and with use of proprietary chips. But it takes persistence and lots of it.
 

GuilleAcoustic

Chief Procrastination Officer
Original poster
SFFn Staff
LOSIAS
Jun 29, 2015
2,967
4,390
guilleacoustic.wordpress.com
Welcome to the forum and what an awesome post to inaugurate the Modding sub-forum!

Trackballs don't get enough love these days, I'm worried Logitech will discontinue the M570 and I won't be able to get a replacement if one of mine fails.

Thanks a lot for this warm welcome. I agree that trackballs deserve more love. This one, despite its age, is a real pleasure to use and easily replaced my optical mouse as a daily driver.

Awesome, awesome work ! Reverse-engineering isn't for the faint of heart, especially without any documentation and with use of proprietary chips. But it takes persistence and lots of it.

Thanks mate, it wasn't an easy task and I was like a kid on Christmas morning when I saw the cursor moving for the first time.
 

Phuncz

Lord of the Boards
SFFn Staff
May 9, 2015
5,827
4,902
I also loved trackballs, but I realised I wasn't go to be competitive (amongst friends) in FPS shooters, so I re-learned using a traditional mouse.
I've had almost every Logitech trackball, I've even worn out a Logitech Marble FX in the past and needed to buy a replacement...
 

rawr

SFF Lingo Aficionado
Mar 1, 2015
137
10
I've seen some insane CS trackball players :p
With some practice you can be really quick.
 

Phuncz

Lord of the Boards
SFFn Staff
May 9, 2015
5,827
4,902
Well, the issue for me was back then also that I'm left-handed and the good trackballs that I knew of were all right-handed. I struggled a bit but I managed.
I started using a normal mouse with my left hand but I couldn't get the accuracy as I did with my right hand, after weeks and weeks of a lot of struggling.

Now I can use both hands with a mouse (quite handy as a system administrator :D) although only one at a time and still reduced accuracy on my left hand.
While I could go back to trackballs, I'm afraid that it will leave me frustrated with the multitude of normal mice in my direct environment.
 

GuilleAcoustic

Chief Procrastination Officer
Original poster
SFFn Staff
LOSIAS
Jun 29, 2015
2,967
4,390
guilleacoustic.wordpress.com
I'm playing TF2 with this trackball and I see no difference, except that this is less stressing for my finger tendons. The 53mm / 2.25" (cue sized) ball helps a lot here. Now, using my regular mouse at work is a PITA, feels so cheap and rubbish.

I'm designing my very own trackball at the moment. Still hesitating between laser sensor (I bought a 8200 DPI laser motion sensor) or opto-mecanical using high resolution optical encoders like the current trackball but with 10-20x the resolution.
 

confusis

John Morrison. Founder and Team Leader of SFF.N
SFF Network
SFF Workshop
SFFn Staff
Jun 19, 2015
4,129
7,057
sff.network
Excellent work GuilleAcoustic. I'm looking forward to your scratchbuilt trackball - I've had a few sneak peeks at the design and hardware elements :)
 

Phuncz

Lord of the Boards
SFFn Staff
May 9, 2015
5,827
4,902
Impressive, making your own input device from scratch !

The problem I had with (Logitech) trackballs was their ability to keep up with fast movement, not so much as precision. I don't know how these fare though.
 

GuilleAcoustic

Chief Procrastination Officer
Original poster
SFFn Staff
LOSIAS
Jun 29, 2015
2,967
4,390
guilleacoustic.wordpress.com
Excellent work GuilleAcoustic. I'm looking forward to your scratchbuilt trackball - I've had a few sneak peeks at the design and hardware elements :)

Thanks a lot confusis !

Impressive, making your own input device from scratch !

The problem I had with (Logitech) trackballs was their ability to keep up with fast movement, not so much as precision. I don't know how these fare though.

That's quite the challenge here, but I know this is doable now. I've had a Logitech wireless trackball and didn't like the ball suspension mecanism (some kind of tiny balls serving as bearing). Here, it uses stainless steal rod and sealed ball bearings. The ball rotates smoothly and keeps rolling when you give it a pinch. So far, I haven't had any issue with speed, even if I give the ball enough force to make over 2 turns with a single pinch.
 

Phuncz

Lord of the Boards
SFFn Staff
May 9, 2015
5,827
4,902
Yeah the Logitech have more friction and it was these tiny balls that were worn out which didn't allow smooth rolling anymore. The trackball you have seems to be made to last decades ! The Logitech also used a seemingly standard mouse sensor for their movement with texture on the ball, while yours seem to have independant axes and a sort of rotating encoder like solution. It will undoubtibly give a better resolution and probably speed.
 

GuilleAcoustic

Chief Procrastination Officer
Original poster
SFFn Staff
LOSIAS
Jun 29, 2015
2,967
4,390
guilleacoustic.wordpress.com
Yeah the Logitech have more friction and it was these tiny balls that were worn out which didn't allow smooth rolling anymore. The trackball you have seems to be made to last decades !

This device is from 1989 and came with sealed manual and floppy drivers. It was NWB (New Without Box :D). I'm pretty sure it could survive a nuclear winter.

The Logitech also used a seemingly standard mouse sensor for their movement with texture on the ball, while yours seem to have independant axes and a sort of rotating encoder like solution. It will undoubtibly give a better resolution and probably speed.

It does use rotary encoders. The disc has about 20 shafts with a ball to roller ratio around 10. With the 4x mode, it gives a resolution of 400CPR. I don't know if it gives better resolution, but the motion is smooth as butter and it keeps up with high rotation speed.

For my DIY project, I'm hesitating between the sensor I bought from Tindie and a high CPR rotary sensors from Avago technologies:

I really like the feel from optomechanical trackballs, with a proper bearing and a 2.25" to 3" ball it should be great. 500CPR is for a full rotation of the encoder disc, so with a roller to ball ratio of 10 it would virtually give 5000 count per ball revolution.
 
Last edited:

PlayfulPhoenix

Founder of SFF.N
SFFLAB
Chimera Industries
Gold Supporter
Feb 22, 2015
1,052
1,990
This is just incredibly neat :D

As someone who's never used a trackball - could you (or anyone else) elaborate on why they are preferable to a traditional mouse for certain people? I can't tell if it's an accuracy thing, or a comfort thing (or maybe both).
 

rawr

SFF Lingo Aficionado
Mar 1, 2015
137
10
Trackballs reduce strain on part of your wrist and hand. Certain people also feel like they have a higher dexterity when controlling with their thumb. It is easier to flick using the trackball too, then simply stopping the spin when you need to.
 

jeshikat

Jessica. Wayward SFF.n Founder
Silver Supporter
Feb 22, 2015
4,969
4,780
I'm actually not very precise with a trackball, I have a Logitech G502 (awesome mouse BTW) for that. I have both a Logitech M570 trackball and the mouse on my desk though because I find switching back and forth helps avoid carpal tunnel since they require different sets of muscles to operate.
 

GuilleAcoustic

Chief Procrastination Officer
Original poster
SFFn Staff
LOSIAS
Jun 29, 2015
2,967
4,390
guilleacoustic.wordpress.com
I used both thumb and finger operated trackballs. I prefer finger operated ones, but that only involves my own feelings.

As mentioned, Trackballs reduce strain on your hand. I often had carpal tunnel syndrome with the heavy usage of the mouse at work. This been solved with the trackball. With training, you can also gain accuracy and speed but it really depends on your device and how much time your wiling to invest :D.
 

Phuncz

Lord of the Boards
SFFn Staff
May 9, 2015
5,827
4,902
I had the same experience, it reduces a lot of the strain. With the Logitech Marble FX I was using most of my fingers to control it and it doesn't tire your muscles or joints as much or at all.

But after doing some more research into the different types of mice (mainly the shape) and the way I tend to hold and use them, I found a suitable mouse for me, the Raizer Taipan. I use a combination of Claw and Fingertip gripping, but in the past I was mainly focused on Palm grip mice because it made sense to me. But I was very wrong in thinking I could force comfortability with a mouse that seemed to fit my hand well.
 

Phuncz

Lord of the Boards
SFFn Staff
May 9, 2015
5,827
4,902
I was also worried but in the end I don't notice it. I still managed to whoop a lot of ass in most shooters at the most recent LAN party, considering I'm left-handed and use my mouse in my right hand.