[comp.sys.amiga.hardware] Hacking a Microsoft Serial Mouse for the Amiga

easton@edmund.cs.andrews.edu (Jeff Easton) (03/04/91)

     Note:  Somebody might want to capture this and place it in the Amiga
     archives on ab20...


              Converting A Microsoft Serial Mouse To Work On The Amiga



     Introduction


       From reading the occasional complaints on Comp.Sys.Amiga, it appears that
     many people are interested in replacing their stock Amiga mouse with
     another type of input device.  Witness the Atari Trackball modifications
     and also the Boing Optical Mouse.

       This article will explain the basics of the Amiga mouse, and in
     particular, how to modify the Microsoft Serial Mouse (the newer white dove
     bar one) to work on the Amiga.  The principles outlined in this article can
     be applied to modifying other mice.  Matter of fact, other mice may be
     simpler to modify (i.e. the Microsoft Bus Mouse).  The reason I chose the
     Serial mouse was that it was laying around already.


     Disclaimer


       This modification requires opening up your Microsoft serial mouse and
     removing a chip and adding two resistors, one of which is a surface mount
     resistor.  If you feel uncomfortable with this then either find someone
     that isn't or don't try this modification yourself.

       I make no claims that this modification will work for you.  It worked for
     me, your mileage may vary...


     Amiga Mouse


       The Amiga supplied mouse is rather simple as mice go.  It provides the
     basic XY quadrature signals and lets the Amiga figure it out from there.
     This is actually a good thing, as it lets us use other devices by simply
     removing any back end processing or signal massaging circuits to get back
     to the raw XY signals.

       Basically, the Amiga mouse has two rollers that touch the mouse ball in
     the X and Y direction.  As the ball rotates in the X (right <-> left)
     direction, X roller shaft spins.  If the ball rotates in the Y (up down)
     direction, the Y roller shaft spins.  Any combination of XY direction, and
     the roller shafts spin a proportionate amount in the X and Y  directions.

       Each shaft is connected at the end to a slotted disk.  Each disk has a
     LED emitter/ detector pair that "reads" the slots as they spin by, creating
     a logic pulse for each slot seen.

       Notice that there are two detectors for the X disk and two for the Y
     disk.  Each pair are mounted physically 180 degrees apart on the slotted
     disk.  The odd number of slots appear to be cut into each disk, so that it
     is impossible for the pair of logic pulses to occur exactly at the same
     time.  This is how the mouse can signal the direction that the mouse is
     moving.

       For example, lets look at just the X slotted disk/detector pair.  Lets
     call the two output signals Xa and Xb.  If the mouse is moving to the
     right, the signals would look like this;

               ____         _______          _______
           Xa      |       |       |        |       |
                   |_______|       |________|       |________


                  ____         _______          _______
           Xb         |       |       |        |       |
                      |_______|       |________|       |________


       The graphics are terrible, but you get the picture.  If the mouse is
     moving in the opposite direction, then Xb would go low first, followed by
     Xa.

       The same thing happens for the Ya and Yb pair.  In fact, you can treat
     the Y pair as up down equivalent to the X pair.

       Each of the four detector signals (x pair, y pair) is conditioned by a
     LM339 Quad Voltage Comparator IC.  The LM339 basically shapes up the
     signals before being sent to the Amiga.  Each of the four comparators is
     used, one for each of the detector signals.

       An example of the comparator circuit looks like this;



          o Vcc                   100 K               o Vcc
          |                                           |
          |                 ____/\/\/\/\____          \
          /                |                |         /
         |                 |    |\          |         \ 3.3K
         |  detector       |    |  \        |         /
         \_________________|____|+   \      |         |
          |                     |      \____|_________|____  Pin x on DB9
          \        o Vcc        |      /
     2.2K /        /        ____|-   /
          \   10K  \       |    |  /
          /        /       |    |/
          |        |_______|
         ---       |
          -        \
             2.7K  /
                   \
                   |
                 -----
                  ---
                   -


       The 10K, 2.7K resistor divider sets a trip voltage of around 1.0 volts
     for the comparator.  This is important since the detector puts out around
     .5V for a low pulse.  The resistor divider is also shared by all four
     comparators in the LM339.

       The two mouse buttons are simply switches to ground.  When you press one
     of the buttons, it grounds a DB9 pin.  The corresponding pull-up resistors
     must be inside the Amiga.

       The mouse cord terminates inside the mouse in a connector marked CN-1.
     Below is the pinouts for the mouse cord.

       DB9     CN-1       Function
     -------------------------------------
        6       1         Left Button
        9       6         Right Button
        8       9         Signal Ground
        7       8         Vcc (+5 Volts)
        3       5         Ya
        1       2         Yb
        2       3         Xa
        4       4         Xb
        5       7         No Connect
      Shield Drain Wire   Ground

       The DB9 pinout is per the convention for DB9 connectors.  The CN-1 pinout
     is per the numbers molded into the top of the connector.


     Microsoft Serial Mouse


       The Microsoft serial mouse starts out the same as the Amiga mouse, with
     an almost identical roller shaft/slotted wheel/LM339 arrangement.  The
     similarities stop there.  Since this is a device that is hooked to an IBMPC
     serial port, the mouse must send signals that look a lot like serial data
     for the UART inside the PC to understand it.  Also, the mouse must derive
     its power from a serial pin which the mouse driver sets to +12 volts.
     These two differences is where the modifications come in.  First lets look
     at the Microsoft mouse's circuits then we'll get into the modification.

       The Microsoft mouse uses a similar roller shaft/slotted wheel arrangement
     as the Amiga mouse does.  The one difference to note is that the Microsoft
     mouse uses one LED emitter per X and Y axis and has a dual detector that is
     all in one package.  This is apparently a cost reduction measure but the
     net effective output is the same as the Amiga mouse.  The dual quadrature
     signals for X and Y direction are identical to the Amiga mouse.

       Each of the XY pairs goes to a LM339 comparator just like the Amiga
     mouse.  The resistor values are different and there is also a diode to
     ground on each detector output (presumably for protection).

       The four outputs of the LM339 as well as the two switch inputs are fed
     into the microprocessor marked "Mitsumi MS02".  This uP apparently reads
     all the input events and sends a serial data stream to the UART in the PC.

       There is a zener diode circuit to limit the +12v down to +5 volts for the
     LM339 and uP.  Unfortunately, the emitter LED's and the resistor divider
     circuit are powered directly from the +12V.


     Modifications for the Microsoft Serial Mouse


       To perform this modification, you will need the following items;

       Soldering Iron
       Solder
       Solder Wick (or a desoldering station)
       1) 470 1/4 Watt resistor
       1) 10K surface mount resistor (clever people may be able to use
             a 1/4W or 1/8W regular resistor).
       9 conductor w/shield cable. If your Amiga mouse is dead, this is
             the best cord to use.  The cable must be small enough to fit
             thru the slot at top of the mouse
       Phillips screwdriver

       First disassemble the Microsoft mouse.  Turn the mouse over, peel off the
     serial number label.  Under it you will find two recessed screws.  Remove
     the screws.  Turn the mouse right side up.  pull up gently on the bottom
     end (away from the buttons) of the top of the mouse case. lightly pull back
     on the top to disengage the latch that is inside the mouse near the front.
     It might help to use a small screwdriver to push gently on the tab just
     above the mouse cord at the same time.  The cover should come off.

       Remove the mouse cord by disconnecting the cable at CN1.  Remove the two
     screws, one on each side of the ball assembly.  The circuit board should
     now come out of the lower housing.

       Remove the IC nearest the CN1 connector.  It should be marked "Mitsumi
     MS02"  Do this carefully, as we will use the holes to solder in the new
     mouse cable.

       Notice the thick trace running thru the center of the IC just removed.
     It has 6 surface mount resistors connecting it to various pads of the IC.
     It also connects directly to Pin 8 of the IC.  This is VCC (+5V).  Now find
     the surface mount resistor directly to the left of the CN1 connector pads.
     It should be marked "182".  Now take the 470 ohm resistor and fashion the
     leads to fit between the VCC trace and the top side of the 182 resistor
     (side nearest the IC just removed).  Cut the leads to length as necessary.
     Form the leads so that they don't short on anything else.  I formed mine
     like this;

                o  o  o  o  o  o  o  o
                            |  |          where | is a surf. mnt. resistor
              ________________            <---
             |           |   |     |
      470    \  o  o  o  o  o  o  o  o    <-- IC removed
     Resistor/
             \   o  o  o
             /
             |_______
                    |    o  o  o  o  o    <-- CN1
                  "182"
                  surface mount resistor

       This just fixed the first problem.  The current limiting resistor for the
     LED emitters was tied to +12 volts thru a 1.8K ("182") resistor.  Since we
     don't have 12 volts, the 470 ohm resistor to +5 volts replaces it.

       Next, find the empty surface mount resistor pads just below pins 3 and 4
     of the LM339 IC.  Solder the 10K surface mount resistor to these pads, like
     this;
                  |
               o  o  o  o  o  o  o
               |  |  _  _                where | is a surf. mnt. resistor
                     Pads                <---
               |
               o  o  o  o  o  o  o       <-- LM339 IC

       This fixes the second problem.  The resistor divider was tied to +12
     volts as well.  Adding this 10K resistor resets the divider to 1.0 volts
     when dividing from +5 volts.

       Next, solder your new mouse cord to the pads of the removed IC according
     to the following chart;

       DB9      IC pad        Function
     --------------------------------------
        1        12            Yb
        2        10            Xa
        3        11            Ya
        4        9             Xb
        5        No Connect    Not used
        6        13            Left button
        7        16            Vcc (+5V)
        8        8             Signal Ground
        9        14            Right Button
      Shield wire  to CN1, pin 5

       The shield wire is required, since the LED emitters are grounded to it.

       Recheck your work.  Screw the circuit board back into the lower housing.
     Route the mouse cord around the left of the ball assembly and out thru the
     cutout.  Snap on the top cover.  Screw the top back on.

       Your new mouse should be operational.

       If it doesn't work, check the following;

     Pointer moves left when mouse is moved right.  The Xa and Xb lines are
     swapped.  Reverse them.

     Pointer moves up when mouse is moved down.  The Ya and Yb lines are
     swapped.  Reverse them.

     One or both buttons don't work.  Recheck your connections.  Is the cable
     interfering with the switches near the top of the mouse?  Can you hear the
     switches clicking?  Is the top cover snapped on correctly?

     Neither direction moves the pointer.  Make sure the shield wire is
     connected to CN1, pin 5.  With the Mouse connected and the Amiga on, check
     for +5 volts on the LM339;  Pin 3 is Vcc, pin 12 is ground.  Check for
     around 1.0 volts on pins 4,6,8,10.  If its not close, recheck your 10K mod.
     Check to see if there is a voltage drop across the LED's.  If not, check
     your 470 ohm mod.


     Conclusions


       With the information here and some circuit tracing on your part, you
     should be able to modify other mice in a similar manner.

       Enjoy your new mouse!


       Jeff Easton
       easton@andrews.edu