A Converter You Won’t Have: PS/2 Mouse To Serial Mouse

When did you last buy a mouse? Did it have a little adapter in the box? There was a time when if you bought a USB mouse, in the box was also an adapter to allow it to be used with the older PS/2 interface. And if you were to go back a few more years into the past, you’d have found when you bought a mouse with a PS/2 connector fitted, it may well have come with an adapter for a 9-pin RS232 serial port. Those mice from a decade or more ago would have contained the software to recognise the interface into which they were plugged, and emulate it accordingly. It is unlikely then that you could take a modern USB-only device and an unholy chain of USB-to-PS/2-to-serial adapters, and have it work as a serial mouse. Want to run Windows 3.1 on a 386DX? You need a serial mouse.

Happily, [matze525] has come along with a solution for those of you with a need to drive an ancient PC with a serial mouse. He’s created a PS/2 to RS232 mouse converter, and it takes the form of a little PCB with an AT90S2313P microcontroller to do the translation and an RS232 level converter chip.

It might sound like a rather unexpected device to produce, but we can see it fills an important niche. In the early 1990s mice were not the reliable optical devices we have today, instead they had nasty mechanical connections inside, or if you were extremely lucky, optical encoder wheels. The supply of still-reliable RS232 mice must therefore be dwindling, and if you have a Windows 3.1 PC to keep alive then we can see the ability to use a more modern pointing device has a lot going for it.

If you have one of those machines from that era that came with proprietary interfaces, maybe you can make use of a USB to quadrature converter.

