Adapter to connect a PS/2 mouse to a serial port

 ps/2 to serial

If you still have an old computer, the problem is to connect to it modern mouse may be familiar to you. Old mechanical mouse, sooner or later come into disrepair - cable wear, buttons do not work, etc. In general, modern laser mouse is usually much nicer than the devices of the last century like this

old serial mouse

The PS/2 interface actively used in branded computers starting with 286 (IBM PS/2), but the COM-port for a long time remained the standard for connecting a mouse and actively used until the early 2000s (until the "second Pentiums" inclusive). Because the serial mouses are no longer produced, then the for PC without a PS/2 port is still two options: adapt the PS/2 or USB mouse. With PS/2 mouse everything is much easier - this protocol can be implemented in almost any microcontroller, such as ATMega8. In the case of USB mouse you have to use more serious chips with hardware support for USB in the host mode. Yes, sooner or later, a PS/2 mouse will be a rare antique, but because now they are also available without a problem, this option seems most appropriate to me.

The adapter is built on ATMega8 microcontroller and uses MAX232 to match the TTL signal levels with a serial port levels. The microcontroller receives data from the PS/2 mouse and transmits them via the UART.

Adapter circuit:

ps/2 mouse adapter circuit

On the PCB can be installed either a DB-9 plug (allowing to stick adapter card in a computer instead of a mouse), and IDC-10 connector (for connecting directly to the motherboard or multicard via cable). In the second case, the adapter can be installed inside the computer box.

ps/2 mouse adapter pcb

The adapter requires +5V supply for themselves and connected mouse. Alas, powered adapter from COM-port is not possible because optical mouse eating electricity more than their mechanical tribesmen. Power supplied by the COM-port for this is not enough. I did not place on board a separate power connector, for this purpose you can use the 6-pin ISP-connector.

photo of the assembled ps/2 mouse adapter

Additionally on board are three jumpers:

If the jumper is not shorted, the adapter emulates a serial-mouse running on the Microsoft protocol. Communication protocol 1200 baud, 7 data bits, 1 stop bit, no parity control. If the jumper is closed, the adapter emulates mouse with EM84520 protocol.
This group of jumpers can adjust the mouse motion speed: 1, 2, 3 - the more, the faster. These jumpers works as a buttons, and the choice is stored to the EEPROM of microcintroller (ie, you can permanently remove the jumper after saving motion rate)
Serial-mouse is powered by a COM-port. It can be powered either by the DTR (Data terminal ready), or from the RTS (Request to send) signal. That is, to turn on the mouse the computer sets high logic level on the corresponding output. The adapter uses this pin as an activation signal - when the PWR input is set high level, the adapter starts transmitting data from the mouse to the computer.

D1 LED lights when data is received from the PS/2 mouse, ie, when it is moved or key is pressed (or wheel rotation). But for this the logic level on the PWR input must be high.

Unfortunately, on the first version of the PCB, there is one error in connecting the capacitor C3. To fix the problem it is necessary to connect the capacitor to a single pad, and the second its output connected via a small wire to the pin number 16 of MAX232 (this fix can be seen on the pictures above).

Fuses configuration:

ps/2 mouse adapter fuses

Source code and firmware on github

Buy a device

You can buy from us a fully assembled and tested device with worldwide shipping.
The cost of device: 20 USD (shipping is paid for separately)
To make the order please use the site feedback form.

No votes yet