(also see DIY Optical Sensor Page)

Connecting the Ultimarc/STC 2-1/4 inch trackball
This is supplied with connecting cables. There is one cable per axis. The location of the two plugs is described in the table looking from the top.
Set the jumper to "A/LO". The GND and +5V from both plugs go to the same GND and +5V connections on the Opti-PAC.
Plug at "12 o'clock" position Plug at "9 o'clock" position
Black Red Yellow Green Black Red Yellow Green
GND +5V Y1 Y2 GND +5V X2 X1

(Old colour code used until Dec 2003 was: Brown = GND Black = X1 White = X2 Red = 5V )

Connecting a Happ trackball
The Happ trackball is supplied with a connecting cable. Cut off the large plug mounted on one end. Strip a short length of each wire and connect as shown in the table below. Set the jumper to "A/LO".
Black (2 wires) Red (2 wires) Purple Blue Yellow Green
GND +5V X1 X2 Y1 Y2

There are two +5V and GND wires. These can both be connected to the same +5V or GND connection.
The Happ trackballs have a green ground wire. This is to prevent static buildup and can be connected to any convenient ground point.
Set the USB/Serial jumper to the correct position for the interface and cable you are using.
Plug USB cable into the "Port 1" connector on the board and connect to the PC USB port. The PC will auto-detect the device and install a standard mouse driver. (Actually it installs two mouse devices)
OR:
Connect one serial cable from the "Port 1" connector on the board to the PC serial port.
If using the serial interface, a power source is needed. Connect the supplied power cable to the header plug on the I-PAC. The power cable should come already connected to the Opti-PAC board if ordered as a serial board. If it is not already connected, the wire colours are:
Either RED to 5V and BROWN to GND
or WHITE to 5V and BLACK to GND