68 thoughts on “A Converter You Won’t Have: PS/2 Mouse To Serial Mouse

          1. Until the enameled pattern started wearing off the mouse pad. UofU had some of these in the CS lab around 2001 and between this and the out of date version of Emacs may be part of why the Linux side of the lab got more use.

          2. I had one for a PC, and loved it until they stopped providing driver updates for it. For some reason, there was a time when new programs kept using previously unused mouse driver features, requiring frequent driver updates.

    1. They all have encoders of some form. Not all are optical though. Think yourself lucky that you never encountered the ones where the encoder is a round PCB with tracks in the encoder pattern and a set of springy contacts. A lot of early 90s cheap mice had them. Nasty.

        1. I have one in a box somewhere, Envision an axle with a disk on the end, kind of like a dremel cutoff bit. On that disk are traces that look like spokes emanating from a solid ring near the axle, but about halfway out, they dogleg a bit, and then continue out to the edge. Then, in the sensor there are three brushes. One toward the center that contacts the ring. This is the ground brush. Then about a third of the way out a brush (the A signal), then two thirds of the way out another brush (the B signal) that picks up the trace after the dogleg.

          So what happens is, A and B have pullups on them and will generate a square wave on the brush when rotated as the brush hits the ground trace on the wheel. However, because of the dogleg, there is a 90° phase shift between A and B. This generates quadrature signaling.

          It’s probably described elsewhere, but quadrature signaling is two square waves with 90° phase between them, such that if A leads B, you are moving clockwise, and if B leads A, you are moving counterclockwise. Every edge is a count, although usually there is one bit of hysteresis to avoid jittering if the mouse stops on an edge.

          Put one encoder on a vertical axle, and another on a horizontal axle, and you can then determine XY motion distance and direction.

          1. Just to follow that up, an optical wheel encoder has a similar wheel but instead of traces, it is just a plastic wheel with actual spokes and gaps. There is an IRLED placed on one side of the wheel, and a dual phototransistor placed on the other side such that one PTR is above the other, so that as the wheel rotates, a spoke covers one before the other. These are your A/B signals, and they generate quadrature just like the copper version. These never wear out but can get dirty. They also are subject to part-to-part tolerance issues, so there is a gain algorithm to condition the signal after capture for dirt or part tolerance to create clean 50% duty digitized signals to send to the quadrature decoding firmware.

          2. Ah,, so it’s like a dial on a cheap multimeter. Interesting.
            That stuff is still used in POV and some machines though, it should be usable; albeit sensitive to debris and feeling scratchy in use maybe.

            Incidentally, I’m familiar with the standard IR interrupt system, and that is also a standard that is used today in many things including half of the mouse-wheels. And talking of which, the cheap mice have wheels that from the looks of it might actually also work with the old brush system come to think of it, while the actual sensor is modern.

          3. So, here’s a photo of an optical wheel. The LED is the clear box, the dual PTR is the black one (but passes IR light).
            http://www.technoreeze.com/wp-content/uploads/2012/01/6629207891_54a9036bf3.jpg

            And a drawing of a mechanical wheel traces:
            http://www.powerguru.org/wordpress/wp-content/uploads/2013/12/Incremental-encoder.jpg

            The mechanical one has a feature of a small gap in the ground ring so you can detect the 0° position. The ring has to be grounded elsewhere, such as by bonding it with the shaft, so that the ring is actually a detection ring (called Z).

  1. > And if you were to go back a few more years into the past, you’d have found when you bought a mouse with a PS/2 connector fitted, it may well have come with an adapter for a 9-pin RS232 serial port.

    But then you say…

    > It might sound like a rather unexpected device to produce

    PS/2 to Serial were prevalent and available everywhere, you even point that out. So why would this be a converter we don’t have?

    1. Im guessing if the mouse does not support the adapter. The adapters are passive, they rely on the uC in the mouse to detect if it is on a PS2 or serial connection. If it is a newer PS2 mouse that does not support it then you might need something. Though at that point I would probably just use a Teensy with USB bus master to convert to serial instead of relying on a almost as obsolete PS2 mouse.

    2. The 9 pin _adapter_ was just for the electrical connection to the serial port. The mouse itself had the dual PS2 / Serial protocol built in. New USB mice likely won’t have PS2 or serial.
      This _converter_ allows a PS2 protocol mouse to talk to system expecting a serial mouse.

      1. Modern corded USB mice often do still support PS/2, even if they have no reason to, because it’s literally no effort to not delete the code.

        But I’ve never heard of one that could switch between all three of USB, PS/2, or any of the various serial protocols.

        1. Given the vast differences between the communications standards (RS-232: single-ended asynchronous serial, PS/2: single-ended synchronous serial, USB: differential asynchronous serial), I seriously doubt if such a mouse could be developed easily.

          Dead easy to detect when a line is pulsing to infer that’s a clock and to try sending frames on a data pin. Then there’s RS-232 signal levels to consider.

          1. PS/2 isn’t standard serial like the old serial mouse (TD, RD, (RTS, CTS or XON/XOFF)). PS/2 has *one* bi-directional data wire a the other wire is a clock in one direction (for either direction of data) and a Request To Send (RTS) in the other direction.

          2. Exactly… I believe I characterised PS/2 as “single-ended synchronous serial”, meaning the serial link relies on a clock (the “synchronous serial” bit), and uses single-ended (I think, TTL logic levels) instead of differential signalling.

            RS-232 is single-ended too, but is asynchronous, there is no clock.

          3. USB, PS2 and Serial have one thing in common: Two data pins. They behave differently, and so a mouse can detect what it is connected to based on the initial behavior of the three interfaces. For example, if both lines are high for over 100 uS, then it is not USB. PS2? The host will respond to a query. Serial? The host will respond to an ASCII ‘M’ sent over the Tx line. Anyway, yes, a microcontroller in the mouse that knows this and that can reconfigure its data pins is certainly capable of talking to any such host, as long as the appropriate mechanical connector adapters are used. In some cases, the adapter might have resistors to serve as pullups or pulldowns (PS2 to USB, for example) but in general are passive.

            In the USB/PS2 case, the mouse has to be enabled by the host, so it can toggle between the two modes to see which type of enable it gets. Once it gets one, it knows without a doubt what it is connected to.

          4. Yeah, the problem with serial is that it isn’t TTL-level signalling, it’s RS-232 level signalling. Thus requires a transceiver. To be compatible with PS/2 and USB, you need to be able to switch that transceiver out.

            As mentioned earlier, PS/2 is TTL. USB isn’t strictly TTL, but can be bit-banged that way.

            In any case, why are we measuring delays in millisiemens?

          5. Yes, agreed, the PHY signaling is different between the three interfaces. For a microcontroller that can internally mux USB/GPIO, all you need externally is a level shifter for UART levels, as the MCU can handle USB/PS2 levels.

          6. >Then there’s RS-232 signal levels to consider.

            Technically, RS-232 works anywhere between +-3 … 25 Volts so the TTL voltage levels are sufficient as long as you somehow manage to produce negative voltages.

    3. We have at least four of them rattling around our ‘weird parts bin’ at work, they were very common. In the same bin as the 9-25pin serial converters…it’s like HAD doesn’t acknowledge that time existed before about 2005 or so….

      1. It’s weird because not all of those passive converters were interchangeable.
        No idea why since they all had the same pin-in being USB, and the same pin-out being PS/2, so I guess it was the detection system that would fail to realize an adapter was present. Internal resistor network I would venture to guess. Which indicates a failure to set an industry standard, like so many things built on top of USB., like charge power delivery detection or micro-USB based camera triggers.

        1. There are patents in this space (I hold a couple of them). Some adapters used active or passive parts in the adapter as “improvements” so that they could get around the patents.

          1. Well, they asked why, that’s why. :)

            Incompatible adapters that solve the same problem differently for no good reason other than to avoid infringement.

            Patents aren’t always to make money, sometimes they are to make it EASIER to build in compatibility, with RANDZ licensing. Using that scheme, you can use the IP for free but must do it in the same way for the license to apply.

  2. I have one of these… I also have a bag of USB-to-PS/2 mouse adapters and ATPS/2 keyboard adapters. Mostly the second… I’d love to get rid of about 90% of it. Any takers?

    …I didn’t think so. Oh well. (Seriously, if you want one or five or ten, and you’re in the US — or are willing and able to pay overseas postage — hit me up on the [dot]IO side with a PM. I have the same username there.)

    1. Came here to say this. I have a USB to PS/2, and PS/2 to Serial, as well as PS/2 to AT. I would accept these, but I don’t think I need more.

      My USB to PS/2 didn’t work when I last tried. Maybe because I have a PS/2 port that does Mouse and Keyboard in one port and it can’t make heads or tails of the USB to PS/2.

  3. If I look hard enough I still have my first mouse. A Microsoft serial mouse with two green buttons and a DB25 connector. A none of those wimpy optical or rubber balls. Solid steel nothing less.
    Pre Windows 3. It came a package deal with MS Word.

      1. I have a green eyed mouse. Put it on a USB to serial DB9 converter to get a COM port and it works in Windows 10. At 100 DPI, though, it requires only a full meter of desk space to travel across my 4K monitor…

  4. Back in the old days(85-86?) a school friend’s dad was a CAD designer so he was the only other kid in my class with a real computer, though mine was the intentionally incompatible hardware Tandy 1000EX.
    Anyways his dad had a serial optical mouse, I think I had to wait ten years until I graduated from mouse balls and got one, I am pretty sure it was PS2 or USB by then.

    1. The price difference was something like $50 to $150, and opticals stayed up there until well into the 90s with mechanicals dropping below $10 before that. Think it was late 90s when Logitech and Microsoft did one probably starting at $80ish, when they started getting more adoption.

      1. https://news.microsoft.com/1999/04/19/microsofts-sleek-new-intellimouse-explorer-and-intellieye-technology-toss-out-the-mouse-ball-today-at-comdex/
        https://www.theengineer.co.uk/issues/11-may-2001/optical-mouse-points-to-the-future/

        I found some pictures from 1999 Comdex stage with Bill showing off huge Intellimouse Explorer model https://www.reviewsonline.com/SC99KEY1.HTM
        Cant locate any video from that keynote, maybe Microsoft enforced no filming rule after their 1998 Comdex BSOD live on stage performance :)
        I even have one of the original Intellimouse Explorers, sadly unusable, 17 year old scroll wheel rubber is seeping elastomer? and melting :(

        Interview with Gary Gordon, the HP/Agilent(now Avago, best mice sensors available) inventor, mouse bit at 29:40:

        https://www.youtube.com/watch?v=TxxoWhCzIeU

        spoiler, he didnt get shit for his inventions, he elaborates at 40:10

  5. I built such a converter around an Attiny 2313 about 4 or 5 years ago. It was kinda lame and didn’t have many features (like multiple baud-rates for higher speed and Logitech middle mouse button) but it did the job and I had 4 prototypes built.
    (tempect.de/ps2to232.html) I wanted to build a PS2 to SNES Mouse adapter ever since but lack the time and motivation especially since there is so much else to do.

  6. I thought I was a hoarder. I guess not. I have long since disposed of all those mouse adapter dongles. I do however still have one of the very first Microsoft Optical Wheel mice (pre-Intellimouse) from 1991 and it still works perfectly. You can still buy them as NOS for about $15.
    However, other than retro-computing or a museum, why would you still be rocking Win 3.1? And if you are a retro user or museum, wouldn’t you want a genuine period mouse?
    No, wait. I just looked and I have one USB->PS/2 adapter left.

    1. >have one of the very first Microsoft Optical Wheel mice (pre-Intellimouse) from 1991

      no you dont, first mouse with scroll wheel was released in 1995 + first Microsoft mouse with wheel was called IntelliMouse :). You probably meant 2001

  7. I have a number of old working serial mice stashed away in a box :) One of them is incredibly clunky Genius that looks like a rectangle from above, and is just slightly curved on the upper surface.

    I still have a few 386 boards laying around as well … Never know when the war will break out again :)

    1. I’ve got a Sun Microsystems mouse I have to get working someday for swank value. Probably a couple of serial ones lurking in the back boxes. Also got one around somewhere that the designer tried hard not to put a curve in, angled flats on top of it.

      Think I have at least 2 386 boards also, I think I kind of accidentally acquired those. I badly regret getting rid of one in a move a long while ago, it was awesome, approx 3/4 A4 sized mini AT with an AMD 386sx40 … I guess I could pick one up on eBay but that particular one got me through the early-mid 90s.

  8. I have a USB->Amiga Mouse Adaptor (there are a few on the market, I have a TOM2), which is presumably a small microcontroller with on-board USB stack and the ability to control some I/Os for the native interface on the Amiga.

    (It also works with the Atari ST and C64, and probably the Amstrad CPC mouse interfaces that used a 9-pin female interface).

    Video article about Amiga mouse adaptors: https://www.youtube.com/watch?v=CU1cg9D2B-0

  9. “Want to run Windows 3.1 on a 386DX? You need a serial mouse.”

    Uhh… I have many early PC systems at home that run Win3.1 and happily accept a PS/2 mouse.

    Heck, ever heard of the IBM PS/2 line? Where do you think the term ‘PS/2’ came from?

    Sorry, not meaning to troll, just wanted to clear the air a bit. This stuff is my obsession…

    1. Agreed.

      The term for the small PS/2 plug came from the IBM Personal System/2 that had that same small plug. It’s electrically the same as the large 5 pin DIN keyboard plug used on earlier systems however the PS/2 mouse used different pins on the other side of the connector.

      The Personal Sysyem 2 was just a 80286 so it was even before the 386.

      I called it the Mecano set of computer as there were simple tabs that you lift with your finders to remove components like a floppy HDD etc. no screws.

        1. The bus mouse itself had no active components. It was literally encoders and buttons wired out to a DIN-9 plug. You needed an ISA card to bring those signals into the PC and decode them into motion and buttons. There were no standards at this time, everyone rolled their own, and PCs did not come with serial or parallel ports, you bought an ISA card for everything.

          The InPort card was an improvement over the original Microsoft ISA bus mouse card that used a repurposed Intel 8255 PPI chip to do the conversion to something that could be transported over ISA to the mouse driver. That chip was available but expensive, complicated and not ideal in many other ways. InPort supported not only mouse, but other protocols such as joystick, interrupt reassignment, edge vs level triggering, and multiple devices. However, it was only actually sold on the bus mouse ISA card and never got to use its other features, as the microcontroller market exploded with cheaper solutions before its other modes could be exploited, and the serial port became the ubiquitous ISA card that most folks bought for modems and other peripherals, along with the parallel card for their printer. So, Microsoft moved to serial mice, then to PS/2 as IBM sought to put as many proprietary buses into the PC as possible to recapture the market revenue (MCA, PS/2, etc).

      1. PS/2 had a richer command set, and had mouse and keyboard protocols, whereas the DIN5 PCAT interface only worked with keyboards. the DIN5 PCXT did not support the ability to control keyboard LEDs but this was added to the PCAT DIN5. PS2 added support for the mouse, including controls for mouse resolution, and keyboard controls to change Scan Sets. Later the protocol was extended for Thinkpad TrackPoint (eraser) pointers. That was a hackjob that broke many KVM switches. But that is another story.

        The PS/2 spec has several errors in it. When I brought that up to the folks in Boca Raton, I was told by one of their senior engineers that the spec writer was “no longer with the company” and was a “very junior engineer,” such that I was to interpret that to mean, yes, we know. Sorry. We fired that intern.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.