SmallyMouse2 – Universal USB to Quadrature Mouse Adapter
- 1 Hardware
- 2 Interfaces
- 3 Board links
- 4 Firmware
- 5 Example cables
- 6 SmallyMouse2 Logo
- 7 Conclusions
- 8 Files for download
- 9 Where can I buy one?
SmallyMouse2 is a universal USB to quadrature mouse adapter for many 8-bit and 16-bit retro computers and allows the use of modern USB mice on machines such as the Acorn BBC Micro, Acorn Master, Acorn Archimedes, Commodore Amiga, Atari ST and many more. Unlike most existing mouse adapters, SmallyMouse2 implements a fully USB compatible interface (most current adaptors are PS/2 based) this allows the use of any modern mouse including those that use wireless communications.
SmallyMouse2 provides a smaller PCB footprint compared to the original SmallyMouse and, in addition, has quadrature output headers suitable for both the Acorn BBC Micro (a 20 pin IDC) and a 10 pin SIL header suitable for custom-made cables for retro computers. SmallyMouse2 also supports the Atmel FLIP DFU bootloader (pre-programmed into the AVR chip by Atmel) and can be flashed via USB allowing both initial programming and firmware upgrades without the need for Atmel programming hardware.
SmallyMouse2 also provides an expansion header with 8 GPIO pins. This allows general purpose IO as well as access to the I2C and UART serial hardware of the AVR microcontroller. This header can provide the ability to add a serial debug console as well as other hardware such as status LEDs and additional configuration switches.
SmallyMouse2 has been tested with the following machines (please see the cable pinout section below for details):
- Acorn BBC Micro model B
- Acorn BBC Master Turbo
- Acorn RISC PC 600
- Commodore Amiga A600
- Atari 520ST
If you have successfully tested SmallyMouse2 with a computer that is not in the list above please leave a comment (stating the exact model of computer and the firmware version either below, or as a GitHub issue for the present firmware release – if this involves a pinout which is not provided below, please send a note of the pinout also if possible).
SmallyMouse2 uses an AT90USB1287 microcontroller from Atmel that supports both USB device (used for bootloader programming) and host mode (used for mouse support). Host mode support is required as a USB mouse is a device and therefore needs SmallyMouse2 to act as the host computer. The schematic design for SmallyMouse2 is available from GitHub in KiCAD format:
For details of the various interfaces provided by the SmallyMouse2 design please see the interfaces section below.
The PCB design can be seen in the following picture:
The PCB is designed to be fabricated as a double-sided PCB. Due to the tolerances of the traces and vias on the PCB it is recommended that the board is produced by a professional fabrication service. The required Gerber files for fabrication are included in the GitHub project files.
The PCB design also includes 4 mounting holes for M3 size screws or PCB stand-offs. The USB port is extended over the edge of the PCB to facilitate mounting the board inside an enclosure.
All required components are mounted on the top-copper surface of the board to provide compatibility with pick-and-place machines (and to simplify hand population of the board).
The following components are used by the PCB design:
- 2x 0805 22pF
- 7x 0805 100nF
- 1x 0805 1uF
- 2x 0805 22R 1%
- 2x 0805 10K 1%
- 1x TQFP-64 (14x14mm 0.8mm pitch) Atmel AT90USB1287
- Pin headers
- 2x pin header straight 1×10 pitch 2.54mm
- 3x pin header straight 1×2 pitch 2.54mm
- 1x IDC header 2×10
- 1x Amphenol 87583-2010BLF USB A
- 1x 5032 2-pin 5.0×3.2mm 16 MHz crystal
When powering SmallyMouse2 from the host computer attention should be given to the required amount of current consumed by both SmallyMouse2 and the connected USB mouse. The USB specification generally limits the maximum USB device consumption to 100mA and this figure should be used as the ‘normal’ consumption of USB mice in general. The SmallyMouse2 device (running firmware v1.1) was measured in the range of 59mA to 61mA (the power consumption varies depending on the activity levels of the mouse).
A safe assumption is that the total required current supplied by the host should be 180mA (in total for both the mouse and SmallyMouse2).
In addition, the following mice were physically tested (power consumption includes the SmallyMouse2 board):
- Logitech Performance MX wireless mouse: 83.1mA
- Microsoft Comfort Mouse 6000 wired mouse: 74.2 – 86.4mA
- Kensington Orbit Optical trackball wired mouse: 106-121.5mA
The SmallyMouse2 hardware provides 5 interfaces; USB, JTAG, BBC Micro user-port AMX mouse, generic quadrature mouse (10-pin) and a 10-pin expansion header.
A development board fitted with all available interfaces is shown in the following picture (please note that the JTAG header is only required for development and debug functionality and should not be fitted to general purpose boards):
The USB interface can act in both USB host and USB device mode. When acting as a USB device (i.e. for bootloader programming) the board should not be externally powered (SmallyMouse2 will take power from the host device, so no other power supply should be used). When acting as a USB device it is recommended that all other interfaces are disconnected.
In USB host mode SmallyMouse2 can be connected to any USB 1.0 or 2.0 compatible mouse that uses the USB HID protocol. Note that the USB host mode support is only limited by the firmware; the USB host interface can also be used to support other USB devices (such as keyboards and non-standard mice) provided appropriate firmware support is added.
The USB interface provides a female USB A type connector. For use as a USB device (for example, when programming via the bootloader) a USB A-A style cable is required. In host mode the male USB A connector of the device plugs directly into the available connector.
The JTAG interface is used for direct programming of the AVR microcontroller and is useful for either development work (where the USB bootloader is inconvenient) or board recovery in the unlikely event that the USB bootloader is corrupted or unavailable.
Since the JTAG header is optional (it is not necessary for general use) the interface is provided by 7 solder pads along the top-edge of the PCB. To use the JTAG header you will need to solder an appropriate 2×10 pin-header via wires connected to the available pads in accordance to the pinout of your programmer.
BBC Micro User-Port (AMX Mouse)
The BBC Micro User-Port interface is a 20 pin IDC connector (2×10) as used by the Acorn range of 8-bit computers (BBC Micro Model A and B, BBC Master 128, etc.). This interface allows SmallyMouse2 to be connected to the Acorn computer using a straight 20 wire ribbon cable with appropriate IDC connectors.
The pinout of the interface follows the AMX mouse standard and is compatible with all AMX software as well as the Acorn VFS implementation (used in the BBC Domesday project). The interface also provides power to the SmallyMouse2 board via the host machine, so no external power supply is required.
This interface is optional and can be left unpopulated if Acorn user-port support is not required.
Generic quadrature mouse
The generic quadrature mouse interface is provided by a 10 pin SIL header. 4 pins are used for quadrature output to the retro computer, 3 pins are used for mouse button output and 3 pins are used for power input.
For the quadrature output each direction (X or Y) uses 2 pins marked X1/X2 and Y1/Y2. There is no standard for such pins on retro computers and they are sometimes called Xdir/Xref etc. If you are creating a cable for a retro machine then the mouse pointer movement will be inverted if the pins are connected in the wrong order; simply swapping the pins will correct the direction. It is possible to correct the mouse movement direction in software however this is not recommended as it will make the device incompatible with other cables.
Most retro computers expect either two or three button mice. If your computer supports only 2 buttons then the middle-button (MB) signal should be left unconnected.
SmallyMouse2 is designed to be powered from the retro computer where appropriate power is available. To correctly power SmallyMouse2 ensure that both the 5V and 0V (ground) pins are connected.
Care should be taken to ensure the retro computer can supply the required voltage and current. Typically, SmallyMouse2 requires 5 volts (+- 0.1V) and 180mA current (including the USB mouse). If you experience unreliable USB connectivity (i.e. the USB mouse either does not connect, or disconnects intermittently) check the power supply to the board. USB is more sensitive to incorrect power than PS/2 based solutions.
If the host retro computer cannot supply the required power, it is possible to power the SmallyMouse2 board externally. In this case one of the 0V pins should be connected to the retro computer (there must be a ‘common’ ground between SmallyMouse2 and the computer), the other 0V and the 5V pins can then be connected to an external power source. Any external source should be regulated to exactly 5 volts (as there is no regulation provided by SmallyMouse2). Alternatively, it is also possible to use a DC-DC converter (for example a charge-pump circuit) to bring the retro computer supply to the correct values for SmallyMouse2 by placing the converter in-line with the mouse interface.
An externally powered configuration is shown in the following picture (the board is populated and configured for connection to an Acorn Archimedes A400 using an external power supply connected via a DC jack):
Note that the SmallyMouse2 board should be powered only from a single source. If a 5V external supply is connected to the board, the host retro machine should not be connected to the 5V pin simultaneously.
The 10-pin expansion header is a general-purpose interface for custom extensions to SmallyMouse2 and allows for non-standard retro computer interfaces. The expansion header provides 8 general purpose IO pins and two power pins (that can be used for supplying power to add-on boards or as a power input) via a 10-pin SIL header (optional).
The expansion header also provides access to the serial UART and I2C features of the AVR microcontroller. The standard firmware provides a serial debug console via the UART. This console is useful for debugging information and provides information about the status of the USB device (device connected, enumeration, etc.). The serial console can be accessed by connecting a USB to serial converter (such as the Arduino USB2Serial board) to the expansion header; only 2 wires are required, Tx (pin 4) and 0Vs (pin 9). The Tx output from the AVR should be connected to the Rx input of the serial adapter. Serial output is 9600 8N1.
Note: For firmware release V1.2 and above the D7 pin is used for a DPI divider header (the header is placed over D7 and 0V to turn on the feature). See the section below about mice with high DPI.
SmallyMouse2 has 3 board links that can either be left unconnected or made accessible using 2 pin headers and appropriate jumpers. The link marked ‘Slow’ is used to configure the quadrature rate limitation feature. When SmallyMouse2 is used with slower retro machines (especially 8-bit), fitting a jumper to the link will configure the software to limit the maximum speed of the quadrature output (this prevents the host ‘missing’ quick mouse movements due to the limited update speed of VIA chips in such machines).
The two links marked RST and HWB provide access to the reset and hardware bootloader pins of the AVR and are not required for general use. Placing a jumper on either header will make the corresponding signal active to the AVR. These links are used for programming the AVR via the USB bootloader and should be left unconnected for normal use; please see the firmware programming section below for more details.
The SmallyMouse2 firmware functions by using the LUFA USB stack to communicate and control an attached USB mouse device using the USB HID protocol. The USB mouse periodically sends position update reports to the host (at a rate of between 100-125 reports a second when the mouse is moving; the actual update speed depends on the implementation of the mouse). This style of updating generates problems for quadrature emulation since, in a quadrature mouse, the output would be a constant flow of information with the frequency of the pulses indicating how far the mouse has moved.
SmallyMouse2 emulates the quadrature output using the AVR’s timers (one timer for X and another for Y) – and sends the quadrature at a variable rate depending on how fast the mouse is moving. The quadrature output is timed so the device can send as much of the movement information as possible before another USB report is received.
The output of a quadrature mouse has 4 phases (hence the name) and the speed of the phases are dependent on the mechanical encoders present in the mouse. Modern USB mice no longer use mechanical encoders so the output is digital. A modern USB mouse sends continuous reports stating how far the mouse has moved in both the X and Y direction (since the last report).
The SmallyMouse2 firmware emulates the analogue nature of the quadrature output by using variable timers that control the time between phases. For each unit of reported movement (from the USB report) the firmware advances the appropriate axis by one phase. This has the effect of providing a 4:1 reduction in the overall output speed without the loss of any ‘information’ about movement. If a USB mouse reports at a rate of 100 reports per second at the maximum movement speed (127 movement units per report), SmallyMouse2 is receiving 12,700 movement unit updates per second. This results in a quadrature output rate of 3175 Hz. Due to variations in USB mouse report frequency (and limitations of the AVR’s timer resolution) SmallyMouse2 is written to support a maximum quadrature frequency of about 3900 Hz – this is more than sufficient to provide lag-free movement.
Limiting the quadrature rate
With 8-bit retro computers it was possible to move the mouse faster than the host computer could detect – this would cause spurious updates with the mouse pointer seeming to bounce around the display. SmallyMouse2 contains a rate limiting algorithm that prevents the device from overrunning the host computer. Two definitions in the firmware control this, namely Q_RATELIMIT and Q_BUFFERLIMIT. The rate limit sets the maximum frequency of the quadrature output generated by SmallyMouse2 and is specified in Hertz (i.e. the number of quadrature signals per second). This prevents the device from outputting faster than the 8-bit host can count. Since there is only a limited time between USB reports, any extra position updates that cannot be sent to the host will be lost. The buffer limit parameter specifies how much overrun should be allowed before updates are disregarded. By altering these two parameters it is possible to tune the quadrature output for a specific computer. By default, the firmware provides a ‘safe’ value that should work with a wide-range of machines.
The Q_RATELIMIT is only applied to the output when the ‘slow’ configuration header is shorted (i.e. a jumper is placed on the 2 pin header). The Q_BUFFERLIMIT is always applied; however, this should have no effect if the slow configuration header is open (as the normal output rate should allow the output to keep up with the USB reports).
Using with high DPI USB mice
Some USB mice have extremely high DPI and can cause SmallyMouse2 to output mouse movement too fast. As of firmware V1.2 you can place a jumper between D7 and 0V on the expansion header to turn on the DPI divider feature. If turned on, SmallyMouse2 will divide the incoming USB mouse movements by 2 to decrease the rate at which the mouse moves. This can be combined with the quadrature limiting feature described above.
For development or troubleshooting SmallyMouse2 provides a serial debug output that can be used to monitor the status of the USB interface. This output is available on the expansion header (see the expansion header section above for details).
The expansion header D0 pin also outputs a pulse every time a USB report is processed (the pin is raised at the start of processing and lowered at the end). This allows monitoring of the rate at which USB reports are received (useful for debugging).
Firmware programming via USB
When the SmallyMouse2 board is first made the AT90USB1287 will automatically power-up into the Atmel FLIP DFU bootloader. In this mode the microcontroller can be programmed using the USB bootloader programming utilities published by Atmel (ensure that you install the USB drivers for the application too!). In addition, Atmel Studio is also compatible with the bootloader and will recognised SmallyMouse2 as a programming device.
For initial programming SmallyMouse2 should be connected to the host computer using a USB A to A cable. No other connections should be made to the board and no external power is required.
After initial programming SmallyMouse2 will configure the USB port in host mode and the bootloader will not activate by default. Further programming requires use of the RST and HWB headers on the SmallyMouse2 board (these headers can be omitted for production runs where subsequent programming is not required). To overwrite the firmware jumper connectors should be placed on both the RST and HWB links before connecting the board to the host computer via USB. Once connected via USB the RST jumper should be removed (leaving only the HWB jumper in place). This will cause SmallyMouse2 to initialise the bootloader ready for programming. Once programming is complete SmallyMouse2 should be disconnected from USB and the HWB jumper should be removed.
SmallyMouse2 was designed to provide USB mouse connectivity to the widest possible range of retro machines and it is expected that many cable variations will be made available. As more verified cable designs are made available they will be added to this section.
Acorn BBC Model B and Master 128
The connection cable for the BBC Micro and Master range of 8-bit connectors is a direct 20 pin IDC to IDC ribbon cable. Both the BBC Model B and the Master 128 have been tested successfully with release v1.1 of the SmallyMouse2 firmware.
Acorn Archimedes A400 and RISC PC range
The following pinout is used to connect SmallyMouse2 to the Acorn Archimedes A400 and RISC PC range of computers:
The Acorn Archimedes A440/1 computer and the Acorn RISC PC 600 has been tested successfully with release v1.1 of the SmallyMouse2 firmware.
The following pinout is used to connect SmallyMouse2 to the Commodore Amiga range of computers:
The Commodore Amiga A600 has been successfully tested with release v1.1 of the SmallyMouse2 firmware (testing and pinout kindly provided by Bas of BetaGamma Computing).
Note: The rated maximum output of the Amiga mouse/joystick port is only 50mA; so technically you will need to externally power the SmallyMouse2 board (leaving pin 7 from the port disconnected); however testing shows that the port is generally capable of supplying enough power (previous PS/2 based adapters have been used with Amigas and these will have a power draw similar to the SmallyMouse2 board).
The following pinout is used to connect SmallyMouse2 to the Atari ST range of computers:
The Atari 520 ST has been successfully tested with release v1.1 of the SmallyMouse2 firmware (testing and pinout kindly provided by Bas of BetaGamma Computing).
Note: The power output from the Atari 520ST mouse/joystick port was measured at only 4.5V (on the machine used for testing). This can cause unreliable USB connectivity. An external 5V power supply is recommended (leaving pin 7 from the port disconnected).
The SmallyMouse2 logo is a monochrome rendering of a mouse with the tail representing the number 2. The logo was drawn in Adobe Illustrator and can be downloaded from the GitHub repository.
SmallyMouse2 was designed due to the encouraging response and feedback from the original project. There seems to be a big demand for an interface to allow retro computers to use even the most modern mice. The project has been released as open-source and open-hardware to allow anyone to make the device either for personal use or for resale. All such activities are positively encouraged and even commercial sale is allowed by the licensing (however anyone intending on such activities should ensure they understand the share-alike nature of both the GPL and CC licenses intended to ensure the project remains open to all).
If you liked this project or came to the site for firmware updates or other information, please consider leaving a PayPal donation to help fund this and future projects! As a non-commercial open-source, open-hardware project only your donations to this site fund development.
Files for download
All project files are available from the GitHub repository:
Please note that any firmware enhancements will be made available via GitHub in the releases section of the project.
Where can I buy one?
SmallyMouse is an open-source, open-hardware project. Everything you need to make your own board is available from the GitHub repository. WaitingForFriday.com doesn’t supply ready-made boards or kits (just the actual work of designing and development!) – if you’d like to buy a SmallyMouse2 then you are welcome to try the following resources (note: these resources are not associated, supported or endorsed by WaitingForFriday.com and are provided for your convenience):
BetaGamma Computing in the UK is making and selling completed boards. Please see their Facebook group page for details:
The renown Acorn shop CJE Micros is also producing completed boards in the UK. More information is available on their web-shop:
User [dnotq] has posted the board design on OSH Park (a service where you can order the bare PCB for making your own board):
If you know of any other sources for SmallyMouse2 please post in the comments and I will add them to this list.