Software
Windows
There is no need for any extra software when using Windows. If you are already using a PS/2 mouse in Windows (which you can continue to use) you may have to do a "Hardware Detection" so that the additional port is found. The Opti-Pac appears to Windows as a standard Plug-and-Play serial mouse, when serial port 1 is used. In USB mode the device is detected as two mice (even though only one device will be active if you are only using Player 1)
DOS (serial mode) you will need a mouse driver. The normal Microsoft Mouse driver can be used and will auto-detect the Opti-Pac as a Microsoft mouse. The driver supplied with EMU+ and later MAME versions is the "cute-mouse" driver CTMOUSE.EXE. Use the command-line switches /M and /1 for Microsoft mode on com port 1 (or change this second switch to the com port number you are using if it's not com1)
Note that without the /M switch, CTMOUSE defaults to "mouse systems mode" which will not work.
Serial mode is fully supported in DOS but USB mode should also work on most PCs.
We have had feedback that this mouse driver also works very well.
For enabling the second port (Player 2), the special dual mouse driver is required. This is included in later MAME versions and there is a readme file describing it's use.

Buttons.
If required connect two buttons to the button connections as marked (ie Port 1 L=left button. Port 1 R=right button). For each button, one connection goes to one of the four button inputs, the other goes to any connection marked "GND". You can use your control-panel buttons which are already connected to an I-PAC board. Just wire them to both an I-PAC input and an Opti-Pac mouse button input.

Correcting Reverse Movement.
Depending on the orientation of the trackball the horizontal and vertical movement may be reversed.
If the horizontal and vertical axes are reversed, swap the "X" wire connections with the "Y" connections.
If either of the horizontal or vertical movements are backwards, swap the X1 wire with X2 or swap Y1 with Y2 as appropriate.

Other Devices

Connecting a Suzo or Wico 2 1/4" Trackball.
The Suzo trackball (also supplied by Wico) is supplied with two plugs which are designed to have wires pushed into the connections. A small screwdriver is needed to do this. The pins are numbered on the plug, 1 to 4. There is one plug for vertical axis and one for horizontal. Connect as follows:
Vert 1 Vert 2 Vert 3 Vert 4 Horiz 1 Horiz 2 Horiz 3 Horiz4
+5V Y1 Y2 GND +5V X1 X2 GND

There are two models of Suzo trackball: Active High and Active Low. Set the A/HI or A/LO jumper as appropriate.
These are the part numbers:
29-0210: Active Hi White ball
29-0210-2: Active Hi Red ball
29-0230: Active low White ball
29-0230-1: Active low Red ball
See above for button connection and software.

Adding a second device to the first port.
Another device such as a spinner or rotary joystick can be added to Port 1.
Connect as above to the connection group marked "Port 1 Rotary".
A spinner uses only one axis so connect this to the X1 and X2, +5V and GND only. A second single-axis device can be connected to Y1, Y2, +5V and GND. The selection of which axis to be used in each game (and therefore which control) can be made in MAME. So now we have a trackball and a spinner connected to one serial port or the USB port. Which one is active at any time? See below:

Automatic switching between devices on one port.
If devices are connected to Port 1 Trackball and Port 1 Rotary, they are both routed to serial port 1 or one USB mouse device. The active device is automatically switched as follows:
The first device to be moved becomes the active device. The other is disabled to prevent it from interfering with the game.
If neither device is moved for 5 seconds, the first to be moved after this time becomes the active device and the other is disabled. This also applies to devices connected to Port 2 inputs.

Using two ports (2 players)
The Player two port requires the following to operate:

USB MODE:
Windows. MAME
No extra USB cable (one cable handles both players)
or:
SERIAL MODE:
DOS only
Late MAME version with dual mouse-driver functionality installed.
Two serial ports and cables.

Connection of devices to Port 2 (Player 2 port) is identical to Port 1. The automatic device switching described above applies to port 2 also. There are some restrictions on the use of port 2 as follows:
Port 2 cannot be used on it's own. If only one port is being used it must be Port 1.
In USB mode, port 2 uses a second USB mouse device (although this is via the same cable as Port 1). Recent MAME versions support independent mouse devices.
Port 2 cannot be used with Windows in serial mode. Windows can only accept one serial mouse and one PS/2.
Port 2 cannot be used with a standard Microsoft mouse driver in serial mode. It is intended for use with the special dual driver supplied with EMU+ or later MAME versions.
Port 2 will not function in serial mode unless a mouse driver is installed and working on Port 1 also. To test Port 2 using the standard Cute-Mouse driver the board must be initialised by issuing the following DOS commands: (assuming Port 1 is connected to COM1 and Port 2 to COM2):

CTMOUSE /M /1 (initialise COM 1 driver in Microsoft mode)
CTMOUSE /U (Unload driver)
CTMOUSE /M /2 (initialise COM 2 driver in Microsoft mode)

Routing Port 2 controls to Port 1.
Controls connected to either of the Port 2 input groups can be routed through to Port 1. This gives a large number of available control types for one player. To do this, move the "P1, P1+2" jumper to the "P1" position. (or install JP1 on older boards)
With the jumper in the "P1" position, controls connected to "Port 2 Trackball" are fed to Port 1 in the same way as "Port 1 Trackball". There is no timeout or switch-over between them, they are simply paralleled and act together. The rotary control inputs are also merged in the same way.

Detailed Information.
block diagram Any optical wheel type sensor type device can be connected to the Opti-Pac. In order to connect other devices this section contains further information on the connections.

How a track ball works.
A trackball functions in exactly the same way as a mouse. Each axis has a slotted optical wheel which is located between two sensors mounted alongside each other. The two sensors generate pulses when the wheel is rotated. These pulses are decoded by the software in the microcontroller (on the Opti-Pac board or inside the mouse) to generate horizontal or vertical movement information which is sent to the PC.
The two sensors correspond to the X1 and X2 inputs of the Opti-Pac, or the Y1 and Y2 for vertical. On a trackball the horizontal and vertical axes are two completely separate circuits.
A spinner is a single-axis device so simply has only one of these two identical circuits. This means two spinners require the same number of inputs as one trackball.




Connection Schematic.
Below is a schematic showing one Suzo Active High trackball and two buttons connected to the Opti-Pac.

schematic
Here is some information on the function of each connection and jumper in order to interface other controls to the board:
X1,X2 Y1,Y2 Inputs from the phototransistors on the optical sensor
+5V Positive voltage supply to the optical sensor LED. Note that all connections marked +5V are connected together on the board and any one can be used.
GND Return from the optical sensor LED. Note all connections marked GND are connected together on the board so any one can be used.
Port n Button L Left mouse button input. (connect other switch contact to any GND)
Port n Button R Right mouse button input. (connect other switch contact to any GND)

The optical sensor connections are grouped into four control groups. Each of the four groups can accept one trackball or two single-axis devices such as spinner, rotary joystick etc.
There is no difference in the function of the "Trackball" groups and "Rotary" groups. The different names are for convenience only.
The two control groups marked "Port 1 Trackball" and "Port 1 Rotary" are routed to Port 1 (Player 1) This would normally be connected to Com 1 serial port.
The two control groups marked "Port 2 Trackball" and "Port 2 Rotary" are routed to Port 2 (Player 2) This would normally be connected to Com 1 serial port.
The "Port n Trackball" and "Port n Rotary" are differentiated from each other using the "First-to-be-moved" system described above, with a 5-second timeout.

Jumpers.
LO / HI jumpers: There are two jumpers for setting whether active high or active low devices are in use. One jumper affects both Port 1 and 2 "Trackball" inputs and the other affects Port 1 and 2 "Rotary" inputs. This means any devices connected to the ports marked "Trackball" must be the same polarity, and devices connected to the ports marked "Rotary" must be the same polarity. The design of the device determines whether it is active low or high.
JP1: Installing this jumper routes Port 2 inputs to Port 1.
This means ALL inputs are fed to Port 1.
JP2: This is for test only.

Diagram of jumpers.
Jumpers

Software Summary.

USB MODE: One Player, one trackball/spinner. Windows (all versions)
Simply plug in the device. Windows will detect it and install USB mouse drivers.
USB MODE: Two players, two trackballs/spinners. Windows XP/2000
Recent MAME version required. Plug in the device. Configure as per instructions.
SERIAL MODE: Windows with Win Application (MAME32 for Windows):
An ordinary mouse can still be used on the PS/2 mouse port. With the OPTI-PAC connected to one serial port click "Control Panel", "Add New Hardware". Let Windows detect new hardware and it should find a "standard serial mouse".
From now on, both the PS/2 mouse and the OPTI-PAC device will control the cursor.
SERIAL MODE: Windows with DOS application in a DOS box.
If a "standard serial mouse" is shown in "control panel, device manager" remove it. Windows will find your ordinary PS/2 mouse on startup but should NOT detect the OPTI-PAC device. Then, from the DOS box, load a standard DOS mouse driver. The "CTMOUSE" driver supplied with EMU+ is a good one. Normally you could use a batch file to load the mouse driver every time the DOS emulator starts.
SERIAL MODE: DOS Mame.
Use a standard mouse driver in the "autoexec.bat" file to load on bootup, such as the CTMOUSE driver. Ensure it is configured for Microsoft mode.
SERIAL MODE: Two Serial Ports.
For using two ports, you need EMU+ or the functionality which has been added to MAME. This is a DOS MAME so must be run in native DOS or a Windows DOS box. Two mouse drivers are used, CTMOUSE for the first COM port and OPTIDRV for the second. Full instructions are supplied in the Readme.txt file that accompanies EMU+.

Advanced Configurations.

Software-switched single-player mode (serial).
In this mode connect a trackball to Player 1 inputs and spinner(s) to Player 2 inputs. Connect PC to both serial ports. Enable the trackball by issuing the command "CTMOUSE /M /1" or swap to the spinner by issuing "CTMOUSE /U" then "CTMOUSE /M /2" via batch files.

Manual Switch Mode.
If you need any controls that can be enabled/disabled by a manual switch, connect them to Player 2 inputs and connect a switch to JP1. Use only Player 1 serial port. The switch will enable/disable the controls connected to Port 2.

Controls selected by MAME.
You can connect two spinners via USB or one serial port and configure games in MAME to allow 2 players to share one port, one player going via the vertical mouse axis and the other player via the horizontal axis. MAME has a great deal of flexibility in this area.

Troubleshooting Trackball Connection Problems.

If you have no trackball movement, try the following.
Remove one trackball optical sensor PCB from the trackball. These slide out after removing a small round retainer with a tab.
The track side of the PCB should look like this. If it is the "special" type for Mini-PAC it will have two extra resistors added to this side.


With a voltmeter check the following with the board still connected to the Opti-PAC.

Black probe on GND, red on 5 volts. This should read 5 volts.
If this does not read 5 volts, check the wiring from the PCB locations to the 5V and GND tags on the Opti-PAC. Use the continuity setting on the meter, after disconnecting the Opti-PAC from the PC (ie remove power)

Black probe on GND, red on X1
The voltage should be approx 0.5 volts. Then place an object in the slots on the sensors on the other side of the board. The voltage should rise to approx 4.5 volts.
Voltage stuck low: this indicates a wire problem between the PCB and the Opti-PAC terminal, or Hi/Lo jumper not set to LO.
Voltage stuck high indicates a problem with the optical sensor or a wire connected to the wrong terminal on the Opti-PAC

Repeat the above for the X2 connection.

Repeat all of the above tests with the other axis. You might be able to isolate the problem by swapping PCBs or cabling.